public IReadOnlyCollection <RCompletion> GetEntries(RCompletionContext context) { List <RCompletion> completions = new List <RCompletion>(); ImageSource functionGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic); ImageSource variableGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic); string variableName = context.Session.TextView.GetVariableNameBeforeCaret(); VariablesProvider.Initialize(); int memberCount = VariablesProvider.GetMemberCount(variableName); IReadOnlyCollection <INamedItemInfo> members = VariablesProvider.GetMembers(variableName, 200); // Get list of functions in the package foreach (var v in members) { Debug.Assert(v != null); if (v.Name.Length > 0 && v.Name[0] != '[') { ImageSource glyph = v.ItemType == NamedItemType.Variable ? variableGlyph : functionGlyph; var completion = new RCompletion(v.Name, CompletionUtilities.BacktickName(v.Name), v.Description, glyph); completions.Add(completion); } } return(completions); }
public IReadOnlyCollection <RCompletion> GetEntries(RCompletionContext context) { List <RCompletion> completions = new List <RCompletion>(); ImageSource functionGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic); ImageSource variableGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic); Selector selector = Selector.Dollar; string variableName = RCompletionContext.GetVariableName(context.Session.TextView, context.TextBuffer.CurrentSnapshot); if (variableName.IndexOfAny(new char[] { '$', '@' }) < 0) { variableName = string.Empty; selector = Selector.None; } else if (variableName.EndsWith("@", StringComparison.Ordinal)) { selector = Selector.At; } VariablesProvider.Initialize(); int memberCount = VariablesProvider.GetMemberCount(variableName); IReadOnlyCollection <INamedItemInfo> members = VariablesProvider.GetMembers(variableName, 200); var filteredList = FilterList(members, selector); // Get list of functions in the package foreach (INamedItemInfo v in filteredList) { Debug.Assert(v != null); if (v.Name.Length > 0 && v.Name[0] != '[') { ImageSource glyph = v.ItemType == NamedItemType.Variable ? variableGlyph : functionGlyph; var completion = new RCompletion(v.Name, CompletionUtilities.BacktickName(v.Name), v.Description, glyph); completions.Add(completion); } } return(completions); }