-
Notifications
You must be signed in to change notification settings - Fork 49
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
gql.tada check
reports an "Unkown fragment" error when fragments are imported in a TS file from a Vue SFC
#210
Comments
Does that actually work in a regular See: |
No you'd have to use vue-tsc so that would makes sense. The only thing I don't understand is how comes the check command works when importing to and from a Vue SFC file then? |
Yes, both for Svelte and Vue we could use their respective packages to do a prepass over all the files and make them into TS
Then add the From what I can tell we can even patch how TS gets its script snapshots, maybe that is a better solution for this as it would solve both the CLI and TS Plugin https://github.com/sveltejs/language-tools/blob/master/packages/typescript-plugin/src/index.ts. The volar way looks a lot simpler though https://github.com/vuejs/language-tools/blob/master/packages/typescript-plugin/index.ts |
@JoviDeCroock Just to note this down somewhere, TS Morph seems to have an open issue for this but hasn't resolved this yet, but someone there basically pointed out the API to use for this on the TS side |
Another comment here on this topic: The gist of it is though that currently we have no timeline or implementation path yet for Vue, Astro, and Svelte support, and haven't deprioritised this yet |
I have an initial working version for this in #232 - would love for this to be tested on larger projects though 😅 |
I have tested the PR on my project, which contains >70 fragments and queries in various files (mostly .ts and .vue file), with nested fragments etc. The cache is now correctly populated, but it seems to break some typings (as far as i can tell only for fragments/queries which contain a fragment of another component). Here is an example (left without cache, right with cache).
If you need more information please let me know. I can also try to reproduce this in the reproduction i've provided in the linked issue if helpful. |
Was able to fix EDIT: all fixed, we'll prepare this as an experimental feature |
Incredible, thank you so much for such a quick turnaround! |
Describe the bug
We're trying to setup gql.tada to do a check in a CI job using the newly added check command (awesome addition btw!) but we're faced with a weird issue. The command will report incorrectly an error when fragments are imported from a different file type. This is what I've tested:
The IDE however, is fine with any kind of combination. I'm unsure where the problem lies exactly but it seems strange that the IDE would not report the error if both the CLI and IDE are using the LSP?
I've set up a reproduction that hopefully will help you track the source down.
Thank you so much for the awesome project, it might be the best package I've used in a long time!
Reproduction
https://github.com/raphael-yapla/gql-tada-vue-issue
gql.tada version
gql.tada v1.5.0
Validations
The text was updated successfully, but these errors were encountered: