Skip to content

Fix LSP not loading .js and .ts files correctly#4180

Open
witoszekdev wants to merge 2 commits intographql:mainfrom
witoszekdev:fix/upgrade-graphql-config
Open

Fix LSP not loading .js and .ts files correctly#4180
witoszekdev wants to merge 2 commits intographql:mainfrom
witoszekdev:fix/upgrade-graphql-config

Conversation

@witoszekdev
Copy link
Copy Markdown

@witoszekdev witoszekdev commented Mar 25, 2026

This PR fixes issue in GraphQL LSP for projects that use graphql.config.ts or graphql.config.js files.

LSP relied on old version of graphql-config, which used cosmiconfig incorrectly by passing a default .js loader to cosmiconfigSync which in turn didn't await the promise and resolved the project's config as {}.

graphql-config 5.1.5+ fixes this by using createJiti for JS/TS loading instead of relying on cosmiconfig's default loaders.

Tested this change in NeoVim + Mason + graphql-language-service-cli on https://github.com/saleor/saleor-dashboard

Copilot AI review requested due to automatic review settings March 25, 2026 13:16
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 8052aaa

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

This PR includes changesets to release 5 packages
Name Type
graphql-language-service-server Patch
graphql-language-service Patch
vscode-graphql-execution Patch
graphql-language-service-cli Patch
codemirror-graphql Patch

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

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 25, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates graphql-config to a newer version to fix GraphQL LSP projects not correctly loading configuration from graphql.config.js / graphql.config.ts.

Changes:

  • Bump graphql-config from 5.0.3 to 5.1.5 across the LSP-related packages.
  • Refresh yarn.lock to reflect the updated graphql-config dependency graph.
  • Add a changeset to publish patch releases for affected packages.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/graphql-language-service-server/package.json Updates graphql-config dependency used by the LSP server.
packages/graphql-language-service/package.json Updates devDependency graphql-config used in local/dev workflows.
packages/vscode-graphql-execution/package.json Updates graphql-config dependency used by the VS Code execution extension.
yarn.lock Lockfile refresh for the new graphql-config and transitive dependency updates.
.changeset/green-lies-tap.md Declares patch releases for multiple packages related to this fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 50 to +52
"fast-glob": "^3.2.7",
"glob": "^7.2.0",
"graphql-config": "5.0.3",
"graphql-config": "5.1.5",
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

This PR relies on graphql-config@5.1.5 to fix loading graphql.config.{js,ts} files, but the existing test suite here appears to only exercise YAML/JSON configs (and _loadConfigOrSkip tests don’t validate JS/TS config parsing). Please add a regression test that loads an actual graphql.config.js and/or graphql.config.ts fixture and asserts the config is read correctly, to prevent this bug from returning on future dependency updates.

Copilot uses AI. Check for mistakes.
'graphql-language-service-server': patch
'graphql-language-service': patch
'vscode-graphql-execution': patch
'graphql-language-service-cli': patch
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The changeset marks graphql-language-service-cli for a patch release, but this PR doesn’t change that package (and it doesn’t directly depend on graphql-config). Consider removing it from the changeset, or update the CLI’s dependency constraints in a way that makes this release meaningful (e.g., if you intend to pin/bump graphql-language-service-server there).

Suggested change
'graphql-language-service-cli': patch

Copilot uses AI. Check for mistakes.
@witoszekdev
Copy link
Copy Markdown
Author

Not sure how to correctly bump version of graphql-language-service-cli since we will have fresh lockfile only after fixes for graphql-language-service are released

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.

2 participants