Provides GraphQL language support for CodeMirror 6, including syntax highlighting, autocompletion, linting, and schema-aware features. Current stable version is 0.2.1, actively maintained with frequent updates. Key differentiators: integrates deeply with GraphQL schema (introspection or SDL) for intelligent autocomplete and validation, leverages CodeMirror 6's modern extension system, and supports GraphQL.js v15, v16, and v17. Unlike generic language modes, it offers context-aware completions for fields, arguments, and directives based on the schema. Requires CodeMirror 6 extensions and the graphql package as peers.
npm install cm6-graphqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal setup: import GraphQL language extension, build a schema, and create an editor with basic setup and schema-aware autocomplete and linting.
Use named imports: import { graphql } from 'cm6-graphql'Pass schema or AsyncSchema to graphql()
Always provide a schema via graphql(schema) or graphqlSchema(schema)
Use graphql ^15.0.0 || ^16.0.0 || ^17.0.0
Use graphqlSchema with fetchSchema for introspection
Ensure @codemirror/* packages are all v6.x and lezer is up-to-date
npm install cm6-graphql
Use import { graphql } from 'cm6-graphql'Pass schema: graphql(schema) or use graphqlLanguage() if no schema needed
Ensure graphql package is installed: import { buildSchema } from 'graphql'