Closed n4bb12 closed 4 months ago
This is not tested and while it might work, provided you alter the detected template
in these settings, we have some support for multi-schema setups planned: https://github.com/0no-co/GraphQLSP/discussions/223#discussioncomment-9050883
However, it'll likely not involve repeating the plugin and instead expand the generated functions with a type hint that the LSP can pick up while allowing an array of schemas and outputs to be passed
when this feature will be planed :)
@tianyingchun this is open-source, feel free to submit an RFC outlining your approach and PR'ing the functionality.
@tianyingchun: Please read the reply in the thread I linked above in my last reply: https://github.com/0no-co/GraphQLSP/discussions/223#discussioncomment-9050883
It clearly states that this is something we'll address after the next batch of RFCs is resolved and released.
Again to repeat what's stated there, the RFC I have in mind would mostly get the LSP to allow for multiple schemas to be loaded, for gql.tada
’s output file to contain a type-hint for the schema it was sourced from, and the LSP to then pick that up to choose the correct schema for its type hints / autocompletions / etc.
Closing in favour of #248
Multi-Schema Support has been released in gql.tada
1.6.0 (+ @0no-co/graphqlsp@^0.12.0
).
There's more information in the corresponding announcement devlog post: https://gql-tada.0no.co/devlog/2024-04-26
Describe the bug
Given a
tsconfig.json
containing the following plugin configurationWhen initializing the TS LSP in VSCode, all plugins are respected, and both
graphql-env.d.ts
files get generated.Using the gql.tada CLI with
gql-tada generate-output
, only the first configuration is respected. The second configuration is ignored. You can swap the order to verify.The context for using more than one plugin configuration is the need to talk to more than one GraphQL API.
Reproduction
https://github.com/n4bb12/gql-tada-repro
gql.tada version
gql.tada: 1.4.3 @0no-co/graphqlsp: 1.9.1 typescript: 5.4.4
Validations