graphiql: [lsp-server] π The language server throws "could not parse the TypeScript file" error for every TS file when `documents` field is used
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
The language server throws Could not parse the TypeScript file. SyntaxError: Unexpected token, expected "," errors when I use documents section in GraphQL config.
The Config:
projects:
apps:
schema: https://localhost:8080/graphql
documents:
- ./app/**/*.{ts,tsx}
- '!(app/operations/generated/*)'
- '!(app/operations/gqlApolloHooks.ts)'
The Other Config That I tested:
projects:
apps:
schema: https://localhost:8080/graphql
documents:
- ./app/**/*.{ts,tsx}
- '!./app/operations/generated/*.{ts,tsx}'
- '!./app/operations/gqlApolloHooks.ts'
And here is a trick config that works:
projects:
apps:
schema: https://localhost:8080/graphql
include:
- ./app/**/*.{ts,tsx}
exclude:
- './app/operations/generated/*.{ts,tsx}'
- './app/operations/gqlApolloHooks.ts'
Expected Behavior
It should not throw TypeScript errors and just work.
Steps To Reproduce
No response
Environment
- LSP Server Version: VSCode GraphQL v0.8.17
- OS: macos
Anything else?
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 12
- Comments: 24 (7 by maintainers)
I encountered a similar issue with the latest version (v0.11.0) where all my fragments are reported as βUnknownβ. Downgrading the extension to v0.9.3 fixes the issue.
However, both versions show the following errors for every TypeScript files in my repo:
Not sure why v0.9.3 works correctly and go to definition for fragments also works.
Same issue here with the following config:
and the following output:
@Tadimsky I suspect this is due to changes where we let graphql config do more of the parsing. Looking into it still!
Iβm seeing the same problem
Nope still getting
SyntaxError: Unexpected token, expected ","errors in the graphql language server output everytime I reload the VSCode. (All my queries are defined usinggql-taginside ts files) The autocomplete works fine though.@acao is there any update on this? Itβs still happening on the latest version. Downgrading is the only way to resolve this.
i believed the fix for this is released as v0.8.19 for
vscode-graphql, 2.11.5 for the LSP, let me know if that helps!