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

Endpoints not showing when editing *.graphql files, so cannot run queries #492

Closed sc0ttdav3y closed 1 year ago

sc0ttdav3y commented 3 years ago

Hi,

Thanks for the plugin. I've used this in the past and it's really useful.

I've read through the guides and examples and it may be related to https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/143 or https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/487 but it feels different so I've opened a new report.

If it's a documentation or a user problem, then help and guidance would be appreciated.

Describe the bug

In short, I can't run any GraphQL queries from regular .graphql files (but I can run them from scratch files).

I've got a .graphqlconfig file as follows, which specifies a valid endpoint.

{
    "name": "XXX",
    "includes": ["../path/to/schema/*.graphql"],
    "extensions": {
        "endpoints": {
            "blue": {
                "url": "XXX",
                "headers": {
                    "Authorization": "XXX"
                },
                "introspect": false
            }
        }
    }
}

I have a valid queries.graphql file with a simple graphql query, sitting in the same directory as the .graphqlconfig file:

query {
    ping(site: "test1") {
        timestamp
    }
}

The syntax highlighting is working and I can hover over the variables to show the plugin knows the types.

But the endpoint selector is empty, and I've also got a message about "The .graphqlconfig associated with this file does not include it" (side note: I don't understand what that means).

Screen Shot 2021-09-12 at 2 25 43 pm

However, in the GraphQL tool window I can see the endpoint, and double-clicking it gives me the option to create a new scratch file, which does execute, but which doesn't have full syntax highlighted.

Screen Shot 2021-09-12 at 2 38 35 pm

To Reproduce

I've created a basic repo with a working example of the problem: https://github.com/sc0ttdav3y/js-graphql-intellij-plugin-example

Steps:

  1. Pull the repo
  2. Open this up in PhpStorm
  3. Open the queries.graphql file

Expected behavior:

I expect to see the endpoint listed in the select box at the top of the window.

Actual behaviour:

The select box is empty.

Version and Environment Details

Operation system: MacOS 11.5.2 IDE name and version: PhpStorm 2021.2.1 (latest) Plugin version: 3.0.0 (latest)

Additional Context

May be related to https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/143 or https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/487

I've had this same configuration working in 2020 when I was last in GraphQL land, but I've had an IDE upgrade and a plugin upgrade since then, which is why I suspect it's a bug and not a user/docs problem. But if I'm doing something wrong then advice is appreciated.

Thanks!

vepanimas commented 3 years ago

Hi! The query file also should be included in the globs specified in the config (or you can remove "includes" completely if you don't need it):

{
  "name": "Test",
  //  "includes": ["*.graphql"],
  //  "includes": ["./schema/**", "queries.graphql"],
  "extensions": {
    "endpoints": {
      "blue": {
        "url": "https://XXXX.appsync-api.ap-southeast-2.amazonaws.com/graphql",
        "headers": {
          "Authorization": "XXX"
        },
        "introspect": false
      }
    }
  }
}
sc0ttdav3y commented 3 years ago

Hi @vepanimas, thanks for responding.

I had hoped it was a config issue at my end, and it sounds like it might be. However I'm still not able to get it all working with your response.

There are two features I'm trying to get going: first, it's the endpoint in the selector with the ability to run the query; and second, syntax highlighting with the ability to autocomplete, click through to schema, etc.

I've taken your two ideas and run a few combinations:

  1. "includes": ["./schema/*.graphql"], does not show the endpoint, but the syntax highlighting stops working
  2. "includes": ["./schema/*.graphql", "*.graphql"], does show the endpoint, but syntax highlighting stops working
  3. "includes": ["**.graphql"], does show the endpoint, but syntax highlighting stops working
  4. Removing includes entirely does show the endpoint but syntax highlighting stops working

I figure I must be doing something wrong but I can't see it. Any ideas?

vepanimas commented 3 years ago

@sc0ttdav3y looks like something goes wrong, unfortunately. Could you please invoke Help > Collect logs and diagnostic data in IDEA and upload the created archive here? Or you could upload it to https://uploads.jetbrains.com/ and attach the assigned ID to this ticket, so if the logs contain any sensitive data they will be available only for JB support.

vepanimas commented 2 years ago

@sc0ttdav3y hi! Any updates on that? I'm really interested to catch all the schema building issues and fix them 🙏.

vepanimas commented 1 year ago

Close as not reproduced 😢