Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable document symbol request for files over 1MB #3430

Merged
merged 2 commits into from
Dec 11, 2023

Conversation

yepitschunked
Copy link
Contributor

@yepitschunked yepitschunked commented Oct 3, 2023

I ran into a problem similar to #2985 with a massive schema graphql file (~2MB file). The performance was fine when the schema is not opened (e.g, hovering for type definintions and autocomplete), but the LSP was stuck at 100% as soon as I opened the schema. It looks like the language server was stuck in getOutline, which is called by textDocument/documentSymbol. I'm not sure why this is so slow, but I generally don't care about the outline in such a large file anyway, so it seems OK to disable that feature.

This PR adds a configuration option largeFileThreshold which defaults to 1000000. At the moment, it just disables document symbols computation, but there might be other expensive operations we could disable with this option as well.

I also noticed there was no logging for this LSP message, so I added it.

@changeset-bot
Copy link

changeset-bot bot commented Oct 3, 2023

⚠️ No Changeset found

Latest commit: 367a247

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 3, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Dec 11, 2023

Codecov Report

Merging #3430 (367a247) into main (2348641) will increase coverage by 0.06%.
Report is 37 commits behind head on main.
The diff coverage is 75.23%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3430      +/-   ##
==========================================
+ Coverage   55.75%   55.81%   +0.06%     
==========================================
  Files         110      110              
  Lines        5243     5271      +28     
  Branches     1426     1437      +11     
==========================================
+ Hits         2923     2942      +19     
- Misses       1897     1901       +4     
- Partials      423      428       +5     
Files Coverage Δ
packages/graphiql-react/src/editor/context.tsx 73.39% <100.00%> (ø)
...raphql-language-service-server/src/GraphQLCache.ts 50.88% <50.00%> (ø)
...nguage-service/src/utils/getVariablesJSONSchema.ts 94.59% <98.38%> (+0.71%) ⬆️
packages/graphiql/src/components/GraphiQL.tsx 68.96% <0.00%> (-0.97%) ⬇️
...ql-language-service-server/src/MessageProcessor.ts 45.83% <55.00%> (-0.40%) ⬇️
packages/graphiql-react/src/editor/hooks.ts 40.15% <23.52%> (+1.56%) ⬆️

Copy link
Member

@acao acao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! thank you @yepitschunked !

@acao acao merged commit fc1ea4c into graphql:main Dec 11, 2023
14 checks passed
@acao
Copy link
Member

acao commented Dec 11, 2023

Oops, overlooked the missing changeset comment. I will have to fix this for the release to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants