lsp-lines: add currentLine option

This commit is contained in:
Pedro Alves 2022-12-11 19:39:45 +00:00
parent a7fbb81224
commit db8a2c0b97
2 changed files with 78 additions and 3 deletions

63
flake.lock generated
View file

@ -1,5 +1,27 @@
{
"nodes": {
"beautysh": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"poetry2nix": "poetry2nix",
"utils": "utils"
},
"locked": {
"lastModified": 1669854260,
"narHash": "sha256-Z8NAL3g4i5LAhxveNGJhrVDHxIBbUf1lVIy/Thr2RMU=",
"owner": "lovesegfault",
"repo": "beautysh",
"rev": "d616eb8d9d05ee4fb33de9c5521d99c3f0695d52",
"type": "github"
},
"original": {
"owner": "lovesegfault",
"repo": "beautysh",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
@ -45,12 +67,53 @@
"type": "gitlab"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": [
"beautysh",
"utils"
],
"nixpkgs": [
"beautysh",
"nixpkgs"
]
},
"locked": {
"lastModified": 1658665240,
"narHash": "sha256-/wkx7D7enyBPRjIkK0w7QxLQhzEkb3UxNQnjyc3FTUI=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "8b8edc85d24661d5a6d0d71d6a7011f3e699780f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"beautysh": "beautysh",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nmdSrc": "nmdSrc"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",

View file

@ -8,10 +8,24 @@ in
options = {
plugins.lsp-lines = {
enable = mkEnableOption "lsp_lines.nvim";
currentLine = mkOption {
type = types.bool;
default = false;
description = "Show diagnostics only on current line";
};
};
};
config =
let
diagnosticConfig = {
virtual_text = false;
virtual_lines =
if cfg.currentLine then {
only_current_line = true;
} else true;
};
in
mkIf cfg.enable {
extraPlugins = [ pkgs.vimPlugins.lsp_lines-nvim ];
@ -19,9 +33,7 @@ in
do
require("lsp_lines").setup()
vim.diagnostic.config({
virtual_text = false
})
vim.diagnostic.config(${ helpers.toLuaObject diagnosticConfig })
end
'';
};