Skip to content

fix: allow custom settings of LSP-* packages in project schema - #3059

Merged
rwols merged 3 commits into
mainfrom
fix/project-schema-plugin-keys
Oct 10, 2026
Merged

rwols merged 3 commits into
mainfrom
fix/project-schema-plugin-keys

Conversation

@rchl

@rchl rchl commented Oct 9, 2026

Copy link
Copy Markdown
Member

Since #2765, project settings can override custom top-level settings of LSP-* packages (for example "binary" in LSP-clangd). The project schema still validated every settings.LSP.* key against the strict ClientConfig definition ("additionalProperties": false), so those settings were reported as Property binary is not allowed.

The package's own project schema (which defines those settings) doesn't help here: the JSON server combines schemas contributed by different packages with allOf, and each branch is validated independently, so LSP's branch can't know about properties defined by the package.

Changes:

  • Validate settings.LSP keys matching ^LSP- against the lenient LSP-plugin-base schema. Common settings are still validated and completed; package-specific settings are left to the schema contributed by the package. Other keys (servers defined in the project) keep using the strict ClientConfig.
  • Add tcp_port (the only ClientConfig property missing there) to LSP-plugin-base, through a shared ClientTcpPort definition.

Packages can opt-in to reporting unknown keys by combining LSP-plugin-base with their own definitions and "unevaluatedProperties": false:

"LSP-clangd": {
  "allOf": [
    { "$ref": "sublime://settings/LSP-plugin-base" },
    { "$ref": "sublime://settings/LSP-clangd#/definitions/PluginConfig" }
  ],
  "unevaluatedProperties": false
}

Checked with vscode-json-languageservice (6.0.0-next.2, as used by LSP-json):

File Before After
project with LSP-clangd β†’ binary/system_binary not allowed no diagnostics
project-only server with typo commnd not allowed not allowed
LSP-clangd override with "selector": 42 incorrect type incorrect type
LSP.sublime-settings client with "tcp_port": "nope" incorrect type incorrect type
LSP-clangd.sublime-settings with "tcp_port": "nope" not validated incorrect type

Project overrides of configurations provided by LSP-* packages were validated
against the strict ClientConfig schema which reported package-specific
top-level settings (for example "binary" in LSP-clangd) as not allowed.
Since project overrides of such settings are supported now, validate keys
matching "LSP-*" against the lenient LSP-plugin-base schema instead and
leave the package-specific settings to the schema contributed by the package.

Also add "tcp_port" to LSP-plugin-base through a shared definition.
Comment thread sublime-package.json Resolved
@rwols
rwols merged commit 4ae3b85 into main Oct 10, 2026
9 checks passed
@rwols
rwols deleted the fix/project-schema-plugin-keys branch October 10, 2026 13:37
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