From db8a2c0b97cbbfbdb43b0e6909f38f83d1600e4e Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sun, 11 Dec 2022 19:39:45 +0000 Subject: [PATCH] lsp-lines: add currentLine option --- flake.lock | 63 ++++++++++++++++++++++++++++++++++ plugins/nvim-lsp/lsp-lines.nix | 18 ++++++++-- 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index cc4141f4..96a9886f 100644 --- a/flake.lock +++ b/flake.lock @@ -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", diff --git a/plugins/nvim-lsp/lsp-lines.nix b/plugins/nvim-lsp/lsp-lines.nix index 54ece053..e415b469 100644 --- a/plugins/nvim-lsp/lsp-lines.nix +++ b/plugins/nvim-lsp/lsp-lines.nix @@ -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 ''; };