Update naming and branding for components

This commit is contained in:
Ryan Nowak 2019-02-25 15:06:29 -08:00
Родитель 2ca30ed836
Коммит f820894941
19 изменённых файлов: 216 добавлений и 216 удалений

Просмотреть файл

@ -1,87 +0,0 @@
// 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.
namespace Microsoft.AspNetCore.Razor.Language.Components
{
// Metadata used for Blazor's interactions with the tag helper system
internal static class BlazorMetadata
{
// There's a bug in the 15.7 preview 1 Razor that prevents 'Kind' from being serialized
// this affects both tooling and build. For now our workaround is to ignore 'Kind' and
// use our own metadata entry to denote non-Component tag helpers.
public static readonly string SpecialKindKey = "Blazor.IsSpecialKind";
public static class Bind
{
public static readonly string RuntimeName = "Blazor.None";
public readonly static string TagHelperKind = "Blazor.Bind";
public readonly static string FallbackKey = "Blazor.Bind.Fallback";
public readonly static string TypeAttribute = "Blazor.Bind.TypeAttribute";
public readonly static string ValueAttribute = "Blazor.Bind.ValueAttribute";
public readonly static string ChangeAttribute = "Blazor.Bind.ChangeAttribute";
public readonly static string ExpressionAttribute = "Blazor.Bind.ExpressionAttribute";
}
public static class ChildContent
{
public static readonly string RuntimeName = "Blazor.None";
public static readonly string TagHelperKind = "Blazor.ChildContent";
public static readonly string ParameterNameBoundAttributeKind = "Blazor.ChildContentParameterName";
/// <summary>
/// The name of the synthesized attribute used to set a child content parameter.
/// </summary>
public static readonly string ParameterAttributeName = "Context";
/// <summary>
/// The default name of the child content parameter (unless set by a Context attribute).
/// </summary>
public static readonly string DefaultParameterName = "context";
}
public static class Component
{
public static readonly string ChildContentKey = "Blazor.ChildContent";
public static readonly string ChildContentParameterNameKey = "Blazor.ChildContentParameterName";
public static readonly string DelegateSignatureKey = "Blazor.DelegateSignature";
public static readonly string EventCallbackKey = "Blazor.EventCallback";
public static readonly string WeaklyTypedKey = "Blazor.IsWeaklyTyped";
public static readonly string RuntimeName = "Blazor.IComponent";
public readonly static string TagHelperKind = "Blazor.Component";
public readonly static string GenericTypedKey = "Blazor.GenericTyped";
public readonly static string TypeParameterKey = "Blazor.TypeParameter";
}
public static class EventHandler
{
public static readonly string EventArgsType = "Blazor.EventHandler.EventArgs";
public static readonly string RuntimeName = "Blazor.None";
public readonly static string TagHelperKind = "Blazor.EventHandler";
}
public static class Ref
{
public readonly static string TagHelperKind = "Blazor.Ref";
public static readonly string RuntimeName = "Blazor.None";
}
}
}

Просмотреть файл

