| File: Completion\Providers\XmlDocCommentCompletionItem.cs | Web Access |
| Project: src\roslyn\src\Features\Core\Portable\Microsoft.CodeAnalysis.Features.csproj (Microsoft.CodeAnalysis.Features) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Generic; namespace Microsoft.CodeAnalysis.Completion.Providers; internal static class XmlDocCommentCompletionItem { private const string BeforeCaretText = nameof(BeforeCaretText); private const string AfterCaretText = nameof(AfterCaretText); public static CompletionItem Create(string displayText, string beforeCaretText, string afterCaretText, CompletionItemRules rules) { // Set isComplexTextEdit to be always true for simplicity, even // though we don't always need to make change outside the default // completion list Span. // See AbstractDocCommentCompletionProvider.GetChangeAsync for how // the actual Span is calculated. return CommonCompletionItem.Create( displayText: displayText, displayTextSuffix: "", glyph: Glyph.Keyword, properties: [ KeyValuePair.Create(BeforeCaretText, beforeCaretText), KeyValuePair.Create(AfterCaretText, afterCaretText)], rules: rules, isComplexTextEdit: true); } public static string GetBeforeCaretText(CompletionItem item) => item.GetProperty(BeforeCaretText); public static string? GetAfterCaretText(CompletionItem item) => item.GetProperty(AfterCaretText); }