Added ParentIsTagHelper property to AttributeCompletionContext

This commit is contained in:
Ajay Bhargav Baaskaran 2017-08-25 16:17:47 -07:00
parent 471722eba1
commit 1b5bd4afac
4 changed files with 8 additions and 3 deletions

View File

@ -16,6 +16,7 @@ namespace Microsoft.CodeAnalysis.Razor
string currentAttributeName,
IEnumerable<KeyValuePair<string, string>> attributes,
string currentParentTagName,
bool currentParentIsTagHelper,
Func<string, bool> inHTMLSchema)
{
if (documentContext == null)
@ -49,6 +50,7 @@ namespace Microsoft.CodeAnalysis.Razor
CurrentAttributeName = currentAttributeName;
Attributes = attributes;
CurrentParentTagName = currentParentTagName;
CurrentParentIsTagHelper = currentParentIsTagHelper;
InHTMLSchema = inHTMLSchema;
}
@ -64,6 +66,8 @@ namespace Microsoft.CodeAnalysis.Razor
public string CurrentParentTagName { get; }
public bool CurrentParentIsTagHelper { get; }
public Func<string, bool> InHTMLSchema { get; }
}
}

View File

@ -60,7 +60,7 @@ namespace Microsoft.CodeAnalysis.Razor
completionContext.CurrentTagName,
completionContext.Attributes,
completionContext.CurrentParentTagName,
parentIsTagHelper: false);
completionContext.CurrentParentIsTagHelper);
var applicableDescriptors = applicableTagHelperBinding?.Descriptors ?? Enumerable.Empty<TagHelperDescriptor>();
var unprefixedTagName = completionContext.CurrentTagName.Substring(prefix.Length);

View File

@ -1,9 +1,9 @@
// 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 Microsoft.AspNetCore.Razor.Language;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Razor.Language;
using Xunit;
namespace Microsoft.CodeAnalysis.Razor
@ -1062,6 +1062,7 @@ namespace Microsoft.CodeAnalysis.Razor
currentAttributeName,
attributes,
currentParentTagName: "body",
currentParentIsTagHelper: false,
inHTMLSchema: (tag) => tag == "strong" || tag == "b" || tag == "bold" || tag == "li" || tag == "div");
return completionContext;

View File

@ -1,9 +1,9 @@
// 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 Microsoft.AspNetCore.Razor.Language;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Razor.Language;
using Xunit;
namespace Microsoft.CodeAnalysis.Razor