Giter Site home page Giter Site logo

Comments (10)

jordanweaver avatar jordanweaver commented on September 21, 2024 6

I also noticed this behavior and it was even more subtle in my case... all I had to do was simply open the file containing the fragment and then the error disappeared in the file/query where the fragment was spread. But it would come back with any reload or edit.

Not sure how recommended it is, but I opted to manually downgrade through VS Code's extension manager, where it seems 0.9.3 was the last version prior to 0.11.0:

from graphiql.

acao avatar acao commented on September 21, 2024 6

@DerPlayer2001 not yet, I will let folks know here when it is!

from graphiql.

sbiallas avatar sbiallas commented on September 21, 2024 4

I also noticed this behavior and it was even more subtle in my case... all I had to do was simply open the file containing the fragment and then the error disappeared in the file/query where the fragment was spread. But it would come back with any reload or edit.

Not sure how recommended it is, but I opted to manually downgrade through VS Code's extension manager, where it seems 0.9.3 was the last version prior to 0.11.0:

Did the same and worked for me!

from graphiql.

sbiallas avatar sbiallas commented on September 21, 2024 3

I have the same problem. I use GraphQl-Codegen with the client preset, which works as expected. I get syntax highlighting and autocomplete options inside the gql tags. But when I use fragments from other files their are not recognized. I had these fragments also working, also with the fragment names showing up as autocomplete options, but I can't reproduce it. When I rename the generated gql tag to e.g. graphql and adjust the imports suddenly the errors disappear and I get also the right autocomplete options, but after next reload of vscode the errors are there again and autocomplete stops working. I got error messages inside the LSP output for I guess every file which contains a gql tag:
image

from graphiql.

dulnan avatar dulnan commented on September 21, 2024 1

While I seem to have a slightly different setup than others, I also encountered a similar issue and I was able to figure out what's causing it in my case. I still had some .graphql files that contain import comments at the top of the file, e.g.

#import "~/components/Teaser/fragment.teaser.graphql";

Looking at the logs (in neovim using :LspLogs in my case), the error I saw was:

[ERROR][2024-08-01 11:20:22] ...lsp/handlers.lua:623
"AggregateError: Failed to find any GraphQL type definitions in: ./node_modules/blokkli-beta/dist/**/*.graphql;\n - 
Cannot find module '~/components/Teaser/fragment.teaser.graphql'\nRequire stack:\n- /run/media/dulnan/Storage/development...

Since I don't need these import comments anymore, I was able to remove them. I assume this functionality to resolve these imports was added at one point or it was made to throw an error if the import fails. In my case, the imports are irrelevant anyway because all the documents that could potentially be imported are declared as a pattern in documents, so their fragments are available even without the import.

from graphiql.

VinceBT-BG avatar VinceBT-BG commented on September 21, 2024

This is kind of a breaking bug, all fragments have broken in my project as well

from graphiql.

pronovaso avatar pronovaso commented on September 21, 2024

Confirm same bugs as mentioned here.

from graphiql.

jaredellison-nyt avatar jaredellison-nyt commented on September 21, 2024

Confirming I'm seeing the same bug as well. Adding a plain text version of the logged syntax errors to help others find the github issue.

Reverting to GraphQL: Language Feature Support v0.9.3 resolves the issues.

[Info  - 10:14:19 PM] {"type":"usage","messageType":"initialize"}
GraphQL LSP restarted
[Info  - 10:14:20 PM] Could not parse the TypeScript file at file:///path/to/file.ts to extract the graphql tags:
[Info  - 10:14:20 PM] SyntaxError: Unexpected token, expected "," (2:55)
[Info  - 10:14:20 PM] Could not parse the TypeScript file at file:///path/to/another/file.ts to extract the graphql tags:
[Info  - 10:14:20 PM] SyntaxError: Unexpected token, expected "," (2:47)
[Info  - 10:14:20 PM] GraphQL Language Server caches initialized

Thanks for the work on this extension, beyond this bug it's an invaluable tool!

from graphiql.

ionTea avatar ionTea commented on September 21, 2024

Same issue as here and it's fixed by downgrading to v 9.3.

This is what I found - I get the error where the file containing the fragment couldn't be parsed

[Info - 9:39:01 AM] Could not parse the TypeScript file at <...filepath.ts> to extract the graphql tags:
[Info - 9:39:01 AM] SyntaxError: Unexpected token (4:4)

When I then go to that file and save it, and then go back to where I used the fragment the fragment is picked up and it's working again. I'm guessing the file is parsed successfully and cached when I save the file or something?

from graphiql.

DerPlayer2001 avatar DerPlayer2001 commented on September 21, 2024

Is there any Progress on resolving this Issue in the Current Version?

from graphiql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.