Skip to content
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

Support for specifying the configuration file manually #739

Open
robag-agrav opened this issue Feb 28, 2025 · 5 comments
Open

Support for specifying the configuration file manually #739

robag-agrav opened this issue Feb 28, 2025 · 5 comments

Comments

@robag-agrav
Copy link

We have a quite large application with quite a lot developers working on it. Majority is using VSCode. The configuration file for VSCode is not working in Websotorm and vica versa.

For us the easy solution would be to provide a way to set the configuration file manually, so we could have separate one for VSCode and for Webstorm.

Something like eslint has:

Image

Thanks in advance for your consideration

@vepanimas
Copy link
Collaborator

@robag-agrav hi! Could you please elaborate on why the configuration for VSCode doesn't work with the IntelliJ plugin? What are the differences? The intent in the recent updates was to unify the configuration process as much as possible, and now it supports the graphql-config, which is also used by other plugins.

@robag-agrav
Copy link
Author

@vepanimas hi,

Sorry for the late response.
I only installed vscode to check this, and I only tried the extension what the others use:
GraphQL: Language Feature Support
We were trying to make it work with all the features (without checking in webstorm) for a day, without success. If you read the reviews others have the same experience too.

So we decided no to touch it, potentially making it worse for a hundred people.

In general I do think it is a bad idea to define an interface and expect that every project follow it to the letter. Too much complexity, too many usecases.

On the webstorm part,
I don't have any issues, and really like the overall experience. The only inconvenience is that I stash the config file and the deletion of existing config, and unstash it every time I need to touch gql.

About your question, here is the config that somewhat works for vscode:
config for server:
server/.graphqlconfig

{
  "projects": {
    "default": {
      "documents": [
        "**/*.graphql",
        "**/*.graphql.ts"
      ],
      "schema": "./schema.graphql",
      "extensions": {
        "endpoints": {
          "default": {
            "url": "http://localhost:9001/gql/v1"
          }
        }
      }
    }
  }
}

config for frontend
.graphqlconfig

{
  "projects": {
    "default": {
      "documents": [
        "fe-folder/**/*.graphql"
      ],
      "schema": "schema.graphql",
      "extensions": {
        "endpoints": {
          "default": {
            "url": "http://localhost:9001/gql/v1"
          }
        }
      }
    }
  }
}

With this config in Webstorm no syntax highlighting, no go to definition, no autocomplete.
But in vscode there is autocomplete, syntax highlighting, and a sometimes working go to definition.

But making a new one with the yml format was really easy, and worked first time. And nothing is working in vscode.

@vepanimas
Copy link
Collaborator

vepanimas commented Mar 13, 2025

@robag-agrav .graphqlconfig is a filename for a configuration in legacy format, so called graphql-config v2. You should use one of these names for config files instead. In other words, renaming .graphqlconfig to graphql.config.json should make it work properly for any IDE that supports graphql-config.

@robag-agrav
Copy link
Author

yeah...
tried to rename those, now in webstorm in the queries everything is red. But I can fire the queries.

first I accidentally left the leading . in the file name, it worked perfectly, except the firing the queries :D.

To be honest, it just not worth the time to experiment different file names, and small nuances.
Staying with stashing/unstashing..

Thanks for the conversation tho..

@vepanimas
Copy link
Collaborator

@robag-agrav I'm sorry to hear that. I can't say I fully grasp the issue here, it's probably related to how the configuration is set up in your project or the project structure itself. I've fixed many issues and implemented features to unify the experience across different IDEs as much as possible, and overall, it works well.

The path to a custom config is a tricky feature since the paths in the config file are resolved relative to the config file's location. Usually, it's expected to be in the project root or the root of a sub-project in monorepos.

If you have time in the future to create a minimal repo to reproduce the issue, I'd be happy to check it and fix the problem.

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

No branches or pull requests

2 participants