Note: This package will soon be renamed to graphql-language-service-cli
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 it's own file watcher, that sends watch notifications to the server.
DROPPED: GraphQL Language Service no longer depends on Watchman
git clone [email protected]:graphql/graphql-language-service.git
cd {path/to/your/repo}
npm install ../graphql-language-service
After pulling the latest changes from this repo, be sure to run yarn run build
to transform the src/
directory and generate the dist/
directory.
The library includes a node executable file which you can find in ./node_modules/.bin/graphql.js
after installation.
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 a 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"