public static CompletionItem Create( string name, int arity, string containingNamespace, Glyph glyph, string genericTypeSuffix, CompletionItemFlags flags, (string methodSymbolKey, string receiverTypeSymbolKey, int overloadCount)?extensionMethodData,
public static CompletionItem CreateAttributeItemWithoutSuffix(CompletionItem attributeItem, string attributeNameWithoutSuffix, CompletionItemFlags flags) { Debug.Assert(!attributeItem.Properties.ContainsKey(AttributeFullName)); // Remember the full type name so we can get the symbol when description is displayed. var newProperties = attributeItem.Properties.Add(AttributeFullName, attributeItem.DisplayText); var sortTextBuilder = PooledStringBuilder.GetInstance(); sortTextBuilder.Builder.AppendFormat(SortTextFormat, attributeNameWithoutSuffix, attributeItem.InlineDescription); var item = CompletionItem.Create( displayText: attributeNameWithoutSuffix, sortText: sortTextBuilder.ToStringAndFree(), properties: newProperties, tags: attributeItem.Tags, rules: attributeItem.Rules, displayTextPrefix: attributeItem.DisplayTextPrefix, displayTextSuffix: attributeItem.DisplayTextSuffix, inlineDescription: attributeItem.InlineDescription); item.Flags = flags; return(item); }
public static bool IsExpanded(this CompletionItemFlags flags) => (flags & CompletionItemFlags.Expanded) != 0;
public static CompletionItem Create(string name, int arity, string containingNamespace, Glyph glyph, string genericTypeSuffix, CompletionItemFlags flags, string?symbolKeyData) { ImmutableDictionary <string, string>?properties = null; if (symbolKeyData != null || arity > 0) { var builder = PooledDictionary <string, string> .GetInstance(); if (symbolKeyData != null) { builder.Add(SymbolKeyData, symbolKeyData); } else { // We don't need arity to recover symbol if we already have SymbolKeyData or it's 0. // (but it still needed below to decide whether to show generic suffix) builder.Add(TypeAritySuffixName, AbstractDeclaredSymbolInfoFactoryService.GetMetadataAritySuffix(arity)); } properties = builder.ToImmutableDictionaryAndFree(); } // Use "<display name> <namespace>" as sort text. The space before namespace makes items with identical display name // but from different namespace all show up in the list, it also makes sure item with shorter name shows first, // e.g. 'SomeType` before 'SomeTypeWithLongerName'. var sortTextBuilder = PooledStringBuilder.GetInstance(); sortTextBuilder.Builder.AppendFormat(SortTextFormat, name, containingNamespace); var item = CompletionItem.Create( displayText: name, sortText: sortTextBuilder.ToStringAndFree(), properties: properties, tags: GlyphTags.GetTags(glyph), rules: CompletionItemRules.Default, displayTextPrefix: null, displayTextSuffix: arity == 0 ? string.Empty : genericTypeSuffix, inlineDescription: containingNamespace); item.Flags = flags; return(item); }
public static bool IsCached(this CompletionItemFlags flags) => (flags & CompletionItemFlags.Cached) != 0;