graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
555 stars 71 forks source link

File handling on Windows seems broken (v0.3.11) #254

Closed lanwin closed 2 years ago

lanwin commented 4 years ago

Actual Behavior

It seems the windows file handling is broken. Ive tried it on two different systems with to different projects and see a lot of UnhandledPromiseRejectionWarning on both of them.

Expected Behavior

Files should be found an Windows too.

Steps to Reproduce the Problem Or Description

My graphql.config.yaml looks like that and works fine with graphql generator.

schema: ./src/generated/graphql_schema.graphql
documents: ./src/*.gql
extensions:
  languageService:
    useSchemaFileDefinitions: true

Specifications

Logs Of TS Server || GraphQL Language Service

Initial:

undefined
(node:13428) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/c%3A/Users/test/test/graphql.config.yaml'
    at Object.openSync (fs.js:440:3)
    at Object.func [as openSync] (electron/js2c/asar.js:140:31)
    at Object.readFileSync (fs.js:342:35)
    at Object.fs.readFileSync (electron/js2c/asar.js:542:40)
    at c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\graphql-language-service-server\dist\MessageProcessor.js:353:35
    at Array.map (<anonymous>)
    at MessageProcessor.handleWatchedFilesChangedNotification (c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\graphql-language-service-server\dist\MessageProcessor.js:342:43)
    at c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\graphql-language-service-server\dist\startServer.js:164:122
    at handleNotification (c:\Users\Steve Wagner\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\vscode-jsonrpc\lib\main.js:502:43)
    at processMessageQueue (c:\Users\Steve Wagner\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\vscode-jsonrpc\lib\main.js:273:17)
(node:13428) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside 
```of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 7)

Open and save a gql file

undefined
(node:13428) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/c%3A/Users/test/test/src/query.gql'
    at Object.openSync (fs.js:440:3)
    at Object.func [as openSync] (electron/js2c/asar.js:140:31)
    at Object.readFileSync (fs.js:342:35)
    at Object.fs.readFileSync (electron/js2c/asar.js:542:40)
    at c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\graphql-language-service-server\dist\MessageProcessor.js:353:35
    at Array.map (<anonymous>)
    at MessageProcessor.handleWatchedFilesChangedNotification (c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\graphql-language-service-server\dist\MessageProcessor.js:342:43)
    at c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\graphql-language-service-server\dist\startServer.js:164:122
    at handleNotification (c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\vscode-jsonrpc\lib\main.js:502:43)
    at processMessageQueue (c:\Users\test\.vscode\extensions\graphql.vscode-graphql-0.3.11\node_modules\vscode-jsonrpc\lib\main.js:273:17)
(node:13428) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 10)
lanwin commented 4 years ago

I found the root cause in graphql-languageserver and opened a pullrequest to fix it https://github.com/graphql/graphiql/pull/1715

jer-sen commented 2 years ago

Still an issue with last version 0.3.40. I get for example:

Cellule commented 2 years ago

The fix in graphql lsp has been merged now, will need to update the dependency in this extension and make a new release to properly fix the issue

acao commented 2 years ago

@Cellule already released the latest LSP server in VSC marketplace for 0.3.50! Just need to update openVSX pipeline token. Hope to get to it in the next few weeks after surgery

you tested the changes locally correct? Our integration tests don’t cover windows

Cellule commented 2 years ago

@acao I did port the fix from https://github.com/graphql/graphiql/pull/2214 to my local %userprofile%\.vscode\extensions\graphql.vscode-graphql-0.3.50\out\server\server.js and it's been working great so far. 0.3.50 doesn't seem to have to fix yet however

acao commented 2 years ago

It seems your change is present in the lockfile though?

https://github.com/graphql/graphiql/blob/main/packages/graphql-language-service-server/CHANGELOG.md#2714

https://github.com/graphql/vscode-graphql/blob/22d6fe032aee42db722cf3773e595f060446e46b/package-lock.json#L2527

strange... @orta noting a potential pipeline bug here

Cellule commented 2 years ago

I'm not sure how the pre-release channel works, but from my point of view 0.3.50 was released 2 months ago (which I used to test my original fix) image

acao commented 2 years ago

Huh! Well hopefully someone can take a look at the publishing pipeline soon. I must have misunderstood what happened in the logs. I am about to undergo surgery so it will take me a while to get a chance to try this again

frederikhors commented 2 years ago

Same here with freshly installed 0.3.50 using the "Switch to Pre-Release" button in VSCode on Windows 10. Any fix?

Cellule commented 2 years ago

I believe the PR https://github.com/graphql/vscode-graphql/pull/447 indeed tried to deploy 0.3.50 however, it seems 0.3.50 was already on the store since 2 months ago even though the version in package.json was still 0.3.49 so I believe we should retrigger the release with same changelog for 0.3.51 (not sure how that works :( )

acao commented 2 years ago

it was a bug from when I tried to get vscode pre-releases working on each merge, I think I can get it to publish in a single commit. the openvsx token with oracle is expired but I should be able to publish to vsc marketplace

acao commented 2 years ago

0.3.52 contains this fix, enjoy! thank you @cellule!

Cellule commented 2 years ago

Awesome! just tested with 0.3.52 and it's all good Thanks