Пример #1
0
        public static CompletionItem AddSymbolInfo(IReadOnlyList <ISymbol> symbols, CompletionItem item)
        {
            var symbol    = symbols[0];
            var isGeneric = symbol.GetArity() > 0;

            item = item
                   .AddProperty("SymbolKind", ((int)symbol.Kind).ToString())
                   .AddProperty("SymbolName", symbol.Name);

            return(isGeneric ? item.AddProperty("IsGeneric", isGeneric.ToString()) : item);
        }
Пример #2
0
        public static CompletionItem AddSymbolNameAndKind(IReadOnlyList <ISymbol> symbols, CompletionItem item)
        {
            var symbol = symbols[0];

            return(item.AddProperty("SymbolKind", ((int)symbol.Kind).ToString())
                   .AddProperty("SymbolName", symbol.Name));
        }
Пример #3
0
 private static CompletionItem WithSupportedPlatforms(CompletionItem completionItem, SupportedPlatformData supportedPlatforms)
 {
     if (supportedPlatforms != null)
     {
         return(completionItem
                .AddProperty("InvalidProjects", string.Join(";", supportedPlatforms.InvalidProjects.Select(id => id.Id)))
                .AddProperty("CandidateProjects", string.Join(";", supportedPlatforms.CandidateProjects.Select(id => id.Id))));
     }
     else
     {
         return(completionItem);
     }
 }
Пример #4
0
        public static async Task <CompletionDescription> GetUnimportedDescriptionAsync(Document document, CompletionItem item, ISymbol symbol, CancellationToken cancellationToken)
        {
            string symbolKey = SymbolCompletionItem.EncodeSymbol(symbol);

            item = item.AddProperty(CompletionItemProperties.Symbols, symbolKey);

            var description = await SymbolCompletionItem.GetDescriptionAsync(item, document, cancellationToken).ConfigureAwait(false);

            // Adding 'unimported' text to beginning
            var unimportedTextParts = ImmutableArray <TaggedText> .Empty
                                      .Add(new TaggedText(TextTags.Text, "(unimported)"))
                                      .Add(new TaggedText(TextTags.Space, " "))
                                      .AddRange(description.TaggedParts);

            return(description.WithTaggedParts(unimportedTextParts));
        }
Пример #5
0
 private static CompletionItem WithSupportedPlatforms(CompletionItem completionItem, SupportedPlatformData supportedPlatforms)
 {
     if (supportedPlatforms != null)
     {
         return completionItem
             .AddProperty("InvalidProjects", string.Join(";", supportedPlatforms.InvalidProjects.Select(id => id.Id)))
             .AddProperty("CandidateProjects", string.Join(";", supportedPlatforms.CandidateProjects.Select(id => id.Id)));
     }
     else
     {
         return completionItem;
     }
 }
Пример #6
0
 public static CompletionItem AddSymbolEncoding(IReadOnlyList <ISymbol> symbols, CompletionItem item)
 {
     return(item.AddProperty("Symbols", EncodeSymbols(symbols)));
 }
Пример #7
0
 public static CompletionItem AddShouldProvideParenthesisCompletion(CompletionItem item)
 => item.AddProperty("ShouldProvideParenthesisCompletion", true.ToString());
Пример #8
0
        private CompletionItem FixItem(CompletionItem item)
        {
            // remember provider so we can find it again later
            item = item.AddProperty("Provider", this.Provider.Name);

            item.Span = this.CompletionListSpan;

            return item;
        }
Пример #9
0
 public static CompletionItem AddSymbolEncoding(ISymbol symbol, CompletionItem item)
 {
     return(item.AddProperty("Symbols", EncodeSymbol(symbol)));
 }
Пример #10
0
        private CompletionItem FixItem(CompletionItem item)
        {
            // remember provider so we can find it again later
            item = item.AddProperty("Provider", this.Provider.Name);

            // assign the default span if not set by provider
            if (item.Span == default(TextSpan) && this.DefaultItemSpan != default(TextSpan))
            {
                item = item.WithSpan(this.DefaultItemSpan);
            }

            return item;
        }