0no-co / GraphQLSP

TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
https://gql-tada.0no.co
MIT License
380 stars 14 forks source link

TSServer crash #213

Closed totomakers closed 9 months ago

totomakers commented 9 months ago

Context:

I loose typescript typesafty with the plugin, but have GraphQL suggestion

image

TS log:

Err 794   [17:43:14.024] Exception on executing command delayed processing of request 14:

    Cannot read properties of undefined (reading 'fileName')

    TypeError: Cannot read properties of undefined (reading 'fileName')
        at getAllFragments (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11950:29)
        at find (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11906:13)
        at visitNode2 (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30227:18)
        at forEachChildInVariableDeclaration (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30289:123)
        at Object.forEachChild (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30744:35)
        at find (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11927:9)
        at visitNodes (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30235:22)
        at forEachChildInVariableDeclarationList (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30454:12)
        at Object.forEachChild (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30744:35)
        at find (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11927:9)
        at visitNode2 (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30227:18)
        at forEachChildInVariableStatement (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30451:59)
        at Object.forEachChild (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30744:35)
        at find (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11927:9)
        at visitNodes (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30235:22)
        at forEachChildInSourceFile (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30448:12)
        at Object.forEachChild (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:30744:35)
        at find (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11927:9)
        at findAllCallExpressions (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:11929:4)
        at getGraphQLDiagnostics (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:13811:13)
        at o.getSemanticDiagnostics (E:\Urban Radar\monorepo\node_modules\.pnpm\@0no-co+graphqlsp@1.3.2\node_modules\@0no-co\graphqlsp\dist\graphqlsp.js:14124:13)
        at proxy.<computed> [as getSemanticDiagnostics] (c:\Users\totom\.vscode\extensions\chakra-ui.panda-css-vscode-0.3.16996415-win32-x64\node_modules\@pandacss\ts-plugin\dist\index.js:593:33)
        at TemplateLanguageServiceProxy.adaptDiagnosticsCall (c:\Users\totom\.vscode\extensions\styled-components.vscode-styled-components-1.7.8\node_modules\typescript-template-language-service-decorator\lib\template-language-service-decorator.js:288:33)
        at Proxy.<anonymous> (c:\Users\totom\.vscode\extensions\styled-components.vscode-styled-components-1.7.8\node_modules\typescript-template-language-service-decorator\lib\template-language-service-decorator.js:54:25)
        at IpcIOSession.semanticCheck (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:183627:125)
        at E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:183688:14
        at MultistepOperation.executeAction (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:182346:9)
        at E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:182319:71
        at IpcIOSession.executeWithRequestId (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:185369:14)
        at Object.executeWithRequestId (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:183373:57)
        at Immediate._onImmediate (E:\Urban Radar\monorepo\node_modules\.pnpm\typescript@5.3.2\node_modules\typescript\lib\tsserver.js:182319:28)
        at process.processImmediate (node:internal/timers:478:21)
JoviDeCroock commented 9 months ago

Mind creating a reproduction? 😅 I reckon it crashes here but not sure why we wouldn't have any definitions. Like the screenshot has to be off for that to be the crash-location as this explicitly only gets called when there is a second array argument

totomakers commented 9 months ago

https://github.com/totomakers/graphqlsp

Here is the repro :) Maybe is windows related

I don't get any typechecking in "src/frontend/example.tsx"

JoviDeCroock commented 9 months ago

Your example does not produce an issue for me at all, also on windows. The crash can happen if you don't import the graphql function I reckon but that's... not really on us, TS does indicate that issue

totomakers commented 9 months ago

Yes currently my issue is ts doesn't indicate 'graphql' import is missing using the plugin. Switch to the vscode ts server show me the error.

Sorry my english is quite a mess T.T

output.webm

JoviDeCroock commented 9 months ago

Mind upgrading your LSP version? Pushed a potential fix to that

totomakers commented 9 months ago

image

Perfect, seem to fix the issue :) Thanks <3 <3

Close this one