Added ParentIsTagHelper property to AttributeCompletionContext
This commit is contained in:
parent
471722eba1
commit
1b5bd4afac
|
|
@ -16,6 +16,7 @@ namespace Microsoft.CodeAnalysis.Razor
|
||||||
string currentAttributeName,
|
string currentAttributeName,
|
||||||
IEnumerable<KeyValuePair<string, string>> attributes,
|
IEnumerable<KeyValuePair<string, string>> attributes,
|
||||||
string currentParentTagName,
|
string currentParentTagName,
|
||||||
|
bool currentParentIsTagHelper,
|
||||||
Func<string, bool> inHTMLSchema)
|
Func<string, bool> inHTMLSchema)
|
||||||
{
|
{
|
||||||
if (documentContext == null)
|
if (documentContext == null)
|
||||||
|
|
@ -49,6 +50,7 @@ namespace Microsoft.CodeAnalysis.Razor
|
||||||
CurrentAttributeName = currentAttributeName;
|
CurrentAttributeName = currentAttributeName;
|
||||||
Attributes = attributes;
|
Attributes = attributes;
|
||||||
CurrentParentTagName = currentParentTagName;
|
CurrentParentTagName = currentParentTagName;
|
||||||
|
CurrentParentIsTagHelper = currentParentIsTagHelper;
|
||||||
InHTMLSchema = inHTMLSchema;
|
InHTMLSchema = inHTMLSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,6 +66,8 @@ namespace Microsoft.CodeAnalysis.Razor
|
||||||
|
|
||||||
public string CurrentParentTagName { get; }
|
public string CurrentParentTagName { get; }
|
||||||
|
|
||||||
|
public bool CurrentParentIsTagHelper { get; }
|
||||||
|
|
||||||
public Func<string, bool> InHTMLSchema { get; }
|
public Func<string, bool> InHTMLSchema { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -60,7 +60,7 @@ namespace Microsoft.CodeAnalysis.Razor
|
||||||
completionContext.CurrentTagName,
|
completionContext.CurrentTagName,
|
||||||
completionContext.Attributes,
|
completionContext.Attributes,
|
||||||
completionContext.CurrentParentTagName,
|
completionContext.CurrentParentTagName,
|
||||||
parentIsTagHelper: false);
|
completionContext.CurrentParentIsTagHelper);
|
||||||
|
|
||||||
var applicableDescriptors = applicableTagHelperBinding?.Descriptors ?? Enumerable.Empty<TagHelperDescriptor>();
|
var applicableDescriptors = applicableTagHelperBinding?.Descriptors ?? Enumerable.Empty<TagHelperDescriptor>();
|
||||||
var unprefixedTagName = completionContext.CurrentTagName.Substring(prefix.Length);
|
var unprefixedTagName = completionContext.CurrentTagName.Substring(prefix.Length);
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Razor.Language;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.CodeAnalysis.Razor
|
namespace Microsoft.CodeAnalysis.Razor
|
||||||
|
|
@ -1062,6 +1062,7 @@ namespace Microsoft.CodeAnalysis.Razor
|
||||||
currentAttributeName,
|
currentAttributeName,
|
||||||
attributes,
|
attributes,
|
||||||
currentParentTagName: "body",
|
currentParentTagName: "body",
|
||||||
|
currentParentIsTagHelper: false,
|
||||||
inHTMLSchema: (tag) => tag == "strong" || tag == "b" || tag == "bold" || tag == "li" || tag == "div");
|
inHTMLSchema: (tag) => tag == "strong" || tag == "b" || tag == "bold" || tag == "li" || tag == "div");
|
||||||
|
|
||||||
return completionContext;
|
return completionContext;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.AspNetCore.Razor.Language;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.CodeAnalysis.Razor
|
namespace Microsoft.CodeAnalysis.Razor
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue