Skip to content

Use .graphqlconfig File #125

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

Closed
0xcaff opened this issue Jan 4, 2018 · 17 comments
Closed

Use .graphqlconfig File #125

0xcaff opened this issue Jan 4, 2018 · 17 comments
Labels

Comments

@0xcaff
Copy link

0xcaff commented Jan 4, 2018

There's a de-facto standard for graphql metadata, graphql-config. Can this be used instead of the current format?

@jimkyndemeyer
Copy link
Collaborator

Hi Martin.

The config file format this plugin uses predates the graphql-config project, but I had discussions with the graphcool team when they began their work.

While I do see the value in converging on a single format, there are some important differences that makes adoption quite complex for this plugin.

The biggest difference is that this plugin relies on a single schema per IntelliJ/WebStorm project, whereas graphql-config allows multiple.

Like other language tooling on the IntelliJ platform, the project structure inside the IDE is what powers the various language features in this plugin. Again this difffers from graphql-config that uses glob patterns.

The bottom line is that adopting graphql-config cuts across all major features in this plugin. This includes schema resolution, completion, error highlighting, go to definition, and find usages.

Realistically, I don't see where I could find the time to begin working on this in addition to maintaining the plugin. Right now #121 is the highest priority to ensure that the plugin keeps working as expected as the GraphQL spec evolves.

/Jim

@RIP21
Copy link

RIP21 commented Jan 24, 2018

@jimkyndemeyer hey. Is there any help I can give? If you will guide me a bit where to watch I may be able to help out with adopting .graphqlconfigconfig format.

@jimkyndemeyer
Copy link
Collaborator

Hi Andrii.

Thanks for offering to help.

Given the scale of the change, I don't think it's realistic to work on this unless you are very experienced with the IntellIJ Platform SDK.

But, I've been thinking about an interim solution that can sync compatible properties from a .graphqlconfig file into the graphql.config.json file. While this doesn't cover all potential use cases and variants of a .graphlconfig setup, it could help developers with keeping the files in sync.

See JSGraphQLConfigurationProvider#contentsChanged for how the plugin updates the UI when the list of endpoints changes. If should be possible to also respond to changes in a .graphlconfig file and write compatible properties to the graphql.config.json file, e.g. the file or url that contains the schema.

Let me know if you have any questions.

/Jim

@RIP21
Copy link

RIP21 commented Jan 24, 2018

@jimkyndemeyer I don't have any experience with it TBH :)
I will take a look at the Provider in spare time. Thanks for the hint.

@JetBrains JetBrains deleted a comment from RIP21 Jan 25, 2018
@jimkyndemeyer
Copy link
Collaborator

@RIP21 Glad it worked out. I've deleted our comments that were somewhat unrelated to this issue.

@ForsakenHarmony
Copy link

So it won't ever be possible to have multiple schemas?

I have a project with 2 directories that have different schemas, but don't want to have to open webstorm twice

@jimkyndemeyer
Copy link
Collaborator

The 2.0 alpha makes it possible to have multiple schemas in a single project using IntelliJ/WebStorm "Scopes". You can configure them for the project in the IDE Settings dialog.

With that in place it should become possible to automatically sync the include/exclude rules in a watched graphql-config file such that the plugin language features respect said rules.

See 2.0.0-alpha-2 if you'd like to try it and help test it.

/cc @schickling

@fetis
Copy link

fetis commented Jun 25, 2018

it's quite strange but the plugin is listed here as supported this format https://github.com/prismagraphql/graphql-config

@jimkyndemeyer
Copy link
Collaborator

@fetis Note the "(pending)" at the end of the sentence.

@fetis
Copy link

fetis commented Jun 25, 2018

omg. how reads them all? :)

jimkyndemeyer added a commit that referenced this issue Jun 30, 2018
- Added settings dialog for schema discovery
- Added JSON schema for .graphqlconfig
- No longer using graphql.config.json for configuration
@jimkyndemeyer
Copy link
Collaborator

Released in https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/releases/tag/2.0.0-alpha-3

@ForsakenHarmony
Copy link

would you consider moving to https://github.com/graphql/graphql-language-service/ as well?

@jimkyndemeyer
Copy link
Collaborator

I have, and I've been in talks with both Prisma and Facebook engineers.

It really comes down to trade-offs. While graphql-language-service does offer some advantages from shared tooling, it has the following drawbacks:

  • It's JavaScript-based and requires Node.js tooling on the IntelliJ platform. This excludes Android Studio and Intellij Community users.
  • Integration with the more powerful features in the IntelliJ platform is much more complicated when calling out to an external language service.

What really made the difference for v2 is the great work being done on graphql-java, which enables this plugin to get features such as validation and GraphQL SDL tools directly from the Java ecosystem.

@ForsakenHarmony
Copy link

oh, so you're moving away from the other javascript language server as well?

@0xcaff
Copy link
Author

0xcaff commented Jul 1, 2018

I'm not sure how graphql-language-service is structured, but would it be possible to wrap graphql-language-service using the nashorn JavaScript engine to remove the dependency of a nodejs environment?

@ForsakenHarmony
Copy link

I doubt it supports running stuff written for node.js

@jimkyndemeyer
Copy link
Collaborator

Closing as v2 alpha now uses .graphqlconfig files and can migrate the legacy graphql.config.json files automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants