public static CompletionItem Create( string displayText, TextSpan span, Glyph?glyph = null, ImmutableArray <SymbolDisplayPart> description = default(ImmutableArray <SymbolDisplayPart>), string sortText = null, string filterText = null, bool preselect = false, bool showsWarningIcon = false, bool shouldFormatOnCommit = false, bool isArgumentName = false, ImmutableDictionary <string, string> properties = null, ImmutableArray <string> tags = default(ImmutableArray <string>), CompletionItemRules rules = null) { tags = tags.IsDefault ? ImmutableArray <string> .Empty : tags; if (glyph != null) { // put glyph tags first tags = GlyphTags.GetTags(glyph.Value).AddRange(tags); } if (showsWarningIcon) { tags = tags.Add(CompletionTags.Warning); } if (isArgumentName) { tags = tags.Add(CompletionTags.ArgumentName); } properties = properties ?? ImmutableDictionary <string, string> .Empty; if (!description.IsDefault && description.Length > 0) { properties = properties.Add("Description", EncodeDescription(description)); } rules = rules ?? CompletionItemRules.Default; rules = rules.WithPreselect(preselect) .WithFormatOnCommit(shouldFormatOnCommit); return(CompletionItem.Create( displayText: displayText, filterText: filterText, sortText: sortText, span: span, properties: properties, tags: tags, rules: rules)); }
public static CompletionItem Create( string displayText, string displayTextSuffix, CompletionItemRules rules, Glyph?glyph = null, ImmutableArray <SymbolDisplayPart> description = default, string sortText = null, string filterText = null, bool showsWarningIcon = false, ImmutableDictionary <string, string> properties = null, ImmutableArray <string> tags = default, string inlineDescription = null, string displayTextPrefix = null, bool isComplexTextEdit = false ) { tags = tags.NullToEmpty(); if (glyph != null) { // put glyph tags first tags = GlyphTags.GetTags(glyph.Value).AddRange(tags); } if (showsWarningIcon) { tags = tags.Add(WellKnownTags.Warning); } properties ??= ImmutableDictionary <string, string> .Empty; if (!description.IsDefault && description.Length > 0) { properties = properties.Add("Description", EncodeDescription(description)); } return(CompletionItem.Create( displayText: displayText, displayTextSuffix: displayTextSuffix, displayTextPrefix: displayTextPrefix, filterText: filterText, sortText: sortText, properties: properties, tags: tags, rules: rules, inlineDescription: inlineDescription, isComplexTextEdit: isComplexTextEdit )); }
public static CompletionItem Create( string displayText, Glyph?glyph = null, ImmutableArray <SymbolDisplayPart> description = default(ImmutableArray <SymbolDisplayPart>), string sortText = null, string filterText = null, int?matchPriority = null, bool showsWarningIcon = false, bool shouldFormatOnCommit = false, ImmutableDictionary <string, string> properties = null, ImmutableArray <string> tags = default(ImmutableArray <string>), CompletionItemRules rules = null) { tags = tags.NullToEmpty(); if (glyph != null) { // put glyph tags first tags = GlyphTags.GetTags(glyph.Value).AddRange(tags); } if (showsWarningIcon) { tags = tags.Add(CompletionTags.Warning); } properties = properties ?? ImmutableDictionary <string, string> .Empty; if (!description.IsDefault && description.Length > 0) { properties = properties.Add("Description", EncodeDescription(description)); } rules = rules ?? CompletionItemRules.Default; rules = rules.WithMatchPriority(matchPriority.GetValueOrDefault()) .WithFormatOnCommit(shouldFormatOnCommit); return(CompletionItem.Create( displayText: displayText, filterText: filterText, sortText: sortText, properties: properties, tags: tags, rules: rules)); }