-
-
Notifications
You must be signed in to change notification settings - Fork 333
plugins/yaml-companion: init #3375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
565d9e2
to
269f224
Compare
There was a problem hiding this 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; |
There was a problem hiding this comment.
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."; |
There was a problem hiding this comment.
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.
plugins = { | ||
lsp.servers.yamlls.extraOptions = lib.nixvim.mkRaw "require('yaml-companion').setup(${lib.nixvim.toLuaObject cfg.settings})"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Should this be
extraOptions
orsettings
? - We should consider
plugins.lsp.servers.yamlls.enable = mkDefault true
here - We should also set the (new)
lsp.servers.yamlls.settings
option
Add support for yaml-companion.nvim, a plugin to get, set and autodetect YAML schemas in buffers.
Closes #3328