-
Notifications
You must be signed in to change notification settings - Fork 95
Description
Limitations in 1.x and proposed solutions for 2.x
Only a single schema per-project
- 1.x Completion, references, find usages, error highlighting all based on the assumption that a single schema per-project is the norm
- 1.x Issues - Import fragments from a exernal file #43, Add "Navigate to Declaration" across files #56, Support for multiple schemas (on multiple endpoints) #84, Use
.graphqlconfig
File #125, Apollo Link State queries not supported #129, Save Schema if pulled from URL #140, Add support for Framework-specific Schema directives, e.g. Prisma #144, Allow having multiple configs in a project (scope per subfolder) #145 - 2.x All language features that rely on schema type info should scoped based on their location in the project
- See https://www.jetbrains.com/help/idea/settings-scopes.html
- Tasks
- Let users setup the scopes manually while offering to synchronize scopes based on graphql config files
- Create settings page for scopes
- Use scopes to limit configured endpoints for query functionality
Node.js + JavaScript plugin dependency
- 1.x Due to these dependencies the plugin is unavailable for IDEs such as Android Studio
- 2.x Will no longer use an external language service, and JavaScript functionality will be marked "optional" in plugin.xml
Changes to spec, grammar, and language difficult to support in the plugin
- 1.x Difficulty in isolating changes from the plugin as the language service changes (e.g. grammar changes affect both the plugin and the LS)
- 1.x Complexity in version management on the NPM packages that the language service depends on
- 1.x Issues - Add tab indentation support #92, Support docstrings #118, Indenting for aliases looks wrong #133, support extending interfaces #137, Invalid schema checks #141, [schema] lack of comments/description of GraphQL objects when schema is generated from endpoint #150
- 2.x Use JetBrains grammar-kit to support the GraphQL language natively inside the IntelliJ platform
- No longer need a separate language service with its own eco-system to reduce complexity
- Will use graphql-java as a native dependency for validation and schema type APIs
- Possible now that graphql-java 8.0 added language support for SDL
- Tasks
- Validation
- Completion based on schema type info
Developer experience with 2.x
The biggest change with 2.x is making the GraphQL Schema Definition Language (often abbreviated SDL) a first-class citizen in the plugin and not just a read-only view of the schema.
SDL has become part of the spec in graphql/graphql-spec#90 and is already widely adopted by the community for schema authoring.
A widely used example is the Apollo project where the schema is expressed using SDL inside a gql tagged template literal (https://www.apollographql.com/docs/apollo-server/v2/essentials/server.html)
With this in mind, 2.x of the plugin will provide first-class tooling support for writing SDL, including:
- Completion on types when defining fields, arguments, implemented interfaces etc.
- Error highlighting of schema errors such as unknown types, wrong use of types, missing fields when implementing interfaces
- Find usages in SDL and refactoring such as rename which will update the relevant queries, mutations etc.
Any changes to the SDL type definitions will be immediately reflected in the relevant GraphQL queries and other operations within the given scope. This removes the manual step of having to either trigger an introspection query, or update a single combined .graphql schema file as required in 1.x of the plugin.
Overall, developers should be able to much more productive writing schema using SDL.
Documentation (work in progress)
https://gist.github.com/jimkyndemeyer/1903b65ff892f0811e76f16d8b530848