Add VSCode extension contributing GraphQLSP and GraphQL grammars#416
Open
JoviDeCroock wants to merge 3 commits into
Open
Add VSCode extension contributing GraphQLSP and GraphQL grammars#416JoviDeCroock wants to merge 3 commits into
JoviDeCroock wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 04a5d73 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
kitten
approved these changes
Jul 5, 2026
Adds packages/vscode-graphqlsp, a VSCode extension that: - contributes @0no-co/graphqlsp to the built-in TypeScript language features as a tsserver plugin, so projects get diagnostics, completions, hover info, and go-to-definition without installing the plugin locally - adds a TextMate grammar and language configuration for .graphql, .gql, and .graphqls files - adds an injection grammar highlighting GraphQL in gql`...` and graphql`...` tagged templates, gql(`...`)/graphql(`...`) call expressions, and untagged templates starting with #graphql - forwards graphqlsp.* editor settings to the plugin via the TS extension's configurePlugin API The plugin itself now detects being loaded as a "global" tsserver plugin without configuration and passes the language service through untouched, so the extension doesn't surface configuration errors in projects that never set up GraphQLSP. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The extension is already skipped as a private package, but this makes the exclusion explicit and robust: - list vscode-graphqlsp in the changesets ignore list, so neither changesets nor stage-packages ever considers it - skip .staging directories in the release scripts' workspace walkers; the extension's vsix staging area contains a copy of its manifest with the private flag stripped Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
c5a636b to
01638a8
Compare
…gin instances
An editor-contributed ("global") GraphQLSP instance now resolves its
configuration per project instead of blindly using editor settings,
preventing conflicts between the two config sources:
- defer entirely when the project already runs a local GraphQLSP
instance, detected via a Symbol.for marker on the language service
proxy that survives separate module copies and covers
gql.tada/ts-plugin
- adopt the project's tsconfig plugins entry when it exists but
produced no instance (e.g. the package isn't installed locally)
- fall back to editor settings passed through configurePlugin, which
the extension now always tags with editorContributed
- stay dormant when nothing is configured
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
packages/vscode-graphqlsp, a VSCode extension for GraphQLSP:@0no-co/graphqlspto VSCode's built-in TypeScript language features via thetypescriptServerPluginscontribution point (enableForWorkspaceTypeScriptVersions: true). Projects listing the plugin in theirtsconfig.jsonkeep their configuration and no longer need the plugin in their ownnode_modules— tsserver resolves it from the extension's bundled copy via plugin probe locations. tsserver skips the global copy when a project plugin with the same name exists, so nothing loads twice..graphql/.gql/.graphqlsfiles (operations, fragments, SDL, variables, directives, string/comment rules, etc.).gql`...`/graphql`...`tagged templates,gql(`...`)/graphql(`...`)/graphql.persisted(`...`)call expressions, and untagged templates starting with a#graphqlcomment.${...}interpolations fall back to TypeScript expression highlighting.graphqlsp.*editor settings mirror the plugin options and are forwarded through the TS extension'sconfigurePluginAPI for projects that don't configure the plugin intsconfig.json; the extension offers a TS server restart when they change.Plugin change
@0no-co/graphqlspnow detects being loaded as a global tsserver plugin (tsserver marks those config entries withglobal: true) without anyschema/schemasconfiguration, and passes the language service through untouched. Without this, the editor-contributed plugin would surface "missing schema" configuration errors in every project that never set up GraphQLSP. Covered by a changeset (minor).Packaging
pnpm --filter vscode-graphqlsp packagebuilds a.vsix(verified: 1.09 MB). Since vsce can't package pnpm's symlinkednode_modules, the script stages the extension with an npm-installed tarball of the workspace's graphqlsp, strips thetypescriptpeer ranges (tsserver provides it at runtime; bundling it would add 23 MB), and runsvsce packagethere.@vscode/vsce's install scripts (keytar,@vscode/vsce-sign) are denied inpnpm-workspace.yaml— they only matter for marketplace publishing.Test plan
pnpm build(rollup) andpnpm --filter vscode-graphqlsp build(tsc) pass#graphqlmarkers, and${...}substitutions all tokenize as intended.vsixpackaging verified end-to-end; bundle contains the plugin,graphql, and@gql.tada/internal, and notypescriptpackages/vscode-graphqlspin VSCode, F5 → Extension Development Host, openpackages/example(tsconfig-configured project) to see diagnostics/hovers; TS server log shows[GraphQLSP]entries🤖 Generated with Claude Code