@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Razor.Language.Intermediate;
namespace Microsoft.AspNetCore.Razor.Language.Components namespace Microsoft.AspNetCore.Razor.Language.Components
{ {
// We don't support 'complex' content for components (mixed C# and markup) right now. // We don't support 'complex' content for components (mixed C# and markup) right now.
// It's not clear yet if Blazor will have a good scenario to use these constructs. // It's not clear yet if components will have a good scenario to use these constructs.
// //
// This is where a lot of the complexity in the Razor/TagHelpers model creeps in and we // This is where a lot of the complexity in the Razor/TagHelpers model creeps in and we
// might be able to avoid it if these features aren't needed. // might be able to avoid it if these features aren't needed.

Просмотреть файл

@ -284,7 +284,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// Now we need to insert the type inference node into the tree. // Now we need to insert the type inference node into the tree.
var namespaceNode = documentNode.Children var namespaceNode = documentNode.Children
.OfType<NamespaceDeclarationIntermediateNode>() .OfType<NamespaceDeclarationIntermediateNode>()
.Where(n => n.Annotations.Contains(new KeyValuePair<object, object>(BlazorMetadata.Component.GenericTypedKey, bool.TrueString))) .Where(n => n.Annotations.Contains(new KeyValuePair<object, object>(ComponentMetadata.Component.GenericTypedKey, bool.TrueString)))
.FirstOrDefault(); .FirstOrDefault();
if (namespaceNode == null) if (namespaceNode == null)
{ {
@ -292,7 +292,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
{ {
Annotations = Annotations =
{ {
{ BlazorMetadata.Component.GenericTypedKey, bool.TrueString }, { ComponentMetadata.Component.GenericTypedKey, bool.TrueString },
}, },
Content = @namespace, Content = @namespace,
}; };

Просмотреть файл

@ -6,7 +6,7 @@ using System;
namespace Microsoft.AspNetCore.Razor.Language.Components namespace Microsoft.AspNetCore.Razor.Language.Components
{ {
// Much of the following is equivalent to Microsoft.AspNetCore.Mvc.Razor.Extensions's InjectDirective, // Much of the following is equivalent to Microsoft.AspNetCore.Mvc.Razor.Extensions's InjectDirective,
// but this one outputs properties annotated for Blazor's property injector, plus it doesn't need to // but this one outputs properties annotated for Components's property injector, plus it doesn't need to
// support multiple CodeTargets. // support multiple CodeTargets.
internal class ComponentInjectDirective internal class ComponentInjectDirective

Просмотреть файл

@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
// because we see the nodes in the wrong order. // because we see the nodes in the wrong order.
foreach (var childContent in component.ChildContents) foreach (var childContent in component.ChildContents)
{ {
childContent.ParameterName = childContent.ParameterName ?? component.ChildContentParameterName ?? BlazorMetadata.ChildContent.DefaultParameterName; childContent.ParameterName = childContent.ParameterName ?? component.ChildContentParameterName ?? ComponentMetadata.ChildContent.DefaultParameterName;
} }
return component; return component;

Просмотреть файл

@ -0,0 +1,87 @@
// 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.
namespace Microsoft.AspNetCore.Razor.Language.Components
{
// Metadata used for Components interactions with the tag helper system
internal static class ComponentMetadata
{
// There's a bug in the 15.7 preview 1 Razor that prevents 'Kind' from being serialized
// this affects both tooling and build. For now our workaround is to ignore 'Kind' and
// use our own metadata entry to denote non-Component tag helpers.
public static readonly string SpecialKindKey = "Components.IsSpecialKind";
public static class Bind
{
public static readonly string RuntimeName = "Components.None";
public readonly static string TagHelperKind = "Components.Bind";
public readonly static string FallbackKey = "Components.Bind.Fallback";
public readonly static string TypeAttribute = "Components.Bind.TypeAttribute";
public readonly static string ValueAttribute = "Components.Bind.ValueAttribute";
public readonly static string ChangeAttribute = "Components.Bind.ChangeAttribute";
public readonly static string ExpressionAttribute = "Components.Bind.ExpressionAttribute";
}
public static class ChildContent
{
public static readonly string RuntimeName = "Components.None";
public static readonly string TagHelperKind = "Components.ChildContent";
public static readonly string ParameterNameBoundAttributeKind = "Components.ChildContentParameterName";
/// <summary>
/// The name of the synthesized attribute used to set a child content parameter.
/// </summary>
public static readonly string ParameterAttributeName = "Context";
/// <summary>
/// The default name of the child content parameter (unless set by a Context attribute).
/// </summary>
public static readonly string DefaultParameterName = "context";
}
public static class Component
{
public static readonly string ChildContentKey = "Components.ChildContent";
public static readonly string ChildContentParameterNameKey = "Components.ChildContentParameterName";
public static readonly string DelegateSignatureKey = "Components.DelegateSignature";
public static readonly string EventCallbackKey = "Components.EventCallback";
public static readonly string WeaklyTypedKey = "Components.IsWeaklyTyped";
public static readonly string RuntimeName = "Components.IComponent";
public readonly static string TagHelperKind = "Components.Component";
public readonly static string GenericTypedKey = "Components.GenericTyped";
public readonly static string TypeParameterKey = "Components.TypeParameter";
}
public static class EventHandler
{
public static readonly string EventArgsType = "Components.EventHandler.EventArgs";
public static readonly string RuntimeName = "Components.None";
public readonly static string TagHelperKind = "Components.EventHandler";
}
public static class Ref
{
public readonly static string TagHelperKind = "Components.Ref";
public static readonly string RuntimeName = "Components.None";
}
}
}

Просмотреть файл

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(attribute)); throw new ArgumentNullException(nameof(attribute));
} }
var key = BlazorMetadata.Component.DelegateSignatureKey; var key = ComponentMetadata.Component.DelegateSignatureKey;
return return
attribute.Metadata.TryGetValue(key, out var value) && attribute.Metadata.TryGetValue(key, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(attribute)); throw new ArgumentNullException(nameof(attribute));
} }
var key = BlazorMetadata.Component.EventCallbackKey; var key = ComponentMetadata.Component.EventCallbackKey;
return return
attribute.Metadata.TryGetValue(key, out var value) && attribute.Metadata.TryGetValue(key, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
@ -47,7 +47,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
return return
attribute.Metadata.TryGetValue(BlazorMetadata.Component.GenericTypedKey, out var value) && attribute.Metadata.TryGetValue(ComponentMetadata.Component.GenericTypedKey, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
} }
@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
return return
attribute.Metadata.TryGetValue(BlazorMetadata.Component.TypeParameterKey, out var value) && attribute.Metadata.TryGetValue(ComponentMetadata.Component.TypeParameterKey, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
} }
@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(attribute)); throw new ArgumentNullException(nameof(attribute));
} }
var key = BlazorMetadata.Component.WeaklyTypedKey; var key = ComponentMetadata.Component.WeaklyTypedKey;
return return
attribute.Metadata.TryGetValue(key, out var value) && attribute.Metadata.TryGetValue(key, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(attribute)); throw new ArgumentNullException(nameof(attribute));
} }
var key = BlazorMetadata.Component.ChildContentKey; var key = ComponentMetadata.Component.ChildContentKey;
return return
attribute.Metadata.TryGetValue(key, out var value) && attribute.Metadata.TryGetValue(key, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(attribute)); throw new ArgumentNullException(nameof(attribute));
} }
var key = BlazorMetadata.Component.ChildContentKey; var key = ComponentMetadata.Component.ChildContentKey;
return return
attribute.Metadata.TryGetValue(key, out var value) && attribute.Metadata.TryGetValue(key, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);
@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(attribute)); throw new ArgumentNullException(nameof(attribute));
} }
var key = BlazorMetadata.Component.ChildContentParameterNameKey; var key = ComponentMetadata.Component.ChildContentParameterNameKey;
return return
attribute.Metadata.TryGetValue(key, out var value) && attribute.Metadata.TryGetValue(key, out var value) &&
string.Equals(value, bool.TrueString); string.Equals(value, bool.TrueString);

Просмотреть файл

