Exemplo n.º 1
0
        private CompletionItem SetIcon(CompletionItem item)
        {
            PascalCasedSerializableImageElement?icon = null;

            if (item.IsTagHelperElementCompletion() || item.IsTagHelperAttributeCompletion())
            {
                icon = new PascalCasedSerializableImageElement(new PascalCasedSerializableImageId(ImageCatalogGuid, XMLAttributeId), automationName: null);
            }
            else if (item.TryGetRazorCompletionKind(out var kind) &&
                     (kind == RazorCompletionItemKind.DirectiveAttribute ||
                      kind == RazorCompletionItemKind.DirectiveAttributeParameter ||
                      kind == RazorCompletionItemKind.MarkupTransition))
            {
                icon = new PascalCasedSerializableImageElement(new PascalCasedSerializableImageId(ImageCatalogGuid, XMLAttributeId), automationName: null);
            }

            if (!icon.HasValue)
            {
                return(item);
            }

            return(new VSLspCompletionItem()
            {
                Label = item.Label,
                Kind = item.Kind,
                Detail = item.Detail,
                Documentation = item.Documentation,
                Preselect = item.Preselect,
                SortText = item.SortText,
                FilterText = item.FilterText,
                InsertText = item.InsertText,
                InsertTextFormat = item.InsertTextFormat,
                TextEdit = item.TextEdit,
                AdditionalTextEdits = item.AdditionalTextEdits,
                CommitCharacters = item.CommitCharacters,
                Command = item.Command,
                Data = item.Data,
                Icon = icon
            });
        }
        static VSLspCompletionItemIcons()
        {
            var imageId = new PascalCasedSerializableImageId(ImageCatalogGuid, XMLAttributeId);

            TagHelper = new PascalCasedSerializableImageElement(imageId);
        }