Add GraphQL LSP server support #6733

Open
opened 2026-02-16 18:05:05 -05:00 by yindo · 0 comments
Owner

Originally created by @sandiiarov on GitHub (Jan 18, 2026).

Originally assigned to: @thdxr on GitHub.

Feature Request

Add GraphQL Language Server Protocol (LSP) support to OpenCode to provide IDE-like features for GraphQL projects.

Problem

Currently, OpenCode doesn't have dedicated GraphQL LSP support. While Biome can handle .graphql/.gql files, it only provides linting - not the full LSP experience (autocomplete, hover info, go-to-definition, diagnostics against schema).

Proposed Solution

Add built-in GraphQL LSP server using graphql-language-service-cli (the official GraphQL LSP implementation) to provide:

  • Diagnostics for GraphQL syntax linting and validation (spec-compliant)
  • Autocomplete suggestions for fields, arguments, types, and variables
  • Hover information showing field descriptions
  • Go-to-definition for types, inputs, enums, and fragment definitions
  • Support for inline GraphQL in JavaScript/TypeScript/Vue/Svelte/Astro files

Technical Details

  • LSP Server: graphql-language-service-cli (provides graphql-lsp binary)
  • Command: server -m stream (stream mode for LSP stdio communication)
  • Extensions: .graphql, .gql (standalone) + .ts, .tsx, .js, .jsx, .vue, .svelte, .astro (inline)
  • Detection: Auto-detect via presence of GraphQL config files:
    • .graphqlrc.* (all formats: .yml, .yaml, .json, .js, .cjs, .mjs)
    • graphql.config.* (all formats: .yml, .yaml, .json, .js, .cjs, .mjs)
  • Auto-installation: Install graphql-language-service-cli globally via bun if not found
  • Coexistence: Works alongside Biome and other LSPs without conflicts

References

Originally created by @sandiiarov on GitHub (Jan 18, 2026). Originally assigned to: @thdxr on GitHub. ## Feature Request Add GraphQL Language Server Protocol (LSP) support to OpenCode to provide IDE-like features for GraphQL projects. ## Problem Currently, OpenCode doesn't have dedicated GraphQL LSP support. While Biome can handle .graphql/.gql files, it only provides linting - not the full LSP experience (autocomplete, hover info, go-to-definition, diagnostics against schema). ## Proposed Solution Add built-in GraphQL LSP server using `graphql-language-service-cli` (the official GraphQL LSP implementation) to provide: - Diagnostics for GraphQL syntax linting and validation (spec-compliant) - Autocomplete suggestions for fields, arguments, types, and variables - Hover information showing field descriptions - Go-to-definition for types, inputs, enums, and fragment definitions - Support for inline GraphQL in JavaScript/TypeScript/Vue/Svelte/Astro files ## Technical Details - **LSP Server**: `graphql-language-service-cli` (provides `graphql-lsp` binary) - **Command**: `server -m stream` (stream mode for LSP stdio communication) - **Extensions**: `.graphql`, `.gql` (standalone) + `.ts`, `.tsx`, `.js`, `.jsx`, `.vue`, `.svelte`, `.astro` (inline) - **Detection**: Auto-detect via presence of GraphQL config files: - `.graphqlrc.*` (all formats: .yml, .yaml, .json, .js, .cjs, .mjs) - `graphql.config.*` (all formats: .yml, .yaml, .json, .js, .cjs, .mjs) - **Auto-installation**: Install `graphql-language-service-cli` globally via bun if not found - **Coexistence**: Works alongside Biome and other LSPs without conflicts ## References - Official GraphQL LSP: https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-cli - Similar to existing TailwindCSS LSP support (#9303)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6733