public async Task <IEnumerable <ISymbol> > GetRecommendedSymbolsAtPositionAsync(
            Workspace workspace, SemanticModel semanticModel, int position, OptionSet options, CancellationToken cancellationToken)
        {
            var result = await GetRecommendedSymbolsAtPositionWorkerAsync(workspace, semanticModel, position, options, cancellationToken).ConfigureAwait(false);

            var symbols = result.Item1;
            var context = new ShouldIncludeSymbolContext(result.Item2, cancellationToken);

            symbols = symbols.Where(context.ShouldIncludeSymbol);
            return(symbols);
        }
        public async Task<IEnumerable<ISymbol>> GetRecommendedSymbolsAtPositionAsync(
            Workspace workspace, SemanticModel semanticModel, int position, OptionSet options, CancellationToken cancellationToken)
        {
            var result = await GetRecommendedSymbolsAtPositionWorkerAsync(workspace, semanticModel, position, options, cancellationToken).ConfigureAwait(false);

            var symbols = result.Item1;
            var context = new ShouldIncludeSymbolContext(result.Item2, cancellationToken);

            symbols = symbols.Where(context.ShouldIncludeSymbol);
            return symbols;
        }
Exemplo n.º 3
0
        public IEnumerable <ISymbol> GetRecommendedSymbolsAtPosition(
            Workspace workspace, SemanticModel semanticModel, int position, OptionSet options, CancellationToken cancellationToken)
        {
            var result = GetRecommendedSymbolsAtPositionWorker(workspace, semanticModel, position, options, cancellationToken);

            var symbols = result.Item1;
            var context = new ShouldIncludeSymbolContext(result.Item2, cancellationToken);

            symbols = symbols.Where(context.ShouldIncludeSymbol);
            return(symbols);
        }
        public IEnumerable<ISymbol> GetRecommendedSymbolsAtPosition(
            Workspace workspace, SemanticModel semanticModel, int position, OptionSet options, CancellationToken cancellationToken)
        {
            var result = GetRecommendedSymbolsAtPositionWorker(workspace, semanticModel, position, options, cancellationToken);

            var symbols = result.Item1;
            var context = new ShouldIncludeSymbolContext(result.Item2, cancellationToken);

            symbols = symbols.Where(context.ShouldIncludeSymbol);
            return symbols;
        }
        public Task <ImmutableArray <ISymbol> > GetRecommendedSymbolsAtPositionAsync(
            Workspace workspace, SemanticModel semanticModel, int position, OptionSet options, CancellationToken cancellationToken)
        {
            var context = CreateContext(workspace, semanticModel, position, cancellationToken);
            var filterOutOfScopeLocals = options.GetOption(RecommendationOptions.FilterOutOfScopeLocals, semanticModel.Language);
            var symbols = CreateRunner(context, filterOutOfScopeLocals, cancellationToken).GetSymbols();

            var hideAdvancedMembers = options.GetOption(RecommendationOptions.HideAdvancedMembers, semanticModel.Language);

            symbols = symbols.FilterToVisibleAndBrowsableSymbols(hideAdvancedMembers, semanticModel.Compilation);

            var shouldIncludeSymbolContext = new ShouldIncludeSymbolContext(context, cancellationToken);

            symbols = symbols.WhereAsArray(shouldIncludeSymbolContext.ShouldIncludeSymbol);
            return(Task.FromResult(symbols));
        }
Exemplo n.º 6
0
        public RecommendedSymbols GetRecommendedSymbolsAtPosition(
            Workspace workspace,
            SemanticModel semanticModel,
            int position,
            OptionSet options,
            CancellationToken cancellationToken
            )
        {
            var context = CreateContext(workspace, semanticModel, position, cancellationToken);
            var filterOutOfScopeLocals = options.GetOption(
                RecommendationOptions.FilterOutOfScopeLocals,
                semanticModel.Language
                );
            var result = CreateRunner(context, filterOutOfScopeLocals, cancellationToken)
                         .GetRecommendedSymbols();

            var namedSymbols   = result.NamedSymbols;
            var unnamedSymbols = result.UnnamedSymbols;

            var hideAdvancedMembers = options.GetOption(
                RecommendationOptions.HideAdvancedMembers,
                semanticModel.Language
                );

            namedSymbols = namedSymbols.FilterToVisibleAndBrowsableSymbols(
                hideAdvancedMembers,
                semanticModel.Compilation
                );
            unnamedSymbols = unnamedSymbols.FilterToVisibleAndBrowsableSymbols(
                hideAdvancedMembers,
                semanticModel.Compilation
                );

            var shouldIncludeSymbolContext = new ShouldIncludeSymbolContext(
                context,
                cancellationToken
                );

            namedSymbols = namedSymbols.WhereAsArray(
                shouldIncludeSymbolContext.ShouldIncludeSymbol
                );
            unnamedSymbols = unnamedSymbols.WhereAsArray(
                shouldIncludeSymbolContext.ShouldIncludeSymbol
                );

            return(new RecommendedSymbols(namedSymbols, unnamedSymbols));
        }
        public RecommendedSymbols GetRecommendedSymbolsAtPosition(Document document, SemanticModel semanticModel, int position, RecommendationServiceOptions options, CancellationToken cancellationToken)
        {
            var context = CreateContext(document, semanticModel, position, cancellationToken);
            var result  = CreateRunner(context, options.FilterOutOfScopeLocals, cancellationToken).GetRecommendedSymbols();

            var namedSymbols   = result.NamedSymbols;
            var unnamedSymbols = result.UnnamedSymbols;

            namedSymbols   = namedSymbols.FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation);
            unnamedSymbols = unnamedSymbols.FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation);

            var shouldIncludeSymbolContext = new ShouldIncludeSymbolContext(context, cancellationToken);

            namedSymbols   = namedSymbols.WhereAsArray(shouldIncludeSymbolContext.ShouldIncludeSymbol);
            unnamedSymbols = unnamedSymbols.WhereAsArray(shouldIncludeSymbolContext.ShouldIncludeSymbol);

            return(new RecommendedSymbols(namedSymbols, unnamedSymbols));
        }
Exemplo n.º 8
0
        public RecommendedSymbols GetRecommendedSymbolsInContext(SyntaxContext syntaxContext, RecommendationServiceOptions options, CancellationToken cancellationToken)
        {
            var semanticModel = syntaxContext.SemanticModel;
            var result        = CreateRunner((TSyntaxContext)syntaxContext, options.FilterOutOfScopeLocals, cancellationToken).GetRecommendedSymbols();

            var namedSymbols   = result.NamedSymbols;
            var unnamedSymbols = result.UnnamedSymbols;

            namedSymbols   = namedSymbols.FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation);
            unnamedSymbols = unnamedSymbols.FilterToVisibleAndBrowsableSymbols(options.HideAdvancedMembers, semanticModel.Compilation);

            var shouldIncludeSymbolContext = new ShouldIncludeSymbolContext(syntaxContext, cancellationToken);

            namedSymbols   = namedSymbols.WhereAsArray(shouldIncludeSymbolContext.ShouldIncludeSymbol);
            unnamedSymbols = unnamedSymbols.WhereAsArray(shouldIncludeSymbolContext.ShouldIncludeSymbol);

            return(new RecommendedSymbols(namedSymbols, unnamedSymbols));
        }