@ -18,8 +18,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
return return
tagHelper.Metadata.TryGetValue(BlazorMetadata.SpecialKindKey, out var kind) && tagHelper.Metadata.TryGetValue(ComponentMetadata.SpecialKindKey, out var kind) &&
string.Equals(BlazorMetadata.Bind.TagHelperKind, kind); string.Equals(ComponentMetadata.Bind.TagHelperKind, kind);
} }
public static bool IsFallbackBindTagHelper(this TagHelperDescriptor tagHelper) public static bool IsFallbackBindTagHelper(this TagHelperDescriptor tagHelper)
@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
return return
tagHelper.IsBindTagHelper() && tagHelper.IsBindTagHelper() &&
tagHelper.Metadata.TryGetValue(BlazorMetadata.Bind.FallbackKey, out var fallback) && tagHelper.Metadata.TryGetValue(ComponentMetadata.Bind.FallbackKey, out var fallback) &&
string.Equals(bool.TrueString, fallback); string.Equals(bool.TrueString, fallback);
} }
@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
return return
IsComponentTagHelper(tagHelper) && IsComponentTagHelper(tagHelper) &&
tagHelper.Metadata.TryGetValue(BlazorMetadata.Component.GenericTypedKey, out var value) && tagHelper.Metadata.TryGetValue(ComponentMetadata.Component.GenericTypedKey, out var value) &&
string.Equals(bool.TrueString, value); string.Equals(bool.TrueString, value);
} }
@ -70,7 +70,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
return return
tagHelper.IsInputElementBindTagHelper() && tagHelper.IsInputElementBindTagHelper() &&
!tagHelper.Metadata.ContainsKey(BlazorMetadata.Bind.TypeAttribute); !tagHelper.Metadata.ContainsKey(ComponentMetadata.Bind.TypeAttribute);
} }
public static string GetValueAttributeName(this TagHelperDescriptor tagHelper) public static string GetValueAttributeName(this TagHelperDescriptor tagHelper)
@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(tagHelper)); throw new ArgumentNullException(nameof(tagHelper));
} }
tagHelper.Metadata.TryGetValue(BlazorMetadata.Bind.ValueAttribute, out var result); tagHelper.Metadata.TryGetValue(ComponentMetadata.Bind.ValueAttribute, out var result);
return result; return result;
} }
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(tagHelper)); throw new ArgumentNullException(nameof(tagHelper));
} }
tagHelper.Metadata.TryGetValue(BlazorMetadata.Bind.ChangeAttribute, out var result); tagHelper.Metadata.TryGetValue(ComponentMetadata.Bind.ChangeAttribute, out var result);
return result; return result;
} }
@ -102,7 +102,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(tagHelper)); throw new ArgumentNullException(nameof(tagHelper));
} }
tagHelper.Metadata.TryGetValue(BlazorMetadata.Bind.ExpressionAttribute, out var result); tagHelper.Metadata.TryGetValue(ComponentMetadata.Bind.ExpressionAttribute, out var result);
return result; return result;
} }
@ -114,8 +114,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
return return
tagHelper.Metadata.TryGetValue(BlazorMetadata.SpecialKindKey, out var value) && tagHelper.Metadata.TryGetValue(ComponentMetadata.SpecialKindKey, out var value) &&
string.Equals(value, BlazorMetadata.ChildContent.TagHelperKind, StringComparison.Ordinal); string.Equals(value, ComponentMetadata.ChildContent.TagHelperKind, StringComparison.Ordinal);
} }
public static bool IsComponentTagHelper(this TagHelperDescriptor tagHelper) public static bool IsComponentTagHelper(this TagHelperDescriptor tagHelper)
@ -125,7 +125,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(tagHelper)); throw new ArgumentNullException(nameof(tagHelper));
} }
return !tagHelper.Metadata.ContainsKey(BlazorMetadata.SpecialKindKey); return !tagHelper.Metadata.ContainsKey(ComponentMetadata.SpecialKindKey);
} }
public static bool IsEventHandlerTagHelper(this TagHelperDescriptor tagHelper) public static bool IsEventHandlerTagHelper(this TagHelperDescriptor tagHelper)
@ -136,8 +136,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
return return
tagHelper.Metadata.TryGetValue(BlazorMetadata.SpecialKindKey, out var kind) && tagHelper.Metadata.TryGetValue(ComponentMetadata.SpecialKindKey, out var kind) &&
string.Equals(BlazorMetadata.EventHandler.TagHelperKind, kind); string.Equals(ComponentMetadata.EventHandler.TagHelperKind, kind);
} }
public static bool IsRefTagHelper(this TagHelperDescriptor tagHelper) public static bool IsRefTagHelper(this TagHelperDescriptor tagHelper)
@ -148,8 +148,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
} }
return return
tagHelper.Metadata.TryGetValue(BlazorMetadata.SpecialKindKey, out var kind) && tagHelper.Metadata.TryGetValue(ComponentMetadata.SpecialKindKey, out var kind) &&
string.Equals(BlazorMetadata.Ref.TagHelperKind, kind); string.Equals(ComponentMetadata.Ref.TagHelperKind, kind);
} }
public static string GetEventArgsType(this TagHelperDescriptor tagHelper) public static string GetEventArgsType(this TagHelperDescriptor tagHelper)
@ -159,7 +159,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Components
throw new ArgumentNullException(nameof(tagHelper)); throw new ArgumentNullException(nameof(tagHelper));
} }
tagHelper.Metadata.TryGetValue(BlazorMetadata.EventHandler.EventArgsType, out var result); tagHelper.Metadata.TryGetValue(ComponentMetadata.EventHandler.EventArgsType, out var result);
return result; return result;
} }

Просмотреть файл

@ -117,13 +117,13 @@ namespace Microsoft.CodeAnalysis.Razor
private TagHelperDescriptor CreateFallbackBindTagHelper() private TagHelperDescriptor CreateFallbackBindTagHelper()
{ {
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.Bind.TagHelperKind, "Bind", ComponentsApi.AssemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.Bind.TagHelperKind, "Bind", ComponentsApi.AssemblyName);
builder.Documentation = ComponentResources.BindTagHelper_Fallback_Documentation; builder.Documentation = ComponentResources.BindTagHelper_Fallback_Documentation;
builder.Metadata.Add(BlazorMetadata.SpecialKindKey, BlazorMetadata.Bind.TagHelperKind); builder.Metadata.Add(ComponentMetadata.SpecialKindKey, ComponentMetadata.Bind.TagHelperKind);
builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString); builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString);
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.Bind.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.Bind.RuntimeName;
builder.Metadata[BlazorMetadata.Bind.FallbackKey] = bool.TrueString; builder.Metadata[ComponentMetadata.Bind.FallbackKey] = bool.TrueString;
// WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like // WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the toolips. // a C# property will crash trying to create the toolips.
@ -251,17 +251,17 @@ namespace Microsoft.CodeAnalysis.Razor
var formatName = entry.Suffix == null ? "Format_" + entry.ValueAttribute : "Format_" + entry.Suffix; var formatName = entry.Suffix == null ? "Format_" + entry.ValueAttribute : "Format_" + entry.Suffix;
var formatAttributeName = entry.Suffix == null ? "format-" + entry.ValueAttribute : "format-" + entry.Suffix; var formatAttributeName = entry.Suffix == null ? "format-" + entry.ValueAttribute : "format-" + entry.Suffix;
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.Bind.TagHelperKind, name, ComponentsApi.AssemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.Bind.TagHelperKind, name, ComponentsApi.AssemblyName);
builder.Documentation = string.Format( builder.Documentation = string.Format(
ComponentResources.BindTagHelper_Element_Documentation, ComponentResources.BindTagHelper_Element_Documentation,
entry.ValueAttribute, entry.ValueAttribute,
entry.ChangeAttribute); entry.ChangeAttribute);
builder.Metadata.Add(BlazorMetadata.SpecialKindKey, BlazorMetadata.Bind.TagHelperKind); builder.Metadata.Add(ComponentMetadata.SpecialKindKey, ComponentMetadata.Bind.TagHelperKind);
builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString); builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString);
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.Bind.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.Bind.RuntimeName;
builder.Metadata[BlazorMetadata.Bind.ValueAttribute] = entry.ValueAttribute; builder.Metadata[ComponentMetadata.Bind.ValueAttribute] = entry.ValueAttribute;
builder.Metadata[BlazorMetadata.Bind.ChangeAttribute] = entry.ChangeAttribute; builder.Metadata[ComponentMetadata.Bind.ChangeAttribute] = entry.ChangeAttribute;
if (entry.TypeAttribute != null) if (entry.TypeAttribute != null)
{ {
@ -274,7 +274,7 @@ namespace Microsoft.CodeAnalysis.Razor
// //
// Therefore we use this metadata to know which one is more specific when two // Therefore we use this metadata to know which one is more specific when two
// tag helpers match. // tag helpers match.
builder.Metadata[BlazorMetadata.Bind.TypeAttribute] = entry.TypeAttribute; builder.Metadata[ComponentMetadata.Bind.TypeAttribute] = entry.TypeAttribute;
} }
// WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like // WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like
@ -397,21 +397,21 @@ namespace Microsoft.CodeAnalysis.Razor
continue; continue;
} }
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.Bind.TagHelperKind, tagHelper.Name, tagHelper.AssemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.Bind.TagHelperKind, tagHelper.Name, tagHelper.AssemblyName);
builder.DisplayName = tagHelper.DisplayName; builder.DisplayName = tagHelper.DisplayName;
builder.Documentation = string.Format( builder.Documentation = string.Format(
ComponentResources.BindTagHelper_Component_Documentation, ComponentResources.BindTagHelper_Component_Documentation,
valueAttribute.Name, valueAttribute.Name,
changeAttribute.Name); changeAttribute.Name);
builder.Metadata.Add(BlazorMetadata.SpecialKindKey, BlazorMetadata.Bind.TagHelperKind); builder.Metadata.Add(ComponentMetadata.SpecialKindKey, ComponentMetadata.Bind.TagHelperKind);
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.Bind.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.Bind.RuntimeName;
builder.Metadata[BlazorMetadata.Bind.ValueAttribute] = valueAttribute.Name; builder.Metadata[ComponentMetadata.Bind.ValueAttribute] = valueAttribute.Name;
builder.Metadata[BlazorMetadata.Bind.ChangeAttribute] = changeAttribute.Name; builder.Metadata[ComponentMetadata.Bind.ChangeAttribute] = changeAttribute.Name;
if (expressionAttribute != null) if (expressionAttribute != null)
{ {
builder.Metadata[BlazorMetadata.Bind.ExpressionAttribute] = expressionAttribute.Name; builder.Metadata[ComponentMetadata.Bind.ExpressionAttribute] = expressionAttribute.Name;
} }
// WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like // WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like

Просмотреть файл

@ -86,16 +86,16 @@ namespace Microsoft.CodeAnalysis.Razor
var typeName = type.ToDisplayString(FullNameTypeDisplayFormat); var typeName = type.ToDisplayString(FullNameTypeDisplayFormat);
var assemblyName = type.ContainingAssembly.Identity.Name; var assemblyName = type.ContainingAssembly.Identity.Name;
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.Component.TagHelperKind, typeName, assemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.Component.TagHelperKind, typeName, assemblyName);
builder.SetTypeName(typeName); builder.SetTypeName(typeName);
// This opts out this 'component' tag helper for any processing that's specific to the default // This opts out this 'component' tag helper for any processing that's specific to the default
// Razor ITagHelper runtime. // Razor ITagHelper runtime.
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.Component.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.Component.RuntimeName;
if (type.IsGenericType) if (type.IsGenericType)
{ {
builder.Metadata[BlazorMetadata.Component.GenericTypedKey] = bool.TrueString; builder.Metadata[ComponentMetadata.Component.GenericTypedKey] = bool.TrueString;
for (var i = 0; i < type.TypeArguments.Length; i++) for (var i = 0; i < type.TypeArguments.Length; i++)
{ {
@ -127,7 +127,7 @@ namespace Microsoft.CodeAnalysis.Razor
} }
if (builder.BoundAttributes.Any(a => a.IsParameterizedChildContentProperty()) && if (builder.BoundAttributes.Any(a => a.IsParameterizedChildContentProperty()) &&
!builder.BoundAttributes.Any(a => string.Equals(a.Name, BlazorMetadata.ChildContent.ParameterAttributeName, StringComparison.OrdinalIgnoreCase))) !builder.BoundAttributes.Any(a => string.Equals(a.Name, ComponentMetadata.ChildContent.ParameterAttributeName, StringComparison.OrdinalIgnoreCase)))
{ {
// If we have any parameterized child content parameters, synthesize a 'Context' parameter to be // If we have any parameterized child content parameters, synthesize a 'Context' parameter to be
// able to set the variable name (for all child content). If the developer defined a 'Context' parameter // able to set the variable name (for all child content). If the developer defined a 'Context' parameter
@ -154,22 +154,22 @@ namespace Microsoft.CodeAnalysis.Razor
if (kind == PropertyKind.ChildContent) if (kind == PropertyKind.ChildContent)
{ {
pb.Metadata.Add(BlazorMetadata.Component.ChildContentKey, bool.TrueString); pb.Metadata.Add(ComponentMetadata.Component.ChildContentKey, bool.TrueString);
} }
if (kind == PropertyKind.EventCallback) if (kind == PropertyKind.EventCallback)
{ {
pb.Metadata.Add(BlazorMetadata.Component.EventCallbackKey, bool.TrueString); pb.Metadata.Add(ComponentMetadata.Component.EventCallbackKey, bool.TrueString);
} }
if (kind == PropertyKind.Delegate) if (kind == PropertyKind.Delegate)
{ {
pb.Metadata.Add(BlazorMetadata.Component.DelegateSignatureKey, bool.TrueString); pb.Metadata.Add(ComponentMetadata.Component.DelegateSignatureKey, bool.TrueString);
} }
if (HasTypeParameter(property.Type)) if (HasTypeParameter(property.Type))
{ {
pb.Metadata.Add(BlazorMetadata.Component.GenericTypedKey, bool.TrueString); pb.Metadata.Add(ComponentMetadata.Component.GenericTypedKey, bool.TrueString);
} }
var xml = property.GetDocumentationCommentXml(); var xml = property.GetDocumentationCommentXml();
@ -229,7 +229,7 @@ namespace Microsoft.CodeAnalysis.Razor
pb.TypeName = typeof(Type).FullName; pb.TypeName = typeof(Type).FullName;
pb.SetPropertyName(typeParameter.Name); pb.SetPropertyName(typeParameter.Name);
pb.Metadata[BlazorMetadata.Component.TypeParameterKey] = bool.TrueString; pb.Metadata[ComponentMetadata.Component.TypeParameterKey] = bool.TrueString;
pb.Documentation = string.Format(ComponentResources.ComponentTypeParameter_Documentation, typeParameter.Name, builder.Name); pb.Documentation = string.Format(ComponentResources.ComponentTypeParameter_Documentation, typeParameter.Name, builder.Name);
}); });
@ -240,15 +240,15 @@ namespace Microsoft.CodeAnalysis.Razor
var typeName = component.GetTypeName() + "." + attribute.Name; var typeName = component.GetTypeName() + "." + attribute.Name;
var assemblyName = component.AssemblyName; var assemblyName = component.AssemblyName;
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.ChildContent.TagHelperKind, typeName, assemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.ChildContent.TagHelperKind, typeName, assemblyName);
builder.SetTypeName(typeName); builder.SetTypeName(typeName);
// This opts out this 'component' tag helper for any processing that's specific to the default // This opts out this 'component' tag helper for any processing that's specific to the default
// Razor ITagHelper runtime. // Razor ITagHelper runtime.
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.ChildContent.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.ChildContent.RuntimeName;
// Opt out of processing as a component. We'll process this specially as part of the component's body. // Opt out of processing as a component. We'll process this specially as part of the component's body.
builder.Metadata[BlazorMetadata.SpecialKindKey] = BlazorMetadata.ChildContent.TagHelperKind; builder.Metadata[ComponentMetadata.SpecialKindKey] = ComponentMetadata.ChildContent.TagHelperKind;
var xml = attribute.Documentation; var xml = attribute.Documentation;
if (!string.IsNullOrEmpty(xml)) if (!string.IsNullOrEmpty(xml))
@ -279,9 +279,9 @@ namespace Microsoft.CodeAnalysis.Razor
{ {
builder.BindAttribute(b => builder.BindAttribute(b =>
{ {
b.Name = BlazorMetadata.ChildContent.ParameterAttributeName; b.Name = ComponentMetadata.ChildContent.ParameterAttributeName;
b.TypeName = typeof(string).FullName; b.TypeName = typeof(string).FullName;
b.Metadata.Add(BlazorMetadata.Component.ChildContentParameterNameKey, bool.TrueString); b.Metadata.Add(ComponentMetadata.Component.ChildContentParameterNameKey, bool.TrueString);
if (childContentName == null) if (childContentName == null)
{ {

Просмотреть файл

@ -103,16 +103,16 @@ namespace Microsoft.CodeAnalysis.Razor
{ {
var entry = data[i]; var entry = data[i];
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.EventHandler.TagHelperKind, entry.Attribute, ComponentsApi.AssemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.EventHandler.TagHelperKind, entry.Attribute, ComponentsApi.AssemblyName);
builder.Documentation = string.Format( builder.Documentation = string.Format(
ComponentResources.EventHandlerTagHelper_Documentation, ComponentResources.EventHandlerTagHelper_Documentation,
entry.Attribute, entry.Attribute,
entry.EventArgsType.ToDisplayString()); entry.EventArgsType.ToDisplayString());
builder.Metadata.Add(BlazorMetadata.SpecialKindKey, BlazorMetadata.EventHandler.TagHelperKind); builder.Metadata.Add(ComponentMetadata.SpecialKindKey, ComponentMetadata.EventHandler.TagHelperKind);
builder.Metadata.Add(BlazorMetadata.EventHandler.EventArgsType, entry.EventArgsType.ToDisplayString()); builder.Metadata.Add(ComponentMetadata.EventHandler.EventArgsType, entry.EventArgsType.ToDisplayString());
builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString); builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString);
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.EventHandler.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.EventHandler.RuntimeName;
// WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like // WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the tooltips. // a C# property will crash trying to create the tooltips.
@ -143,7 +143,7 @@ namespace Microsoft.CodeAnalysis.Razor
// But make this weakly typed (don't type check) - delegates have their own type-checking // But make this weakly typed (don't type check) - delegates have their own type-checking
// logic that we don't want to interfere with. // logic that we don't want to interfere with.
a.Metadata.Add(BlazorMetadata.Component.WeaklyTypedKey, bool.TrueString); a.Metadata.Add(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString);
// WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like // WTE has a bug 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the tooltips. // a C# property will crash trying to create the tooltips.

Просмотреть файл

@ -40,12 +40,12 @@ namespace Microsoft.CodeAnalysis.Razor
private TagHelperDescriptor CreateRefTagHelper() private TagHelperDescriptor CreateRefTagHelper()
{ {
var builder = TagHelperDescriptorBuilder.Create(BlazorMetadata.Ref.TagHelperKind, "Ref", ComponentsApi.AssemblyName); var builder = TagHelperDescriptorBuilder.Create(ComponentMetadata.Ref.TagHelperKind, "Ref", ComponentsApi.AssemblyName);
builder.Documentation = ComponentResources.RefTagHelper_Documentation; builder.Documentation = ComponentResources.RefTagHelper_Documentation;
builder.Metadata.Add(BlazorMetadata.SpecialKindKey, BlazorMetadata.Ref.TagHelperKind); builder.Metadata.Add(ComponentMetadata.SpecialKindKey, ComponentMetadata.Ref.TagHelperKind);
builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString); builder.Metadata.Add(TagHelperMetadata.Common.ClassifyAttributesOnly, bool.TrueString);
builder.Metadata[TagHelperMetadata.Runtime.Name] = BlazorMetadata.Ref.RuntimeName; builder.Metadata[TagHelperMetadata.Runtime.Name] = ComponentMetadata.Ref.RuntimeName;
// WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like // WTE has a bug in 15.7p1 where a Tag Helper without a display-name that looks like
// a C# property will crash trying to create the tooltips. // a C# property will crash trying to create the tooltips.

Просмотреть файл

@ -236,7 +236,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
else else
{ {
// For single phase compilation tests just use the base compilation's references. // For single phase compilation tests just use the base compilation's references.
// This will include the built-in Blazor components. // This will include the built-in components.
var projectEngine = CreateProjectEngine(Configuration, BaseCompilation.References.ToArray()); var projectEngine = CreateProjectEngine(Configuration, BaseCompilation.References.ToArray());
var projectItem = CreateProjectItem(cshtmlRelativePath, cshtmlContent); var projectItem = CreateProjectItem(cshtmlRelativePath, cshtmlContent);

Просмотреть файл

@ -66,14 +66,14 @@ namespace Test
// here and then ignoring them. // here and then ignoring them.
Assert.Empty(bind.Diagnostics); Assert.Empty(bind.Diagnostics);
Assert.False(bind.HasErrors); Assert.False(bind.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, bind.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, bind.Kind);
Assert.Equal(BlazorMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]); Assert.Equal(ComponentMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(bind.IsDefaultKind()); Assert.False(bind.IsDefaultKind());
Assert.False(bind.KindUsesDefaultTagHelperRuntime()); Assert.False(bind.KindUsesDefaultTagHelperRuntime());
Assert.Equal("MyProperty", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("MyProperty", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("MyPropertyChanged", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("MyPropertyChanged", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.Equal("MyPropertyExpression", bind.Metadata[BlazorMetadata.Bind.ExpressionAttribute]); Assert.Equal("MyPropertyExpression", bind.Metadata[ComponentMetadata.Bind.ExpressionAttribute]);
Assert.Equal( Assert.Equal(
"Binds the provided expression to the 'MyProperty' property and a change event " + "Binds the provided expression to the 'MyProperty' property and a change event " +
@ -106,7 +106,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer); Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix); Assert.Null(attribute.IndexerNamePrefix);
@ -181,13 +181,13 @@ namespace Test
// here and then ignoring them. // here and then ignoring them.
Assert.Empty(bind.Diagnostics); Assert.Empty(bind.Diagnostics);
Assert.False(bind.HasErrors); Assert.False(bind.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, bind.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, bind.Kind);
Assert.Equal(BlazorMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]); Assert.Equal(ComponentMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(bind.IsDefaultKind()); Assert.False(bind.IsDefaultKind());
Assert.False(bind.KindUsesDefaultTagHelperRuntime()); Assert.False(bind.KindUsesDefaultTagHelperRuntime());
Assert.Equal("MyProperty", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("MyProperty", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("MyPropertyChanged", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("MyPropertyChanged", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.Equal( Assert.Equal(
"Binds the provided expression to the 'MyProperty' property and a change event " + "Binds the provided expression to the 'MyProperty' property and a change event " +
@ -220,7 +220,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer); Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix); Assert.Null(attribute.IndexerNamePrefix);
@ -325,14 +325,14 @@ namespace Test
// here and then ignoring them. // here and then ignoring them.
Assert.Empty(bind.Diagnostics); Assert.Empty(bind.Diagnostics);
Assert.False(bind.HasErrors); Assert.False(bind.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, bind.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, bind.Kind);
Assert.Equal(bool.TrueString, bind.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]); Assert.Equal(bool.TrueString, bind.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]);
Assert.Equal(BlazorMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]); Assert.Equal(ComponentMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(bind.IsDefaultKind()); Assert.False(bind.IsDefaultKind());
Assert.False(bind.KindUsesDefaultTagHelperRuntime()); Assert.False(bind.KindUsesDefaultTagHelperRuntime());
Assert.Equal("myprop", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("myprop", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("myevent", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("myevent", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.False(bind.IsInputElementBindTagHelper()); Assert.False(bind.IsInputElementBindTagHelper());
Assert.False(bind.IsInputElementFallbackBindTagHelper()); Assert.False(bind.IsInputElementFallbackBindTagHelper());
@ -368,7 +368,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer); Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix); Assert.Null(attribute.IndexerNamePrefix);
@ -396,7 +396,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer); Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix); Assert.Null(attribute.IndexerNamePrefix);
@ -450,8 +450,8 @@ namespace Test
var matches = GetBindTagHelpers(context); var matches = GetBindTagHelpers(context);
var bind = Assert.Single(matches); var bind = Assert.Single(matches);
Assert.Equal("myprop", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("myprop", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("myevent", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("myevent", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.False(bind.IsInputElementBindTagHelper()); Assert.False(bind.IsInputElementBindTagHelper());
Assert.False(bind.IsInputElementFallbackBindTagHelper()); Assert.False(bind.IsInputElementFallbackBindTagHelper());
@ -504,9 +504,9 @@ namespace Test
var matches = GetBindTagHelpers(context); var matches = GetBindTagHelpers(context);
var bind = Assert.Single(matches); var bind = Assert.Single(matches);
Assert.Equal("myprop", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("myprop", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("myevent", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("myevent", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.False(bind.Metadata.ContainsKey(BlazorMetadata.Bind.TypeAttribute)); Assert.False(bind.Metadata.ContainsKey(ComponentMetadata.Bind.TypeAttribute));
Assert.True(bind.IsInputElementBindTagHelper()); Assert.True(bind.IsInputElementBindTagHelper());
Assert.True(bind.IsInputElementFallbackBindTagHelper()); Assert.True(bind.IsInputElementFallbackBindTagHelper());
@ -559,9 +559,9 @@ namespace Test
var matches = GetBindTagHelpers(context); var matches = GetBindTagHelpers(context);
var bind = Assert.Single(matches); var bind = Assert.Single(matches);
Assert.Equal("myprop", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("myprop", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("myevent", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("myevent", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.Equal("checkbox", bind.Metadata[BlazorMetadata.Bind.TypeAttribute]); Assert.Equal("checkbox", bind.Metadata[ComponentMetadata.Bind.TypeAttribute]);
Assert.True(bind.IsInputElementBindTagHelper()); Assert.True(bind.IsInputElementBindTagHelper());
Assert.False(bind.IsInputElementFallbackBindTagHelper()); Assert.False(bind.IsInputElementFallbackBindTagHelper());
@ -626,9 +626,9 @@ namespace Test
var matches = GetBindTagHelpers(context); var matches = GetBindTagHelpers(context);
var bind = Assert.Single(matches); var bind = Assert.Single(matches);
Assert.Equal("myprop", bind.Metadata[BlazorMetadata.Bind.ValueAttribute]); Assert.Equal("myprop", bind.Metadata[ComponentMetadata.Bind.ValueAttribute]);
Assert.Equal("myevent", bind.Metadata[BlazorMetadata.Bind.ChangeAttribute]); Assert.Equal("myevent", bind.Metadata[ComponentMetadata.Bind.ChangeAttribute]);
Assert.Equal("checkbox", bind.Metadata[BlazorMetadata.Bind.TypeAttribute]); Assert.Equal("checkbox", bind.Metadata[ComponentMetadata.Bind.TypeAttribute]);
Assert.True(bind.IsInputElementBindTagHelper()); Assert.True(bind.IsInputElementBindTagHelper());
Assert.False(bind.IsInputElementFallbackBindTagHelper()); Assert.False(bind.IsInputElementFallbackBindTagHelper());
@ -690,14 +690,14 @@ namespace Test
// here and then ignoring them. // here and then ignoring them.
Assert.Empty(bind.Diagnostics); Assert.Empty(bind.Diagnostics);
Assert.False(bind.HasErrors); Assert.False(bind.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, bind.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, bind.Kind);
Assert.Equal(bool.TrueString, bind.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]); Assert.Equal(bool.TrueString, bind.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]);
Assert.Equal(BlazorMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]); Assert.Equal(ComponentMetadata.Bind.RuntimeName, bind.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(bind.IsDefaultKind()); Assert.False(bind.IsDefaultKind());
Assert.False(bind.KindUsesDefaultTagHelperRuntime()); Assert.False(bind.KindUsesDefaultTagHelperRuntime());
Assert.False(bind.Metadata.ContainsKey(BlazorMetadata.Bind.ValueAttribute)); Assert.False(bind.Metadata.ContainsKey(ComponentMetadata.Bind.ValueAttribute));
Assert.False(bind.Metadata.ContainsKey(BlazorMetadata.Bind.ChangeAttribute)); Assert.False(bind.Metadata.ContainsKey(ComponentMetadata.Bind.ChangeAttribute));
Assert.True(bind.IsFallbackBindTagHelper()); Assert.True(bind.IsFallbackBindTagHelper());
Assert.Equal( Assert.Equal(
@ -734,7 +734,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.IsIndexerBooleanProperty); Assert.False(attribute.IsIndexerBooleanProperty);
Assert.False(attribute.IsIndexerStringProperty); Assert.False(attribute.IsIndexerStringProperty);
@ -767,7 +767,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Bind.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Bind.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.True(attribute.HasIndexer); Assert.True(attribute.HasIndexer);
Assert.Equal("format-", attribute.IndexerNamePrefix); Assert.Equal("format-", attribute.IndexerNamePrefix);

Просмотреть файл

@ -56,7 +56,7 @@ namespace Test
// here and then ignoring them. // here and then ignoring them.
Assert.Empty(component.Diagnostics); Assert.Empty(component.Diagnostics);
Assert.False(component.HasErrors); Assert.False(component.HasErrors);
Assert.Equal(BlazorMetadata.Component.TagHelperKind, component.Kind); Assert.Equal(ComponentMetadata.Component.TagHelperKind, component.Kind);
Assert.False(component.IsDefaultKind()); Assert.False(component.IsDefaultKind());
Assert.False(component.KindUsesDefaultTagHelperRuntime()); Assert.False(component.KindUsesDefaultTagHelperRuntime());
@ -84,7 +84,7 @@ namespace Test
Assert.Collection( Assert.Collection(
component.Metadata.OrderBy(kvp => kvp.Key), component.Metadata.OrderBy(kvp => kvp.Key),
kvp => { Assert.Equal(TagHelperMetadata.Common.TypeName, kvp.Key); Assert.Equal("Test.MyComponent", kvp.Value); }, kvp => { Assert.Equal(TagHelperMetadata.Common.TypeName, kvp.Key); Assert.Equal("Test.MyComponent", kvp.Value); },
kvp => { Assert.Equal(TagHelperMetadata.Runtime.Name, kvp.Key); Assert.Equal("Blazor.IComponent", kvp.Value); }); kvp => { Assert.Equal(TagHelperMetadata.Runtime.Name, kvp.Key); Assert.Equal("Components.IComponent", kvp.Value); });
// Our use of bound attributes is what tests will focus on. As you might expect right now, this test // Our use of bound attributes is what tests will focus on. As you might expect right now, this test
// is going to cover a lot of trivial stuff that will be true for all components/component-properties. // is going to cover a lot of trivial stuff that will be true for all components/component-properties.
@ -93,7 +93,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal("Blazor.Component", attribute.Kind); Assert.Equal("Components.Component", attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
// Related to dictionaries/indexers, not supported currently, not sure if we ever will // Related to dictionaries/indexers, not supported currently, not sure if we ever will
@ -852,7 +852,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.True(a.IsChildContentParameterNameProperty()); Assert.True(a.IsChildContentParameterNameProperty());
}); });
@ -863,7 +863,7 @@ namespace Test
// A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name. // A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name.
var contextAttribute = Assert.Single(childContent.BoundAttributes); var contextAttribute = Assert.Single(childContent.BoundAttributes);
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name);
Assert.Equal("System.String", contextAttribute.TypeName); Assert.Equal("System.String", contextAttribute.TypeName);
Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation); Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation);
Assert.True(contextAttribute.IsChildContentParameterNameProperty()); Assert.True(contextAttribute.IsChildContentParameterNameProperty());
@ -926,7 +926,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.False(a.IsChildContentParameterNameProperty()); Assert.False(a.IsChildContentParameterNameProperty());
}); });
@ -937,7 +937,7 @@ namespace Test
// A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name. // A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name.
var contextAttribute = Assert.Single(childContent.BoundAttributes); var contextAttribute = Assert.Single(childContent.BoundAttributes);
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name);
Assert.Equal("System.String", contextAttribute.TypeName); Assert.Equal("System.String", contextAttribute.TypeName);
Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation); Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation);
Assert.True(contextAttribute.IsChildContentParameterNameProperty()); Assert.True(contextAttribute.IsChildContentParameterNameProperty());
@ -998,7 +998,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.True(a.IsChildContentParameterNameProperty()); Assert.True(a.IsChildContentParameterNameProperty());
}, },
a => a =>
@ -1017,7 +1017,7 @@ namespace Test
// A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name. // A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name.
var contextAttribute = Assert.Single(childContent.BoundAttributes); var contextAttribute = Assert.Single(childContent.BoundAttributes);
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name);
Assert.Equal("System.String", contextAttribute.TypeName); Assert.Equal("System.String", contextAttribute.TypeName);
Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation); Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation);
Assert.True(contextAttribute.IsChildContentParameterNameProperty()); Assert.True(contextAttribute.IsChildContentParameterNameProperty());
@ -1079,7 +1079,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.True(a.IsChildContentParameterNameProperty()); Assert.True(a.IsChildContentParameterNameProperty());
}, },
a => a =>
@ -1098,7 +1098,7 @@ namespace Test
// A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name. // A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name.
var contextAttribute = Assert.Single(childContent.BoundAttributes); var contextAttribute = Assert.Single(childContent.BoundAttributes);
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name);
Assert.Equal("System.String", contextAttribute.TypeName); Assert.Equal("System.String", contextAttribute.TypeName);
Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation); Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation);
Assert.True(contextAttribute.IsChildContentParameterNameProperty()); Assert.True(contextAttribute.IsChildContentParameterNameProperty());
@ -1160,7 +1160,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.True(a.IsChildContentParameterNameProperty()); Assert.True(a.IsChildContentParameterNameProperty());
}, },
a => a =>
@ -1179,7 +1179,7 @@ namespace Test
// A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name. // A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name.
var contextAttribute = Assert.Single(childContent.BoundAttributes); var contextAttribute = Assert.Single(childContent.BoundAttributes);
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name);
Assert.Equal("System.String", contextAttribute.TypeName); Assert.Equal("System.String", contextAttribute.TypeName);
Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation); Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation);
Assert.True(contextAttribute.IsChildContentParameterNameProperty()); Assert.True(contextAttribute.IsChildContentParameterNameProperty());
@ -1245,7 +1245,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.True(a.IsChildContentParameterNameProperty()); Assert.True(a.IsChildContentParameterNameProperty());
}, },
a => a =>
@ -1264,7 +1264,7 @@ namespace Test
// A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name. // A RenderFragment<T> tag helper has a parameter to allow you to set the lambda parameter name.
var contextAttribute = Assert.Single(childContent.BoundAttributes); var contextAttribute = Assert.Single(childContent.BoundAttributes);
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, contextAttribute.Name);
Assert.Equal("System.String", contextAttribute.TypeName); Assert.Equal("System.String", contextAttribute.TypeName);
Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation); Assert.Equal("Specifies the parameter name for the 'ChildContent2' child content expression.", contextAttribute.Documentation);
} }
@ -1321,7 +1321,7 @@ namespace Test
}, },
a => a =>
{ {
Assert.Equal(BlazorMetadata.ChildContent.ParameterAttributeName, a.Name); Assert.Equal(ComponentMetadata.ChildContent.ParameterAttributeName, a.Name);
Assert.True(a.IsChildContentParameterNameProperty()); Assert.True(a.IsChildContentParameterNameProperty());
}, },
a => a =>

