Skip to content

Conversation

@GaetanLepage
Copy link
Member

Add support for yaml-companion.nvim, a plugin to get, set and autodetect YAML schemas in buffers.

Closes #3328

@GaetanLepage GaetanLepage requested a review from MattSturgeon May 24, 2025 12:32
Copy link
Member

@MattSturgeon MattSturgeon left a comment

Choose a reason for hiding this comment

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

This plugin is very similar to https://github.com/nix-community/nixvim/blob/main/plugins/by-name/schemastore/default.nix, you may want to check how we handled things there

extraConfig = cfg: {
warnings = lib.nixvim.mkWarnings "plugins.yaml-companion" [
{
when = !config.plugins.lsp.enable;
Copy link
Member

Choose a reason for hiding this comment

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

This should support either lsp or plugins.lsp.

See example:

cfg.json.enable && !(config.plugins.lsp.servers.jsonls.enable || config.lsp.servers.jsonls.enable);

Note that lsp doesn't have an enable option, so we'd want to check the relevant server is enabled.

For plugins.lsp, we may want to mkDefault the relevant server. This warning may want to check the plugins.lsp.servers enable option too?

warnings = lib.nixvim.mkWarnings "plugins.yaml-companion" [
{
when = !config.plugins.lsp.enable;
message = "This plugin requires the `plugins.lsp.servers.yamlls` module to be enabled.";
Copy link
Member

Choose a reason for hiding this comment

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

Warning condition is checking plugins.lsp.enable, while the warning message is referencing plugins.lsp.servers.yamlls.

Ideally, we should use "${opt.foo.bar}", as interpolating an actual option will lead to the correctly prefixed option path being used, and it verifies that the option we're referencing actually exists. This is only possible when the option is in in the same level of module eval; i.e. we can't easily reference submodule suboptions.

Comment on lines +47 to +48
plugins = {
lsp.servers.yamlls.extraOptions = lib.nixvim.mkRaw "require('yaml-companion').setup(${lib.nixvim.toLuaObject cfg.settings})";
Copy link
Member

Choose a reason for hiding this comment

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

  1. Should this be extraOptions or settings?
  2. We should consider plugins.lsp.servers.yamlls.enable = mkDefault true here
  3. We should also set the (new) lsp.servers.yamlls.settings option

@jolars
Copy link
Contributor

jolars commented Aug 25, 2025

I see that this plugin was just recently archived.

This repository was archived by the owner on Aug 9, 2025. It is now read-only.

@GaetanLepage
Copy link
Member Author

Ok, let's close this PR then and the corresponding issue. Thanks @jolars.

@GaetanLepage GaetanLepage deleted the yaml-companion branch September 20, 2025 12:42
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.

[PLUGIN REQUEST] yaml-companion.nvim

3 participants