Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Symbols limiting for workspace/symbol works incorrectly #491

Closed
@andrewnester

Description

@andrewnester

Overview

Currently when reading workspace symbols in config (see _getSymbolsInConfig method), amount of symbols limited to 100.

Observable.from(config.getService().getNavigateToItems(query, 100, undefined, false))

Also the results is filtered latter using check item.fileName.includes('/node_modules/')
item => !isTypeScriptLibrary(item.fileName) && !item.fileName.includes('/node_modules/')

Problem

Assume you type character m to get symbols for it.
It will return 100 symbols but 99 of them could be from any of node_modules packages.
Filtering out leaves us with 1 symbol returned.

After that you're narrowing down your search query to my.
It will return again 100 symbols but in this case as you're looking for symbols in your project and already more specific in your query it could return for example only 60 results from node_modules and the rest 40 from your package.
Filtering out leaves us with 40 symbol returned.

So as a result it causes the confusion as when I have broad search term it leaves me with lower amount of results comparing with more specific search term.

Proposed Solution

Here is the PR for the proposed solution: #491

Proposed solution is not to include maxResultCount into to getNavigateToItems to TS server.
Results are filtered later in workspaceSymbol.

Performance

Current implementation of getNavigateToItems in TS server (https://github.com/Microsoft/TypeScript/blob/64555aa6a94879f8fee7c0718e688a09cc8d4073/src/services/navigateTo.ts#L11) anyway goes from all symbols in source files and slicing array symbols later.

The only changes is that createNavigateToItem function would be on larger amount of items.
https://github.com/Microsoft/TypeScript/blob/64555aa6a94879f8fee7c0718e688a09cc8d4073/src/services/navigateTo.ts#L30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions