Skip to content

feat(graphql-language-service): support GraphQL 17 fragment arguments - #4462

Merged
trevor-scheer merged 5 commits into
graphql:mainfrom
JoviDeCroock:fragment-arguments-v17
Aug 30, 2026
Merged

feat(graphql-language-service): support GraphQL 17 fragment arguments#4462
trevor-scheer merged 5 commits into
graphql:mainfrom
JoviDeCroock:fragment-arguments-v17

Conversation

@JoviDeCroock

@JoviDeCroock JoviDeCroock commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Revives #3761 now that GraphQL.js 17 ships experimental fragment argument support.

What changed

  • parse fragment variable definitions and fragment spread arguments in the online parser
  • enable GraphQL.js 17's experimentalFragmentArguments parser option across diagnostics, outlines, operation facts, fragment dependencies, document mode detection, and external fragments
  • resolve fragment variable definitions into language-service type information
  • autocomplete fragment argument names and values, including incomplete documents and external fragments
  • keep variable completion scope-aware across operations and fragments, including fragment-local shadowing and transitively reachable operations
  • show fragment argument type hover information
  • validate fragment arguments with GraphQL.js 17's specified rules
  • add a dedicated GraphQL 17 CI job and a release changeset

@changeset-bot

changeset-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a3088a5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
graphql-language-service Minor
graphql-language-service-server Minor
monaco-graphql Minor
@graphiql/react Minor
graphiql Minor
codemirror-graphql Patch
cm6-graphql Patch
@graphiql/plugin-code-exporter Major
@graphiql/plugin-doc-explorer Major
@graphiql/plugin-explorer Major
@graphiql/plugin-history Major

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

@trevor-scheer trevor-scheer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoviDeCroock neat! I haven't taken a full pass yet but I'm hoping to get to it this week.

What are your thoughts on making this functionality opt-in, default false for now? Given it's still experimental, it'd be a bit misleading if the editor experience validated and suggested language constructs that aren't going to be supported by most servers.

Is it accurate that this feature still needs a champion or is the PR title dated? Definitely promising to see that there's action on it / support built in to v17.
graphql/graphql-spec#1224

@JoviDeCroock

JoviDeCroock commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Yes, I abandonned championing due to time constraints and admittedly not knowing how to progress anything smoothly nowadays 😅 not sure how yall do validation of optional stuff, because it depends on both server and client support. Which comes down to the capabilities specification which is still in progress.

@trevor-scheer

trevor-scheer commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

@JoviDeCroock I completely understand!

not sure how yall do validation of optional stuff, because it depends on both server and client support

Can you help me understand the question? You're right, without a capabilities handshake it just needs to be manual and user-facing for now. I guess I'm just suggesting a way for users to explicitly opt-in to this experimental feature instead of having it always on. So, something like:

  • an experimental config flag at the language service boundary
  • a user setting / checkbox in vscode extension to enable
  • a user setting (+ a code/prop override?) for GraphiQL

@JoviDeCroock

Copy link
Copy Markdown
Contributor Author

The feature gate made this PR scope explode a bit 😅 apologies... In a later stage we could automatically derive this from the endpoint-capabilities when this passes the spec

@trevor-scheer

Copy link
Copy Markdown
Contributor

@JoviDeCroock no worries, it was at my request so...thanks! I should be able to find time this week for a real review.

@trevor-scheer trevor-scheer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great overall!

Comment thread packages/graphql-language-service/src/utils/getOperationFacts.ts
@trevor-scheer

Copy link
Copy Markdown
Contributor

Thanks @JoviDeCroock!

@trevor-scheer
trevor-scheer merged commit 1cb7eba into graphql:main Aug 30, 2026
14 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 30, 2026
trevor-scheer pushed a commit that referenced this pull request Aug 30, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## graphiql@5.4.0

### Minor Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

### Patch Changes

- Updated dependencies
[[`65867b5`](65867b5),
[`6d57aad`](6d57aad),
[`1cb7eba`](1cb7eba)]:
  - @graphiql/react@0.39.0
  - @graphiql/plugin-doc-explorer@0.4.4
  - @graphiql/plugin-history@0.4.4
## @graphiql/react@0.39.0

### Minor Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

### Patch Changes

- [#4468](#4468)
[`65867b5`](65867b5)
Thanks [@therealyo](https://github.com/therealyo)! - Keep the active tab
selected when a tab to its right is closed. `closeTab` decremented
`activeTabIndex` unconditionally, without comparing it to the index of
the closed tab.
Closing a tab positioned after the active one does not shift the active
tab
  Closing the active tab, or a tab before it, is unchanged.

- [#4476](#4476)
[`6d57aad`](6d57aad)
Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Fix an
extra empty tab being created on reload. The
`query`/`variables`/`headers` storage keys are only written on edit, so
reloading a session that never touched the editors found no stored
editor state matching any tab and pushed a new empty one.

- Updated dependencies
[[`d0a34f4`](d0a34f4),
[`1cb7eba`](1cb7eba),
[`296214d`](296214d)]:
  - graphql-language-service@5.7.0
  - monaco-graphql@1.9.0
## graphql-language-service@5.7.0

### Minor Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

### Patch Changes

- [#4466](#4466)
[`d0a34f4`](d0a34f4)
Thanks [@glen-84](https://github.com/glen-84)! - Anchor validation
diagnostics at the highlighted node's own position, so the range for an
unknown aliased field covers the field name rather than the alias, and
the range for an unknown directive covers its name rather than starting
at the `@`.

- [#4356](#4356)
[`296214d`](296214d)
Thanks [@DukeDeSouth](https://github.com/DukeDeSouth)! - Wrap
autocompleted list input values in square brackets

When you complete an enum or boolean value for a list-typed argument or
input field (e.g. `[Episode]`), the suggestion now inserts `[JEDI]`
instead of a bare `JEDI`, which produced an invalid query. Values
completed inside an existing list literal, and non-list values, are left
as they were.
## graphql-language-service-server@2.15.0

### Minor Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

### Patch Changes

- Updated dependencies
[[`d0a34f4`](d0a34f4),
[`1cb7eba`](1cb7eba),
[`296214d`](296214d)]:
  - graphql-language-service@5.7.0
## monaco-graphql@1.9.0

### Minor Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

### Patch Changes

- Updated dependencies
[[`d0a34f4`](d0a34f4),
[`1cb7eba`](1cb7eba),
[`296214d`](296214d)]:
  - graphql-language-service@5.7.0
## cm6-graphql@0.2.2

### Patch Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

- Updated dependencies
[[`d0a34f4`](d0a34f4),
[`1cb7eba`](1cb7eba),
[`296214d`](296214d)]:
  - graphql-language-service@5.7.0
## codemirror-graphql@2.2.9

### Patch Changes

- [#4462](#4462)
[`1cb7eba`](1cb7eba)
Thanks [@JoviDeCroock](https://github.com/JoviDeCroock)! - Add opt-in
GraphQL 17 fragment argument syntax support to parsing, validation,
type information, autocomplete, hover, and editor integrations. Enable
it with
`experimentalFragmentArguments: true`; it defaults to `false` until
server
  capabilities can advertise support.

Also fix variable autocomplete to respect operation and fragment scope
while
  including variables from operations that spread the current fragment.

- Updated dependencies
[[`d0a34f4`](d0a34f4),
[`1cb7eba`](1cb7eba),
[`296214d`](296214d)]:
  - graphql-language-service@5.7.0
## @graphiql/plugin-code-exporter@5.1.4

### Patch Changes

- Updated dependencies
[[`65867b5`](65867b5),
[`6d57aad`](6d57aad),
[`1cb7eba`](1cb7eba)]:
  - @graphiql/react@0.39.0
## @graphiql/plugin-doc-explorer@0.4.4

### Patch Changes

- Updated dependencies
[[`65867b5`](65867b5),
[`6d57aad`](6d57aad),
[`1cb7eba`](1cb7eba)]:
  - @graphiql/react@0.39.0
## @graphiql/plugin-explorer@5.1.5

### Patch Changes

- Updated dependencies
[[`65867b5`](65867b5),
[`6d57aad`](6d57aad),
[`1cb7eba`](1cb7eba)]:
  - @graphiql/react@0.39.0
## @graphiql/plugin-history@0.4.4

### Patch Changes

- Updated dependencies
[[`65867b5`](65867b5),
[`6d57aad`](6d57aad),
[`1cb7eba`](1cb7eba)]:
  - @graphiql/react@0.39.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@JoviDeCroock

Copy link
Copy Markdown
Contributor Author

@trevor-scheer Thank you so much for merging this, I hope this enables the next champion to finally get all of this over the line. You're a hero mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants