public IReadOnlyCollection<RCompletion> GetEntries(RCompletionContext context) {
            List<RCompletion> completions = new List<RCompletion>();
            var infoSource = _snippetInformationSource?.InformationSource;

            // TODO: this is different in the console window where 
            // packages may have been loaded from the command line. 
            // We need an extensibility point here.
            IEnumerable<IPackageInfo> packages = GetPackages(context);

            // Get list of functions in the package
            foreach (IPackageInfo pkg in packages) {
                Debug.Assert(pkg != null);

                IEnumerable<INamedItemInfo> functions = pkg.Functions;
                if (functions != null) {
                    foreach (INamedItemInfo function in functions) {
                        bool isSnippet = false;
                        // Snippets are suppressed if user typed namespace
                        if (!context.IsInNameSpace() && infoSource != null) {
                            isSnippet = infoSource.IsSnippet(function.Name);
                        }
                        if (!isSnippet) {
                            ImageSource glyph = function.ItemType == NamedItemType.Constant ? _constantGlyph : _functionGlyph;
                            var completion = new RFunctionCompletion(function.Name, CompletionUtilities.BacktickName(function.Name), function.Description, glyph, _functionIndex, context.Session);
                            completions.Add(completion);
                        }
                    }
                }
            }

            return completions;
        }
Exemple #2
0
        public IReadOnlyCollection <RCompletion> GetEntries(RCompletionContext context)
        {
            List <RCompletion> completions   = new List <RCompletion>();
            ImageSource        functionGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic, _shell);
            ImageSource        constantGlyph = GlyphService.GetGlyph(StandardGlyphGroup.GlyphGroupConstant, StandardGlyphItem.GlyphItemPublic, _shell);
            ImageSource        snippetGlyph  = GlyphService.GetGlyph(StandardGlyphGroup.GlyphCSharpExpansion, StandardGlyphItem.GlyphItemPublic, _shell);
            var infoSource = _snippetInformationSource?.InformationSource;

            // TODO: this is different in the console window where
            // packages may have been loaded from the command line.
            // We need an extensibility point here.
            IEnumerable <IPackageInfo> packages = GetPackages(context);

            // Get list of functions in the package
            foreach (IPackageInfo pkg in packages)
            {
                Debug.Assert(pkg != null);

                IEnumerable <INamedItemInfo> functions = pkg.Functions;
                if (functions != null)
                {
                    foreach (INamedItemInfo function in functions)
                    {
                        bool isSnippet = false;
                        // Snippets are suppressed if user typed namespace
                        if (!context.IsInNameSpace() && infoSource != null)
                        {
                            isSnippet = infoSource.IsSnippet(function.Name);
                        }
                        if (!isSnippet)
                        {
                            ImageSource glyph      = function.ItemType == NamedItemType.Constant ? constantGlyph : functionGlyph;
                            var         completion = new RFunctionCompletion(function.Name, CompletionUtilities.BacktickName(function.Name), function.Description, glyph, _functionIndex, context.Session);
                            completions.Add(completion);
                        }
                    }
                }
            }

            return(completions);
        }