Other Editors
GraphQL Analyzer’s LSP server works with any editor that supports the Language Server Protocol.
Generic setup
Section titled “Generic setup”- Install the
graphql-lspbinary (see Installation) - Configure your editor’s LSP client to:
- Launch
graphql-lspas the server command - Communicate via stdin/stdout
- Associate it with GraphQL file types (
.graphql,.gql) - Optionally associate it with TypeScript/JavaScript for embedded GraphQL
- Set the root directory to where
.graphqlrcis located
- Launch
LSP capabilities
Section titled “LSP capabilities”The server supports:
textDocument/didOpen— Load and validatetextDocument/didChange— Incremental updatestextDocument/didClose— Clean uptextDocument/didSave— Re-validatetextDocument/definition— Go to definitiontextDocument/references— Find referencestextDocument/hover— Hover informationtextDocument/completion— Autocomplete fields, fragments, typestextDocument/signatureHelp— Argument signaturestextDocument/publishDiagnostics— Real-time errorstextDocument/documentSymbol— Document outlineworkspace/symbol— Workspace-wide symbol searchtextDocument/semanticTokens— Semantic highlightingtextDocument/codeLens— Inline code informationtextDocument/foldingRange— Code foldingtextDocument/inlayHint— Inline type hintstextDocument/selectionRange— Smart selection expansiontextDocument/rename— Rename symbolstextDocument/codeAction— Quick fixesworkspace/didChangeWatchedFiles— React to file changesworkspace/executeCommand— Execute server-side commands
Running the server
Section titled “Running the server”# Standard mode (stdin/stdout)graphql-lsp
# With debug loggingRUST_LOG=debug graphql-lsp 2> lsp.logAdd to languages.toml:
[[language]]name = "graphql"language-servers = ["graphql-lsp"]
[language-server.graphql-lsp]command = "graphql-lsp"Zed has built-in LSP support. Add to your settings:
{ "lsp": { "graphql-lsp": { "binary": { "path": "graphql-lsp" } } }}