Performs GraphQL language service features with provided arguments from the command-line interface.
autocomplete
: returns GraphQL autocomplete suggestions at the cursor
location provided, or at the end of the query text.
outline
: returns GraphQL query outline information.
validate
: performs GraphQL query lint/validations and returns the results.
Query validation is only performed if a schema path is supplied.
Generated using TypeDoc
graphql-language-service-cli
We welcome your feedback and suggestions.
GraphQL Language Service provides an interface for building GraphQL language services for IDEs.
Almost 100% for Microsoft's Language Server Protocol is in place
Supported features include:
see more information at
graphql-language-service-server
Installation and Usage
Dependencies
An LSP-compatible client with a file watcher that sends watch notifications to the server.
DROPPED: GraphQL Language Service no longer depends on Watchman
Only node 9 or greater, and npm or yarn are required dependencies.
Installation
with
yarn
:with
npm
:either will install the
graphql-lsp
bin globallyGraphQL configuration file (
.graphqlrc.yml
)Check out graphql-config
The custom graphql language configurations are:
customDirectives
-['@myExampleDirective']
customValidationRules
- returns rules array with parameterValidationContext
fromgraphql/validation
LSP Workspace Configuration
When running
server
, your LSP-compatible client can provide additional workspace configuration.For example,
coc.nvim
allows for providing customsettings
this would allow for legacy
graphql-config
file formats like.graphqlconfig
, useful on projects maintaining compatibility with the intellij pluginUsing the command-line interface
The node executable contains several commands:
server
and the command-line language service methods (validate
,autocomplete
,outline
).CLI Options
Usage: graphql-lsp <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"