Note: As of 3.0.0, this package has been renamed from
graphql-language-service
tographql-language-service-cli
. please now use thegraphql-lsp
bin, instead of thegraphql
binary.
We welcome your feedback and suggestions.
GraphQL Language Service provides an interface for building GraphQL language services for IDEs.
Partial support for Microsoft's Language Server Protocol is in place, with more to come in the future.
Supported features include:
- Diagnostics (GraphQL syntax linting/validations) (spec-compliant)
- Autocomplete suggestions (spec-compliant)
- Hyperlink to fragment definitions and named types (type, input, enum) definitions (spec-compliant)
- Outline view support for queries
An LSP-compatible client with a file watcher that sends watch notifications to the server.
DROPPED: GraphQL Language Service no longer depends on Watchman
with yarn
:
yarn global add graphql-language-service-cli
with npm
:
npm i -g graphql-language-service-cli
Check out graphql-config
The graphql features we support are:
customDirectives
-['@myExampleDirective']
customValidationRules
- returns rules array with parameterValidationContext
fromgraphql/validation
;
The node executable contains several commands: server
and the command-line language service methods (validate
, autocomplete
, outline
).
Improving this list is a work-in-progress.
GraphQL Language Service Command-Line Interface.
Usage: bin/graphql.js <command> <file>
[-h | --help][-c | --configdir] {configDir}
[-t | --text] {textBuffer}
[-f | --file] {filePath}
[-s | --schema] {schemaPath}
Options:
-h, --help Show help [boolean]
-t, --text Text buffer to perform GraphQL diagnostics on.
Will defer to --file option if omitted.
Overrides the --file option, if any.
[string]
-f, --file File path to perform GraphQL diagnostics on.
Will be ignored if --text option is supplied.
[string]
--row A row number from the cursor location for GraphQL
autocomplete suggestions.
If omitted, the last row number will be used.
[number]
--column A column number from the cursor location for GraphQL
autocomplete suggestions.
If omitted, the last column number will be used.
[number]
-c, --configDir Path to the .graphqlrc.yml configuration file.
Walks up the directory tree from the provided config
directory, or the current working directory, until a
.graphqlrc is found or the root directory is found.
[string]
-s, --schemaPath a path to schema DSL file
[string]
At least one command is required.
Commands: "server, validate, autocomplete, outline"