0no-co / gql.tada

🪄 Magical GraphQL query engine for TypeScript
https://gql-tada.0no.co
MIT License
2.59k stars 43 forks source link

Doesn't work with Webstorm/Jetbrains #80

Closed numfin closed 6 months ago

numfin commented 8 months ago

Describe the bug

It would be nice to be able to generate typings in cli https://www.reddit.com/r/graphql/comments/19921i6/gqltada_a_graphql_parser_written_in_typescript/

Reproduction

No response

gql.tada version

v1.2.1

Validations

kitten commented 8 months ago

This unfortunately isn't an issue we can accept as such and fix, because it's not fixable from our end.

I'd appreciate someone reaching out to the IntelliJ/Webstorm team about this, but the crucial thing here is that for the TS LSP plugin to work:

Otherwise only type inference is going to work, provided a typings file has been generated. We're planning to supplement this functionality with a CLI as well: #76

numfin commented 8 months ago

@kitten should we close this issue since cli is developed in #76 ? Or keep it to know progress of jetbrains integration?

probably someone with webstorm will come here so here is workaround for you: npx gql.tada@canary generate - will generate graphql-env.d.ts for you

krokhale commented 8 months ago

I got it working with Webstorm yesterday. Did you enable the project TS env in the settings?

JoviDeCroock commented 8 months ago

@krokhale is that anything we can document or add a sample configuration file for (like we have for VSCode)

krokhale commented 8 months ago

@JoviDeCroock Nothing major to document, but essentially similar to vscode, one needs to switch the typescript from the bundled version to the one in: ~/code/node_modules/typescript

The option can be found in:

Settings -> Language & Frameworks -> Typescript

Make sure the Typescript language service is turned on.

kitten commented 8 months ago

@krokhale If we do decide to document some of this this might be quite major if Webstorm doesn't prompt you to do this — or at least, we do seem to be getting questions about it rather often

krokhale commented 8 months ago

@kitten Well yeah, unfortunately it does not work out of the box in Webstorm and probably not the ideal experience compared to how it works in vscode. Generating a graphql-env.d.ts does work though. fwiw, I am using Next 14.1. Another thing to note is that I have the official GraphQL plugin by Webstorm enabled. Probably worth reaching out and opening a ticket with the Jetbrains guys.

Jonne commented 8 months ago

Hi everyone, the graphql-env.d.ts does get generated in webstorm. but code completion does not work. Even when you enable the graphql plugin. I've opened a ticket yesterday: https://youtrack.jetbrains.com/issue/WEB-65740#focus=Comments-27-9296748.0-0

Jonne commented 8 months ago

Btw. it does work with the graphql plugin, if you have a local graph.schema file (Like in the pokemon example), the graphql plugin automatically used that file. It does not work with a remote schema file however.

JoviDeCroock commented 8 months ago

@Jonne that could be an error surfaced in your tsserver logs though 😅 we do support it so you might wanna check whether an error is surfaced.

Jonne commented 8 months ago

@JoviDeCroock As far as I can judge, I don't see any errors in the tsserver logs. I can send them to you if you would like to have a look?

kitten commented 6 months ago

Closing due to inactivity.

It's very unclear to me whether TypeScript plugins are now working properly in Jetbrains' IDEs or Codestorm/Webstorm, or whether there's an active workaround to enable them properly (similar to how VSCode requires an additional step)

If someone knows the answer to this, please let me know.

If someone reads this and this still doesn't work, the CLI should always be the best fallback for situations where your editor/IDE isn't set up to run a TypeScript language server including TS plugin support. https://gql-tada.0no.co/reference/gql-tada-cli

Yuripetusko commented 2 months ago

experiencing this too

vscode: image

webstorm: image (1)

The introspection files are generated fine, but official Jetbrains graphql plugin fails to autocomplete

kitten commented 2 months ago

official Jetbrains graphql plugin

I mean, just putting this out there, that has nothing to do with gql.tada and afaik Jetbrains' IDEs still don't support TypeScript plugins fully and properly

Yuripetusko commented 2 months ago

official Jetbrains graphql plugin

I mean, just putting this out there, that has nothing to do with gql.tada and afaik Jetbrains' IDEs still don't support TypeScript plugins fully and properly

Yes, sorry, not trying to reopen this issue, just confirming that it's not an isolated case, and vscode experience here is indeed superior to jetbrains. Probably need to poke Jetbrain devs about this on the issue that @Jonne created above

Yuripetusko commented 2 months ago

the query return types are working correctly, and if I manually add wrong query then webstorm would tell me that it's incorrect, just the autocomplete doesn't work, as if graphql plugin can't detect this as graphql query unless I name the file with .graphql extension (for non gql.tada use case), then autocomplete works fine. So ts plugin/server works fine as far as I can see

kitten commented 2 months ago

Yep, sorry, I didn't actually get around to posting in the Jetbrains thread — I also think they might have multiple issues regarding this that match 🤔 My main fear though is that if we don't intervene, there'll be conflicts with their own GraphQL plugin. That said, we do have a special graphql.config warning in doctor already, so we might be able to add another Jetbrains warning in our gql.tada doctor command once the dust settles.

The main things to check btw are:

If all those are working, then an editor is compatible and set up correctly to use the TypeScript plugin.