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

The helper doesn't work well during the development of the tests #495

Closed jBernavaPrah closed 2 years ago

jBernavaPrah commented 2 years ago

Describe the bug

I'm using Laravel/Lumen with the lighthouse package. The development of the schemas is working correctly without errors. However, when I'm defending the tests the IDE is marking me errors that shouldn't be there (as you can see in the image)

Do you know how to make the helpers work?

Expected behaviour The helper should identify the compiled schema during the testing.

Screenshots image

Version and Environment Details Operation system: Mac IDE name and version: PHPStorm 21.1.4 Plugin version: 3.0.0

vepanimas commented 2 years ago

Hi! Unfortunately, there are not enough details to debug this.

  1. Do you have any errors in the GraphQL tool window under the schema list item?
  2. What errors are reported on those fields and arguments marked with red?
  3. Also, it looks like the users field is resolved to a schema properly, could you navigate to its definition from the test file?
  4. Do you have a .graphqlconfig specified?
  5. Is the schema file stored as a .json or a .graphql file?

Also, could you please invoke Help > Collect logs and diagnostic data in the IDE, upload the created archive to https://uploads.jetbrains.com/ and then attach the assigned ID to this ticket? So if the logs contain any sensitive data they will be available only for JB support. Or at least you could look in the log for ERROR and WARN messages. It's a good idea to edit a schema manually several times before collecting the logs to be sure that the schema building errors would be there.

jBernavaPrah commented 2 years ago

Sorry for replaying so late!

This is not a bug. I played until I found a working solution correctly in that lighthouse project.

This is the current configuration inside the .graphqlconfig file:

{
    "projects": {
        "BE": {
            "excludes": [
                "./storage/app/lighthouse-schema.json"
            ],
            "includes": [
                "graphql/**",
                "schema-directives.graphql",
                "programmatic-types.graphql"
            ]
        },
        "FE": {
            "excludes": [
                "graphql/**",
                "schema-directives.graphql",
                "programmatic-types.graphql"
            ],
            "schemaPath": "./storage/app/lighthouse-schema.json"
        }
    }
}

Remember to run @php artisan lighthouse:print-schema --write --json.

ps. Often the changes made to the file .graphqlconfig or the file ./storage/app/lighthouse-schema.json are not loaded immediately on the plugin. So wait or reopen the phpstorm.