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.

Scanning all files in the rootUri makes the server unusable for directories with many files #471

Open
@keyboardDrummer

Description

@keyboardDrummer

I have a package directory that contains about 200k files, many of which are generated and are not required for providing Typescript language tooling. The glob npm package used by this LSP server takes ~45seconds to scan all files in the package directory. During this time the LSP server will not respond to requests, making it unusable.

I've compared using the 'glob' package to using the 'find' package. The latter completes in about 1 second, which would be sufficient to make the LSP server usable. However, the find package finds slightly different files than glob. It seems to include also files in 'hidden' directories such as .git, but then skips files in symlinked directories.

Lastly, running find -type f | wc -l in my package directory completes instantly.

I think the root cause of this issue is that the LSP server aggressively scans all files in the rootUri. This is also a problem when requiring files from outside the rootUri directory. I see that the LanguageServiceHost interface that you need to implement for the Typescript compiler contains a synchronous readFile method. Is that why you preload all the existing files? Can you not just synchronously read the file at that time?

Have you looked at what tsc does? It finishes running on this package in a few seconds. Also it allows requiring packages outside of the tsconfig.json folder.

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