Просмотреть файл

@ -51,9 +51,9 @@ namespace Test
// here and then ignoring them. // here and then ignoring them.
Assert.Empty(item.Diagnostics); Assert.Empty(item.Diagnostics);
Assert.False(item.HasErrors); Assert.False(item.HasErrors);
Assert.Equal(BlazorMetadata.EventHandler.TagHelperKind, item.Kind); Assert.Equal(ComponentMetadata.EventHandler.TagHelperKind, item.Kind);
Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]); Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]);
Assert.Equal(BlazorMetadata.EventHandler.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]); Assert.Equal(ComponentMetadata.EventHandler.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(item.IsDefaultKind()); Assert.False(item.IsDefaultKind());
Assert.False(item.KindUsesDefaultTagHelperRuntime()); Assert.False(item.KindUsesDefaultTagHelperRuntime());
@ -89,7 +89,7 @@ namespace Test
// Invariants // Invariants
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.EventHandler.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.EventHandler.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer); Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix); Assert.Null(attribute.IndexerNamePrefix);
@ -99,8 +99,8 @@ namespace Test
Assert.Collection( Assert.Collection(
attribute.Metadata.OrderBy(kvp => kvp.Key), attribute.Metadata.OrderBy(kvp => kvp.Key),
kvp => Assert.Equal(kvp, new KeyValuePair<string, string>(BlazorMetadata.Component.WeaklyTypedKey, bool.TrueString)), kvp => Assert.Equal(kvp, new KeyValuePair<string, string>("Common.PropertyName", "onclick")),
kvp => Assert.Equal(kvp, new KeyValuePair<string, string>("Common.PropertyName", "onclick"))); kvp => Assert.Equal(kvp, new KeyValuePair<string, string>(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString)));
Assert.Equal( Assert.Equal(
"Sets the 'onclick' attribute to the provided string or delegate value. " + "Sets the 'onclick' attribute to the provided string or delegate value. " +

Просмотреть файл

@ -30,9 +30,9 @@ namespace Microsoft.CodeAnalysis.Razor
Assert.Null(item.TagOutputHint); Assert.Null(item.TagOutputHint);
Assert.Empty(item.Diagnostics); Assert.Empty(item.Diagnostics);
Assert.False(item.HasErrors); Assert.False(item.HasErrors);
Assert.Equal(BlazorMetadata.Ref.TagHelperKind, item.Kind); Assert.Equal(ComponentMetadata.Ref.TagHelperKind, item.Kind);
Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]); Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]);
Assert.Equal(BlazorMetadata.Ref.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]); Assert.Equal(ComponentMetadata.Ref.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]);
Assert.False(item.IsDefaultKind()); Assert.False(item.IsDefaultKind());
Assert.False(item.KindUsesDefaultTagHelperRuntime()); Assert.False(item.KindUsesDefaultTagHelperRuntime());
@ -64,7 +64,7 @@ namespace Microsoft.CodeAnalysis.Razor
var attribute = Assert.Single(item.BoundAttributes); var attribute = Assert.Single(item.BoundAttributes);
Assert.Empty(attribute.Diagnostics); Assert.Empty(attribute.Diagnostics);
Assert.False(attribute.HasErrors); Assert.False(attribute.HasErrors);
Assert.Equal(BlazorMetadata.Ref.TagHelperKind, attribute.Kind); Assert.Equal(ComponentMetadata.Ref.TagHelperKind, attribute.Kind);
Assert.False(attribute.IsDefaultKind()); Assert.False(attribute.IsDefaultKind());
Assert.False(attribute.HasIndexer); Assert.False(attribute.HasIndexer);
Assert.Null(attribute.IndexerNamePrefix); Assert.Null(attribute.IndexerNamePrefix);

Просмотреть файл

@ -38,7 +38,7 @@ namespace Microsoft.CodeAnalysis.Razor
HostProject_For_UnknownConfiguration = new HostProject( HostProject_For_UnknownConfiguration = new HostProject(
"/TestPath/SomePath/Test.csproj", "/TestPath/SomePath/Test.csproj",
new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "Blazor-0.1", Array.Empty<RazorExtension>())); new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "Random-0.1", Array.Empty<RazorExtension>()));
Snapshot_For_1_0 = new DefaultProjectSnapshot(ProjectState.Create(Workspace.Services, HostProject_For_1_0, ProjectWorkspaceState)); Snapshot_For_1_0 = new DefaultProjectSnapshot(ProjectState.Create(Workspace.Services, HostProject_For_1_0, ProjectWorkspaceState));
Snapshot_For_1_1 = new DefaultProjectSnapshot(ProjectState.Create(Workspace.Services, HostProject_For_1_1, ProjectWorkspaceState)); Snapshot_For_1_1 = new DefaultProjectSnapshot(ProjectState.Create(Workspace.Services, HostProject_For_1_1, ProjectWorkspaceState));

Просмотреть файл

@ -22,7 +22,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor
HostProject_For_2_0 = new HostProject("Test.csproj", FallbackRazorConfiguration.MVC_2_0); HostProject_For_2_0 = new HostProject("Test.csproj", FallbackRazorConfiguration.MVC_2_0);
HostProject_For_NonSerializableConfiguration = new HostProject( HostProject_For_NonSerializableConfiguration = new HostProject(
"Test.csproj", "Test.csproj",
new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "Blazor-0.1", Array.Empty<RazorExtension>())); new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "Random-0.1", Array.Empty<RazorExtension>()));
CustomFactories = new Lazy<IProjectEngineFactory, ICustomProjectEngineFactoryMetadata>[] CustomFactories = new Lazy<IProjectEngineFactory, ICustomProjectEngineFactoryMetadata>[]
{ {
@ -33,7 +33,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Razor
// We don't really use this factory, we just use it to ensure that the call is going to go out of process. // We don't really use this factory, we just use it to ensure that the call is going to go out of process.
new Lazy<IProjectEngineFactory, ICustomProjectEngineFactoryMetadata>( new Lazy<IProjectEngineFactory, ICustomProjectEngineFactoryMetadata>(
() => new LegacyProjectEngineFactory_2_1(), () => new LegacyProjectEngineFactory_2_1(),
new ExportCustomProjectEngineFactoryAttribute("Blazor-0.1") { SupportsSerialization = false, }), new ExportCustomProjectEngineFactoryAttribute("Random-0.1") { SupportsSerialization = false, }),
}; };
FallbackFactory = new FallbackProjectEngineFactory(); FallbackFactory = new FallbackProjectEngineFactory();