JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
879 stars 97 forks source link

Register a schema from a third-party plugin that is only used when specific conditions are met #707

Open SCWells72 opened 3 months ago

SCWells72 commented 3 months ago

I'm logging this as a question as I'm not seeing an obvious answer in the docs, but in the spirit of honesty, I also haven't completely reviewed all of the docs, so the answer may well be there. Apologies if that's the case, and if so, please feel free to redirect me to the relevant section(s).

I have an existing third-party plugin that supports a framework that uses a specific GraphQL schema from JavaScript files in a specific, known context. I can easily recognize that context via the PSI tree, but I'm not sure how to programmatically tell the GraphQL to use a specific schema in that situation. I also can't quite figure out how to register a schema with the GraphQL plugin programmatically from another plugin. Are there well-defined EPs published by the GraphQL plugin for these two tasks, specifically 1) registering a schema; 2) using that schema when a specific PSI state is found? And to be clear, the GraphQL plugin is already recognizing the JavaScript string literal element as being a query, so I imagine it's more directing it to use the correct schema at that point based on the specific way it's being used (which, again, is a well-known contextual pattern).

Again, apologies if I'm wasting your time, but I figured it wouldn't hurt to ask for some guidance even if the end result is direction to specific documentation topics.