nix-community.nixvim/plugins/nvim-lsp/lsp-lines.nix

41 lines
863 B
Nix
Raw Normal View History

2022-08-28 01:33:43 +01:00
{ pkgs, lib, config, ... }:
with lib;
let
cfg = config.plugins.lsp-lines;
2022-08-28 01:33:43 +01:00
helpers = import ../helpers.nix { lib = lib; };
in
{
options = {
plugins.lsp-lines = {
2022-08-28 01:33:43 +01:00
enable = mkEnableOption "lsp_lines.nvim";
2022-12-11 19:39:45 +00:00
currentLine = mkOption {
type = types.bool;
default = false;
description = "Show diagnostics only on current line";
};
2022-08-28 01:33:43 +01:00
};
};
config =
2022-12-11 19:39:45 +00:00
let
diagnosticConfig = {
virtual_text = false;
virtual_lines =
if cfg.currentLine then {
only_current_line = true;
} else true;
};
in
2022-08-28 01:33:43 +01:00
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lsp_lines-nvim ];
extraConfigLua = ''
do
require("lsp_lines").setup()
2022-12-11 19:39:45 +00:00
vim.diagnostic.config(${ helpers.toLuaObject diagnosticConfig })
2022-08-28 01:33:43 +01:00
end
'';
};
}