-
Notifications
You must be signed in to change notification settings - Fork 15
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
[feature request] svelte files (Houdini + Svelte-Kit) #168
Comments
Hey, Currently we have no support for reading I don't know the specifics though so maybe it's not possible to tell TypeScript to use a different type of AST, ... I am not deeply familiar with folks working in the LSP ecosystem for these languages, I can try asking around as I would love to be able to support anyone using GraphQL. I saw the following pop up quite often 😅 // Diagnostics inside Svelte files are done
// by the svelte-language-server / Svelte for VS Code extension
if (isSvelteFilePath(fileName)) {
return [];
} I think in theory what would need to happen is we'd need to convert the Maybe there is a way where when we see a Sorry for the musings, I personally haven't used Svelte/Vue too much so trying to give you everything that pops to mind about this issue and maybe that sparks an idea on your side. CC @AlecAivazis in case you got ideas here |
Thanks for the detailed answer. I will ask around the vue and svelte folks that I know that are working on language server like Volar, which powers vue and astro VScode extensions ... https://volarjs.dev/core-concepts/embedded-languages/ , they might have some ideas on how this can be achieved. My gut feeling tell me that a lot of stuff like that has been done by the vue team, if you take a look at this https://github.com/vuejs/language-tools/blob/master/packages/typescript-plugin/src/index.ts it doesn't seem that complicated with Volar... So maybe adding support directly into GraphQLSP is possible with such an approach? I will gather some information during the week and will come back if I hear something helpful. I've also pinged the Houdini folks on their discord as they have some insight... But still a more "generic" solution that works with embedded typescript blocks would be fantastic. In the meantime, is there a way to silence the unknown fragment error or to make it a warning ? The developer experience provided in the TS file is so amazing, would love to not have to turn the plugin off. |
@Hebilicious there is a setting |
|
Ah yes; that's validation failing... not much we can do there apart from the client preset or something else that defines fragments centrally. Not sure how houdini works but with the client preset we locate the fragments centrally and as it's not in the selection we can't discover it. You might want to add support for houdini's special fragment thing. So to describe the high level way of working of two approaches in the LSP
I have no idea where with From what I can tell here we should be able to find the |
Sorry for chiming in a bit late here, it's been a crazy week. Houdini walks down the user's filesystem to find all of fragment definitions. We can definitely generate a centralized mapping somewhere if that helps the LSP find them. It's not immediately clear to me what that structure would look like from the examples but i haven't had my coffee yet. That being said, I'm more than happy to help clarify anything or answer any questions that pop up along the way. |
Does this really even have anything to do with Houdini? |
Svelte is from now on supported in our CLI https://github.com/0no-co/gql.tada, I don't think as we are moving more and more towards tada usage that we'll add explicit support for Houdini. In the future we might be able to add support for Svelte/Astro/Vue through volar but I will hold off from that for now and track this issue in #242 as Astro is already using volar. |
Hello there!
Thank you for working on such an important part of the graphQL tooling ecosystem.
I'm currently working on a SvelteKit project that uses Houdini as it's graphQL client.
GraphQLSP almost work there, but not quite. A picture is worth a thousands words :
It appears that the *.svelte files are not detected (I don't get syntax highlighting), and therefore the fragments return with the TSError : Unknown fragment.
In Typescript files, it appears to work fine and provide a very neat and fast syntax highlighting.
Here's my config :
What would be required to support the script tag of svelte files? (I assume this might extend to the script tag of vue SFC too)
I'm happy to try and contribute the feature, if you can point me in the right direction.
Edit: Investigate it a little more, there's this svelte typescript plugin here, https://github.com/sveltejs/language-tools/blob/master/packages/typescript-plugin/README.md , but I'm not sure how they can "work together".
The text was updated successfully, but these errors were encountered: