[FEATURE]: Allow to pass settings to the yaml-ls #8164

Open
opened 2026-02-16 18:09:18 -05:00 by yindo · 2 comments
Owner

Originally created by @nevmerzhitsky on GitHub (Jan 31, 2026).

Originally assigned to: @thdxr on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

We need the ability to tune any configuration option of the redhat-developer/yaml-language-server that used as YAML LSP in OpenCode. This package have no ability to read a config file or env variables (as I know). The suggested way to give access to this configuration is a support from the tool level that start the YAML LSP, thus I propose to add support of the settings via opencode.json, but in a non-strict mode to don't extend the JSON Schema of OpenCode too much.

Example, how the package is embedded to a VS Code extension: https://github.com/redhat-developer/vscode-yaml. Seems they are just map the extension settings to the LSP settings.

In case of OpenCode, I propose to add a sub-schema to the property lsp (https://opencode.ai/docs/lsp/). For example, one can use name "yaml-ls" to start to change default behavior of YAML LSP. This way conforms other places when we do override default settings in OpenCode config.

Well, example of proposed configuration:

{
  "$schema": "https://opencode.ai/config.json",
  "lsp": {
    "yaml-ls": {
      "yaml.format.enable": true,
      "yaml.format.singleQuote": true,
      "yaml.validate": true,
      "yaml.keyOrdering": true,
      "yaml.schemas": {
        "https://json.schemastore.org/composer": "/*",
        "kubernetes": "/myYamlFile.yaml"
      }
    }
  }
}

NB! I don't propose to remove the prefix yaml. prefix of the settings because not all settings of the YAML LSP is prefixed with yaml., e.g. editor.tabSize, http.proxy are also exist in the settings list.

Originally created by @nevmerzhitsky on GitHub (Jan 31, 2026). Originally assigned to: @thdxr on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request We need the ability to tune any configuration option of the `redhat-developer/yaml-language-server` that used as YAML LSP in OpenCode. This package have no ability to read a config file or env variables (as I know). The suggested way to give access to this configuration is a support from the tool level that start the YAML LSP, thus I propose to add support of the settings via `opencode.json`, but in a non-strict mode to don't extend the JSON Schema of OpenCode too much. Example, how the package is embedded to a VS Code extension: https://github.com/redhat-developer/vscode-yaml. Seems they are just map the extension settings to the LSP settings. In case of OpenCode, I propose to add a sub-schema to the property `lsp` (https://opencode.ai/docs/lsp/). For example, one can use name "yaml-ls" to start to change default behavior of YAML LSP. This way conforms other places when we do override default settings in OpenCode config. - List of all settings of the YAML LSP: https://github.com/redhat-developer/yaml-language-server?tab=readme-ov-file#language-server-settings - Location of OpenCode's codebase where the YAML LSP is invoked: https://github.com/anomalyco/opencode/blob/feca42b0255b5a099477ee7ce60b51eb5911a055/packages/opencode/src/lsp/server.ts#L1322 Well, example of proposed configuration: ```json { "$schema": "https://opencode.ai/config.json", "lsp": { "yaml-ls": { "yaml.format.enable": true, "yaml.format.singleQuote": true, "yaml.validate": true, "yaml.keyOrdering": true, "yaml.schemas": { "https://json.schemastore.org/composer": "/*", "kubernetes": "/myYamlFile.yaml" } } } } ``` NB! I don't propose to remove the prefix `yaml.` prefix of the settings because not all settings of the YAML LSP is prefixed with `yaml.`, e.g. `editor.tabSize`, `http.proxy` are also exist in the settings list.
yindo added the discussion label 2026-02-16 18:09:18 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 31, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #9573: Make command optional in lsp configuration - discusses LSP configuration optionality and customization of initialization options for language servers
  • #10978: lsp documentation needs enhancement - documents the lack of clear examples for LSP configuration with env and initialization properties

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 31, 2026): This issue might be a duplicate of existing issues. Please check: - #9573: Make command optional in lsp configuration - discusses LSP configuration optionality and customization of initialization options for language servers - #10978: lsp documentation needs enhancement - documents the lack of clear examples for LSP configuration with `env` and `initialization` properties Feel free to ignore if none of these address your specific case.
Author
Owner

@nevmerzhitsky commented on GitHub (Jan 31, 2026):

https://github.com/anomalyco/opencode/issues/10978: lsp documentation needs enhancement - documents the lack of clear examples for LSP configuration with env and initialization properties

This one is related a bit, but it is about documentation issue, not about how to configure the YAML LSP particularly.

@nevmerzhitsky commented on GitHub (Jan 31, 2026): > https://github.com/anomalyco/opencode/issues/10978: lsp documentation needs enhancement - documents the lack of clear examples for LSP configuration with env and initialization properties This one is related a bit, but it is about documentation issue, not about how to configure the YAML LSP particularly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8164