Add support for partial component class editing -> refresh components.
- We now do aggressive detection on the type of C# class that's being edited. In order to not impact C# scenarios we only do work if C# assets are available to us. Meaning, we inspect the old document and if that document has its' semantic model available we spend cycles to determine if it's a component. In the case that we find a C# component class that wasn't previously caught we enqueue an update.
- Added several tests to ensure we enqueue and that we properly detect component classes.
aspnet/AspNetCoredotnet/aspnetcore-tooling#14646
\n\nCommit migrated from d8b62e121f
This commit is contained in:
parent
82e62cb34f
commit
163c09f984
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.CodeAnalysis.Razor
|
||||
{
|
||||
internal static class ComponentDetectionConventions
|
||||
{
|
||||
public static bool IsComponent(INamedTypeSymbol symbol, INamedTypeSymbol icomponentSymbol)
|
||||
{
|
||||
if (symbol is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(symbol));
|
||||
}
|
||||
|
||||
if (icomponentSymbol is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(icomponentSymbol));
|
||||
}
|
||||
|
||||
return
|
||||
symbol.DeclaredAccessibility == Accessibility.Public &&
|
||||
!symbol.IsAbstract &&
|
||||
symbol.AllInterfaces.Contains(icomponentSymbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -573,10 +573,8 @@ namespace Microsoft.CodeAnalysis.Razor
|
|||
return false;
|
||||
}
|
||||
|
||||
return
|
||||
symbol.DeclaredAccessibility == Accessibility.Public &&
|
||||
!symbol.IsAbstract &&
|
||||
symbol.AllInterfaces.Contains(_symbols.IComponent);
|
||||
var isComponent = ComponentDetectionConventions.IsComponent(symbol, _symbols.IComponent);
|
||||
return isComponent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue