Let me prefix this by saying thanks for creating a great library for the OS community! 馃帀
Describe the bug
The installation docs recommend installing the popular JS GraphQL plugin for PHPStorm and using the php artisan lighthouse:ide-helper command to generate schema files that the plugin can use for helpful autocomplete/suggestion functionality.
However, at least one of these files contains errors that prevent the aforementioned plugin functionality from working.
Expected behavior/Solution
Lighthouse directives defined in the generated 'schema-directives.graphql' file, e.g. @scalar and @all should be recognised by the IDE (i.e. no error should display) and CTRL+clicking should navigate through to the relevant area of the schema (as per the plugin's standard functionality).

I originally thought this was a problem with the plugin itself and that its default configuration wasn't importing the files correctly, due to the main schema not being in the project's route. Although, this turned out to be a red-herring as the IDE plugin displays a clear error when viewing a file that is not being imported. Instead, I discovered the 'schema-directives.graphql' file contains a number of errors:

The problems include missing type definitions, duplicate definitions and syntax errors, for example:

Steps to reproduce
composer require nuwave/lighthouse)php artisan lighthouse:ide-helper)@all.Output/Logs
I patched the problem by hand, which is obviously not ideal, but it should hopefully illustrate the problem quite clearly if you look at the diff: https://www.diffchecker.com/7gLvXXor
Lighthouse Version
5.0
Hi @SamChristy
I can feel your pain =)
repeatable is a new gql feature, that is currently not supported by js-graphql intellij plugin, but it is under development. You can follow this issue, to stay updated on the task: https://github.com/jimkyndemeyer/js-graphql-intellij-plugin/issues/351
I guess, when repeatable becomes recognizable by js-graphql intellig plugin, all the errors will disappear.
If not, we can then continue fixing possible issues.
Thanks @SamChristy for the report and @lorado for the update.
You can temporarily strip the repeatable keyword from the directive definitions, until the plugins catch up:
sed -i 's/repeatable//g' schema-directives.graphql
I just looked at the diff you posted, there is some stuff worth discussing:
RulesMessageMap unfortunately is currently implemented in a way that makes it impossible to define an accurate directive definition, as generic maps are not possible in GraphQL. Working on it in https://github.com/nuwave/lighthouse/pull/1662BelongsToManyType was missing because of hasty copy-and-paste, fixed in https://github.com/nuwave/lighthouse/pull/1663Mixed is a tricky one, some people define that scalar themselves. We could probably include it somewhere?Thanks guys,
@lorado that's really useful to know, re the repeatable feature missing on the PHPStorm plugin. 馃憤
@spawnia thank you for going through each of the issues so thoroughly; I'm very glad to hear that two of the problems are already being addressed. In regards to the others:
type Query defined in both the helper schema ('schema-directives.graphql) and my main actual schema ('graphql/schema.graphql'), and there was no issue I could see - the IDE plugin didn't report any errors and the query I defined continued to work, when I made a request targeting it.Mixed type without issue, so I think the schema-directives.graphql file should be able to contain this, unless I am missing something? (In which case I'm sorry!)enum PaginateType is defined twice in schema-directives.graphql - I'm not sure what the cause is, but it should hopefully be easier to solve?I think, overall, the expectation from a new user's perspective is that everything in the intro tutorial will just work out of the box. I also think more experienced users (who are defining Mixed, etc.) may be better able to work around any issues arising from more advanced use-cases.
I wonder if adding optional flags to the php artisan lighthouse:ide-helper command, e.g. --exclude-base-types, could offer a good middle ground? I would be happy to put in a PR for that, if desired. 馃憤
You can temporarily strip the
repeatablekeyword from the directive definitions, until the plugins catch up:sed -i 's/repeatable//g' schema-directives.graphql
For people finding this, on OS X the correct command to strip out the repeatable keyword is:
sed -i '' 's/repeatable//g' schema-directives.graphql
Linux and OS X sed commands are slightly different and are not 1:1 compatible.
What does the Mixed definition depend on generally? Is there any documentation on what Mixed should or could be? If not, would someone be as kind as to provide a good definition of it? Sorry if I've missed something!
What does the
Mixeddefinition depend on generally? Is there any documentation on whatMixedshould or could be? If not, would someone be as kind as to provide a good definition of it? Sorry if I've missed something!
It is now excluded from Lighthouse's directive definitions.
I still encounter these problems. I'm currently using the latest version 5.3.
Most helpful comment
Thanks @SamChristy for the report and @lorado for the update.
You can temporarily strip the
repeatablekeyword from the directive definitions, until the plugins catch up: