mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 17:24:32 +02:00
plugins/lsp-lines: switch to mkNeovimPlugin
Remove custom options in favor of using `diagnostics` directly.
This commit is contained in:
parent
7c35bdb3f7
commit
7dcdd6e989
2 changed files with 37 additions and 33 deletions
|
@ -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
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue