Skip to content

Commit 7d70259

Browse files
committed
Added extension order attribute
1 parent 66ac856 commit 7d70259

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Source/ExtendedDocCommentsProvider.Shared/CSharpXmlDocCommentsCompletionProvider.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ namespace EWSoftware.CompletionProviders
4242
/// tools.
4343
/// </summary>
4444
/// <remarks>The core logic used to determine which completion items to return based on the current context
45-
/// is based largely on the Roslyn XML comments completion providers.</remarks>
45+
/// is based largely on the Roslyn XML comments completion providers. This runs after the built in C#
46+
/// comments provider so that our extensions override the ones provided by it such as <c>code</c>. This
47+
/// allows our before/after text options to work properly. The built in provider is internal so we need to
48+
/// specify it's name as a literal string in the attribute.</remarks>
4649
[ExportCompletionProvider(nameof(CSharpXmlDocCommentsCompletionProvider), LanguageNames.CSharp)]
50+
[ExtensionOrder(After = "XmlDocCommentCompletionProvider")]
4751
internal sealed class CSharpXmlDocCommentsCompletionProvider : CompletionProvider
4852
{
4953
#region CompletionProvider abstract method implementation
@@ -374,6 +378,7 @@ private static bool IsAttributeNameContext(SyntaxToken token, int position, out
374378
(elementName, attributes) = GetElementNameAndAttributes(token.Parent.Parent);
375379
}
376380
else
381+
{
377382
if(token.Parent.IsKind(SyntaxKind.XmlCrefAttribute) || token.Parent.IsKind(SyntaxKind.XmlNameAttribute) ||
378383
token.Parent.IsKind(SyntaxKind.XmlTextAttribute))
379384
{
@@ -386,6 +391,7 @@ private static bool IsAttributeNameContext(SyntaxToken token, int position, out
386391
if(token == attributeSyntax.EndQuoteToken)
387392
(elementName, attributes) = GetElementNameAndAttributes(attributeSyntax.Parent);
388393
}
394+
}
389395

390396
if(attributes != null)
391397
attributeNames = new HashSet<string>(attributes.Select(attr => attr.Name.LocalName.ValueText));

0 commit comments

Comments
 (0)