From d9851db867de6aaec266b848ef6a31dc8f525494 Mon Sep 17 00:00:00 2001 From: Emily Marigold Klassen <760204+forivall@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:53:57 -0700 Subject: [PATCH 1/4] Fix error encountered running in helix --- .../graphql-language-service-server/src/MessageProcessor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphql-language-service-server/src/MessageProcessor.ts b/packages/graphql-language-service-server/src/MessageProcessor.ts index 3c616548ce2..87a751d53a3 100644 --- a/packages/graphql-language-service-server/src/MessageProcessor.ts +++ b/packages/graphql-language-service-server/src/MessageProcessor.ts @@ -213,7 +213,7 @@ export class MessageProcessor { // TODO: eventually we will instantiate an instance of this per workspace, // so rootDir should become that workspace's rootDir this._settings = { ...settings, ...vscodeSettings }; - const rootDir = this._settings?.load?.rootDir.length + const rootDir = this._settings?.load?.rootDir?.length ? this._settings?.load?.rootDir : this._rootPath; if (settings?.dotEnvPath) { From 923c693a8ddce69d1d8f18e9fba32b89b7ba3b4d Mon Sep 17 00:00:00 2001 From: Emily M Klassen Date: Wed, 29 Oct 2025 17:05:42 -0700 Subject: [PATCH 2/4] Add changeset --- .changeset/poor-terms-greet.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/poor-terms-greet.md diff --git a/.changeset/poor-terms-greet.md b/.changeset/poor-terms-greet.md new file mode 100644 index 00000000000..1b92d890d0a --- /dev/null +++ b/.changeset/poor-terms-greet.md @@ -0,0 +1,5 @@ +--- +'graphql-language-service-server': patch +--- + +Add missing `?.` operator in loading config From abf373abb92bb771fffb3cd1facabc3218477170 Mon Sep 17 00:00:00 2001 From: Emily M Klassen Date: Sat, 18 Apr 2026 11:34:15 -0700 Subject: [PATCH 3/4] Add proper settings type --- .../src/MessageProcessor.ts | 11 +++- .../src/types.ts | 58 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/packages/graphql-language-service-server/src/MessageProcessor.ts b/packages/graphql-language-service-server/src/MessageProcessor.ts index 87a751d53a3..82bced4caf4 100644 --- a/packages/graphql-language-service-server/src/MessageProcessor.ts +++ b/packages/graphql-language-service-server/src/MessageProcessor.ts @@ -66,7 +66,12 @@ import { LoaderNoResultError, ProjectNotFoundError, } from 'graphql-config'; -import type { LoadConfigOptions, LocateCommand } from './types'; +import type { + GraphQLConfigSettings, + LoadConfigOptions, + LocateCommand, + VSCodeGraphQLSettings, +} from './types'; import { DEFAULT_SUPPORTED_EXTENSIONS, SupportedExtensionsEnum, @@ -103,7 +108,7 @@ export class MessageProcessor { private _tmpDirBase: string; private _loadConfigOptions: LoadConfigOptions; private _rootPath: string = process.cwd(); - private _settings: any; + private _settings!: VSCodeGraphQLSettings & GraphQLConfigSettings; private _providedConfig?: GraphQLConfig; constructor({ @@ -224,7 +229,7 @@ export class MessageProcessor { this._rootPath = rootDir; this._loadConfigOptions = { ...Object.keys(this._settings?.load ?? {}).reduce((agg, key) => { - const value = this._settings?.load[key]; + const value = (this._settings?.load as Record)[key]; if (value === undefined || value === null) { delete agg[key]; } diff --git a/packages/graphql-language-service-server/src/types.ts b/packages/graphql-language-service-server/src/types.ts index 08e4d704afd..e482334d1c2 100644 --- a/packages/graphql-language-service-server/src/types.ts +++ b/packages/graphql-language-service-server/src/types.ts @@ -120,3 +120,61 @@ export interface ServerOptions { */ debug?: true; } + +/** Settings defined by the vscode-graphql's package.json, starting with `vscode-graphql` */ +export interface VSCodeGraphQLSettings { + /** + * Enable debug logs and node debugger for client + */ + debug?: boolean | null; + /** + * Use a cached file output of your graphql-config schema result for definition lookups, symbols, outline, etc. Enabled by default when one or more schema entry is not a local file with SDL in it. Disable if you want to use SDL with a generated schema. + */ + cacheSchemaFileForLookup?: boolean; + /** + * Disables outlining and other expensive operations for files larger than this threshold (in bytes). Defaults to 1000000 (one million). + */ + largeFileThreshold?: number; + /** + * Fail the request on invalid certificate + */ + rejectUnauthorized?: boolean; + /** + * Schema cache ttl in milliseconds - the interval before requesting a fresh schema when caching the local schema file is enabled. Defaults to 30000 (30 seconds). + */ + schemaCacheTTL?: number; + /** + * The transport used between the language server and the client. + */ + transport?: 'ipc' | 'stdio'; +} +export interface GraphQLConfigLoadSettings { + /** + * Base dir for graphql config loadConfig(), to look for config files or package.json + */ + rootDir?: string; + /** + * exact filePath for a `graphql-config` file `loadConfig()` + */ + filepath?: string; + /** + * optional .{js,ts,toml,yaml,json} in addition to default `graphql.config` `graphql{config,rc}` + */ + fileName?: string; + /** + * optional .config.{js,ts,toml,yaml,json} & rc* instead of default `graphql` + */ + configName?: string; + /** + * legacy mode for graphql config v2 config + */ + legacy?: boolean; +} +/** Settings defined by the vscode-graphql's package.json, starting with `graphql-config` */ +export interface GraphQLConfigSettings { + load?: GraphQLConfigLoadSettings & Record; + /** + * optional .env load file path, if not the default. specify a relative path to the .env file to be loaded by dotenv module. you can also import dotenv in the config file. + */ + dotEnvPath?: string; +} From 2230bf8e5e3e999333468b7fb021162b7f73fc15 Mon Sep 17 00:00:00 2001 From: Emily M Klassen Date: Sat, 18 Apr 2026 11:35:28 -0700 Subject: [PATCH 4/4] Remove unnecessary safe property access --- .../graphql-language-service-server/src/MessageProcessor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphql-language-service-server/src/MessageProcessor.ts b/packages/graphql-language-service-server/src/MessageProcessor.ts index 82bced4caf4..41549a3425c 100644 --- a/packages/graphql-language-service-server/src/MessageProcessor.ts +++ b/packages/graphql-language-service-server/src/MessageProcessor.ts @@ -219,7 +219,7 @@ export class MessageProcessor { // so rootDir should become that workspace's rootDir this._settings = { ...settings, ...vscodeSettings }; const rootDir = this._settings?.load?.rootDir?.length - ? this._settings?.load?.rootDir + ? this._settings.load.rootDir : this._rootPath; if (settings?.dotEnvPath) { require('dotenv').config({