public IReadOnlyCollection <RCompletion> GetEntries(RCompletionContext context)
        {
            List <RCompletion> completions   = new List <RCompletion>();
            ImageSource        functionGlyph = _glyphService.GetGlyphThreadSafe(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic);
            ImageSource        variableGlyph = _glyphService.GetGlyphThreadSafe(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic);

            var start = DateTime.Now;

            _variablesProvider.Initialize();
            var names = GetFieldProvidingVariableNames(context);

            foreach (var variableName in names)
            {
                int memberCount = _variablesProvider.GetMemberCount(variableName);
                IReadOnlyCollection <INamedItemInfo> members = _variablesProvider.GetMembers(variableName, 200);

                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);
                    }
                }
            }
            Debug.WriteLine("Variable members fetch: " + (DateTime.Now - start).TotalMilliseconds);
            return(completions);
        }
Exemplo n.º 2
0
        public IReadOnlyCollection <RCompletion> GetEntries(RCompletionContext context)
        {
            List <RCompletion> completions   = new List <RCompletion>();
            ImageSource        functionGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic, _shell);
            ImageSource        variableGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic, _shell);

            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);
        }