[lsp-server] 🐞 documents scan does not skip node_modules, slow startup in monorepos
Maintainers usually reply within 1 day
@shubhamrai9122-creator is already working on this.
Since Oct 10, 2026.
- #4622 by @shubhamrai9122-creator — open
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- graphql, typescript
- Domain
- devtools, performance
Research direction
Start at _cacheDocumentFilesforProject, where startup pre-caches each project's documents, and inspect how project.loadDocuments receives the project's exclude values. Verify that the completed behavior skips node_modules by default while preserving explicit exclusions, then compare cache initialization behavior for the reproduction configuration.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
At startup the server pre-caches every project's documents via project.getDocuments(). graphql-tools does not ignore node_modules by default, so a root-level glob such as documents: "**/*.api.gql" walks the whole node_modules tree (in a pnpm monorepo, all package node_modules too), once per project.
Measured in a pnpm monorepo with three projects (warm FS cache; the same 32/13/7 files are found in every case):
exclude |
glob time |
|---|---|
| none | ~1.2 s per project |
**/node_modules/** |
263 ms for all three |
Cold, the first GraphQL Language Server caches initialized arrived ~15 s after initialize. Hover, completion and go-to-definition all return nothing until then.
Expected Behavior
node_modules is skipped when loading documents unless the user explicitly includes it. Documents inside node_modules are almost never wanted.
Steps To Reproduce
- Monorepo with a large
node_modules. graphql.config.jswithdocuments: "**/*.graphql"and noexclude.- Restart the LSP and compare the time between
initializeandcaches initializedwith and withoutexclude: "**/node_modules/**".
Environment
- LSP Server Version: 2.15.0 (
main@ bc13647b) - OS: macOS
- LSP Client: vscode-graphql 0.13.x
- LSP Install Source: vscode marketplace
Anything else?
Workaround: exclude: ["**/node_modules/**"] on each project (graphql-config passes exclude as the glob ignore list). Adding the default in _cacheDocumentFilesforProject (e.g. project.loadDocuments(project.documents, { ignore: [...asArray(project.exclude ?? []), '**/node_modules/**'] })) would fix it for everyone. A negated !**/node_modules/** inside documents is not a good workaround: it makes graphql-config's match() claim every file outside node_modules.
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.9k
- Avg merge
- 14h 1m
- Merged PRs (30d)
- 81
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from graphql/graphiql
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
[graphiql] Variables editor flags a non-null variable with a default value as missingPossibly taken @khangb2306668 claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
graphql/graphiql#4762 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
All issues in graphql/graphiql
Similar issues
-
Add "append" and "prepend" slots for vue-vuetify extended renderersPossibly taken @simeyc claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eclipsesource/jsonforms#2668 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
README の通知条件を実際の判定処理に合わせるPossibly taken @unhappychoice claimed this today. Openfactory:in-progress priority:medium
Difficulty 1/5 Under an hour Newbie friendliness 90/100
unhappychoice/oss-issue-opener#395 · 1 comment ·
Maintainers usually reply within 1 day
-
bug Website
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
OWASP/OWASP-Hunting#88 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day