plugins/lsp-lines: switch to mkNeovimPlugin

Remove custom options in favor of using `diagnostics` directly.
This commit is contained in:
Matt Sturgeon 2024-06-21 11:59:22 +01:00
parent 7c35bdb3f7
commit 7dcdd6e989
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 37 additions and 33 deletions

View file

@ -6,40 +6,35 @@
... ...
}: }:
with lib; with lib;
let helpers.neovim-plugin.mkNeovimPlugin config {
cfg = config.plugins.lsp-lines; name = "lsp-lines";
in luaName = "lsp_lines";
{ originalName = "lsp_lines.nvim";
options = { defaultPackage = pkgs.vimPlugins.lsp_lines-nvim;
plugins.lsp-lines = {
enable = mkEnableOption "lsp_lines.nvim";
package = helpers.mkPluginPackageOption "lsp_lines.nvim" pkgs.vimPlugins.lsp_lines-nvim; # This plugin has no settings; it is configured via vim.diagnostic.config
hasSettings = false;
currentLine = mkOption { maintainers = [ maintainers.MattSturgeon ];
type = types.bool;
default = false;
description = "Show diagnostics only on current line";
};
};
};
config = # TODO: Introduced 2024-06-25, remove after 24.11
let imports = [
diagnosticConfig = { (mkRenamedOptionModule
virtual_text = false; [
virtual_lines = if cfg.currentLine then { only_current_line = true; } else true; "plugins"
}; "lsp-lines"
in "currentLine"
mkIf cfg.enable { ]
extraPlugins = [ cfg.package ]; [
"diagnostics"
"virtual_lines"
"only_current_line"
]
)
];
extraConfigLua = '' extraConfig = cfg: {
do # Strongly recommended by the plugin, to avoid duplication.
require("lsp_lines").setup() diagnostics.virtual_text = mkDefault false;
vim.diagnostic.config(${helpers.toLuaObject diagnosticConfig})
end
'';
}; };
} }

View file

@ -2,4 +2,13 @@
empty = { empty = {
plugins.lsp-lines.enable = true; plugins.lsp-lines.enable = true;
}; };
example = {
plugins.lsp-lines.enable = true;
diagnostics.virtual_lines = {
only_current_line = true;
highlight_whole_line = false;
};
};
} }