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

prevent display of "unexpected EOF" parser errors in diagnostics #2385

Merged
merged 2 commits into from
May 2, 2022

Conversation

acao
Copy link
Member

@acao acao commented May 1, 2022

Current Behavior:

The lsp server shows useless validation errors for empty graphql strings

Expected Behavior:

Ignore newlines and whitespace

Details:

the last release eliminated parse errors that would actually crash the server - these were my mistake, oops!

this fixes another annoying, non-useful parse error that is often seen when authoring a new operation

this should work in most cases, except for cases where there are only comments and no actual graphql types, but it's hard to come up with an efficient pass. this takes care of this bug, when authoring graphql and your cursor is here:

gql`|`

or with newlines:

gql`
|
`

or with whitespace & newlines:

gql`
  |
`

or something as short as:

typ

where op validation doesn't need to kick in yet.

@changeset-bot
Copy link

changeset-bot bot commented May 1, 2022

🦋 Changeset detected

Latest commit: b4de923

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
graphql-language-service-server Patch

Not sure what this means? Click here to learn what changesets are.

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

@acao acao changed the title prevent display of "unexpected EOF" parser errors prevent display of "unexpected EOF" parser errors in diagnostics May 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2022

The latest changes of this PR are not available as canary, since there are no linked changesets for this PR.

@codecov
Copy link

codecov bot commented May 1, 2022

Codecov Report

Merging #2385 (b4de923) into main (2d91916) will decrease coverage by 0.92%.
The diff coverage is 74.04%.

@@            Coverage Diff             @@
##             main    #2385      +/-   ##
==========================================
- Coverage   65.70%   64.78%   -0.93%     
==========================================
  Files          85       81       -4     
  Lines        5106     5330     +224     
  Branches     1631     1723      +92     
==========================================
+ Hits         3355     3453      +98     
- Misses       1747     1873     +126     
  Partials        4        4              
Impacted Files Coverage Δ
packages/codemirror-graphql/src/hint.ts 94.73% <ø> (ø)
packages/codemirror-graphql/src/lint.ts 100.00% <ø> (ø)
packages/codemirror-graphql/src/results/mode.ts 47.05% <ø> (ø)
...kages/codemirror-graphql/src/utils/forEachState.ts 100.00% <ø> (ø)
packages/codemirror-graphql/src/utils/hintList.ts 95.65% <ø> (ø)
...ackages/codemirror-graphql/src/utils/info-addon.ts 1.02% <ø> (ø)
...ckages/codemirror-graphql/src/utils/mode-indent.ts 0.00% <0.00%> (ø)
packages/codemirror-graphql/src/variables/hint.ts 89.70% <ø> (ø)
packages/codemirror-graphql/src/variables/mode.ts 79.48% <ø> (ø)
packages/graphiql/src/utility/fillLeafs.ts 5.33% <ø> (ø)
... and 77 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1bea864...b4de923. Read the comment docs.

@acao acao force-pushed the hide-diagnostics-parse-errors branch 3 times, most recently from b76d9a5 to 3447204 Compare May 1, 2022 14:55
this should work in most cases, except for cases where there are only comments and no actual graphql ops, fragments or SDL, but it's hard to come up with an efficient pass. this takes care of the situation where, when authoring a query like `gql\`|\``
@acao acao force-pushed the hide-diagnostics-parse-errors branch from 3447204 to a51f7db Compare May 2, 2022 05:47
@acao acao force-pushed the hide-diagnostics-parse-errors branch from e81c31b to b4de923 Compare May 2, 2022 06:15
@acao acao merged commit e6daf88 into main May 2, 2022
@acao acao deleted the hide-diagnostics-parse-errors branch May 2, 2022 06:26
@github-actions github-actions bot mentioned this pull request May 3, 2022
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.

None yet

1 participant