From 073212b173b41e23ead22973114c995ed3d46c17 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Fri, 22 Apr 2022 14:19:36 +0200 Subject: [PATCH] nvim: Enable native codelens --- config/nvim/nifoc/diagnostic.fnl | 16 +++++++++---- config/nvim/plugins/lsp.fnl | 4 +--- flake.lock | 24 +++++++++---------- programs/nvim/default.nix | 2 -- programs/nvim/plugins.nix | 41 ++++++++++++-------------------- programs/nvim/plugins.yaml | 1 - 6 files changed, 40 insertions(+), 48 deletions(-) diff --git a/config/nvim/nifoc/diagnostic.fnl b/config/nvim/nifoc/diagnostic.fnl index 2754e88..2a59ee0 100644 --- a/config/nvim/nifoc/diagnostic.fnl +++ b/config/nvim/nifoc/diagnostic.fnl @@ -18,9 +18,17 @@ (when (= vim.b.nifoc_lsp_enabled nil) (api.nvim_buf_set_var bufnr :nifoc_lsp_enabled 1) (keymap.lsp-attach client bufnr) - (api.nvim_create_autocmd [:CursorHold :CursorHoldI] - {:callback #(vim.diagnostic.open_float nil - {:focus false}) - :buffer bufnr}))) + (let [augroup (vim.api.nvim_create_augroup :NifocDiagnostic {:clear true}) + aucmd vim.api.nvim_create_autocmd] + (aucmd [:CursorHold :CursorHoldI] + {:callback (fn [] + (vim.diagnostic.open_float nil {:focus false}) + (vim.lsp.codelens.refresh)) + :buffer bufnr + :group augroup}) + (aucmd :InsertLeave {:callback #(vim.lsp.codelens.refresh) + :buffer bufnr + :group augroup})))) mod) + diff --git a/config/nvim/plugins/lsp.fnl b/config/nvim/plugins/lsp.fnl index 8f80d9d..e205cdb 100644 --- a/config/nvim/plugins/lsp.fnl +++ b/config/nvim/plugins/lsp.fnl @@ -1,7 +1,6 @@ (let [lsp (require :lspconfig) lsp-status (require :lsp-status) illuminate (require :illuminate) - virtual-types (require :virtualtypes) cmp (require :cmp_nvim_lsp) diagnostic (require :nifoc.diagnostic) formatting (require :nifoc.formatting)] @@ -10,8 +9,6 @@ (lsp-status.on_attach client bufnr)) (when client.server_capabilities.documentHighlightProvider (illuminate.on_attach client bufnr)) - (when client.server_capabilities.codeLensProvider - (virtual-types.on_attach client bufnr)) (diagnostic.maybe-enable-lsp client bufnr) (formatting.maybe-enable-lsp client bufnr)) @@ -76,3 +73,4 @@ :diagnostics {:globals [:vim]} :telemetry {:enable false}}}} (vim.tbl_extend :force default-config))))) + diff --git a/flake.lock b/flake.lock index 5d73e0d..1302f06 100644 --- a/flake.lock +++ b/flake.lock @@ -96,11 +96,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1650499578, - "narHash": "sha256-iJLetvUtr+NweIt3nbY8zO3NR70cyFBVUHYGViWSosI=", + "lastModified": 1650570367, + "narHash": "sha256-eCsF9CoqEXSECL5iFND11zBuYcd5DYdT1JnQZpQGFYI=", "owner": "neovim", "repo": "neovim", - "rev": "db851cb105ac9f295a836a39ff73da14a70ae754", + "rev": "6c8a3013ac8cbcbfc8b3e1d51f6491bfa0c4a7aa", "type": "github" }, "original": { @@ -119,11 +119,11 @@ ] }, "locked": { - "lastModified": 1650529029, - "narHash": "sha256-/BZThOlIN+Q/YgK2jf5k7l37XiHTnqD318sQpRu0/kU=", + "lastModified": 1650615499, + "narHash": "sha256-LVG9E/mDHCeBoAcvC8zV68FnfdI5GWFwWyFu86iagq8=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "edf6d999c74bf9772afd7c027e0d0a73bf033b4a", + "rev": "245a28697c7cfc18606c50f0d4f5baedd1dd59ea", "type": "github" }, "original": { @@ -154,11 +154,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1650527056, - "narHash": "sha256-dyBthjAs6JlNNDMi7SY+d2CirgBDqjG8SvZKeUvTLqM=", + "lastModified": 1650585041, + "narHash": "sha256-wZAZbkHwXKKdFTrDdKiFIvAtYOgQd3qO1jSSsaWlU84=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b06d35b406c2396dd1611dc8601138fa3d06ee60", + "rev": "f53f90b66921488fb3681ac78528ce407b775590", "type": "github" }, "original": { @@ -186,11 +186,11 @@ ] }, "locked": { - "lastModified": 1650501834, - "narHash": "sha256-ZBM6+zU/H5QfdB6W8x+wn1a4heAi4P2MtzbRcH3zXZA=", + "lastModified": 1650588250, + "narHash": "sha256-RvfHbRbZ7FcwCtdUrhpghaNdk5oUqs1MEEUdfifIkFI=", "owner": "arqv", "repo": "zig-overlay", - "rev": "fa32b66e4de51b3cd4018d50e8356ec3f0c1cf6b", + "rev": "79ad5ae65cab7033b9483fb53329ffd1be375484", "type": "github" }, "original": { diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index ec44193..b8d73bb 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -131,8 +131,6 @@ in type = "fennel"; } - virtual-types-nvim - # Linter { plugin = nvim-lint; diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index 08b7ef5..50e4c3f 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -47,12 +47,12 @@ }; yanky-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "yanky.nvim"; - version = "2022-04-06"; + version = "2022-04-22"; src = pkgs.fetchFromGitHub { owner = "gbprod"; repo = "yanky.nvim"; - rev = "1c96ef6d44f6d2a8a034f4eb242ddaa015674d1c"; - sha256 = "11bgjkr9kmx19j9waamlphf81k3spk672smbqirrnnwc0w4lvn3c"; + rev = "0155028360e3072fd4f49b58a0d35c6b45c9e64f"; + sha256 = "11gi69allx6v3c5szv3s98ism8xkir0p4dzpx0wmwyhl5bkafp36"; fetchSubmodules = false; }; }; @@ -102,12 +102,12 @@ }; nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-treesitter"; - version = "2022-04-21"; + version = "2022-04-22"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "bd2f5d770d0a98b1d89bb95dab7ca396b01ce1fe"; - sha256 = "0prs6b4r4bsy6799dwx4drxp2iakwj8cv5qbzgny2fis6zkrz5gf"; + rev = "3c50297eca950b4b1a7c07b28e586b0576c0a796"; + sha256 = "1jkrd5z85hsqg05br39pyv7sjpn2g3warg70s5arm0xxppc5m9pc"; fetchSubmodules = false; }; }; @@ -195,17 +195,6 @@ fetchSubmodules = false; }; }; - virtual-types-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "virtual-types.nvim"; - version = "2022-03-17"; - src = pkgs.fetchFromGitHub { - owner = "jubnzv"; - repo = "virtual-types.nvim"; - rev = "31da847fa54b801f309a08123935626adda4aaad"; - sha256 = "0kqg29xld064fz1xly1kc7wcyck62q5hjkb5fc5vrj0zdnrdzz22"; - fetchSubmodules = false; - }; - }; nvim-lint = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-lint"; version = "2022-04-18"; @@ -340,23 +329,23 @@ }; nvim-autopairs = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-autopairs"; - version = "2022-04-14"; + version = "2022-04-22"; src = pkgs.fetchFromGitHub { owner = "windwp"; repo = "nvim-autopairs"; - rev = "38d486a1c47ae2722a78cf569008de0a64f4b153"; - sha256 = "0qka37c8ikcqvbjq0n0kxgm8l30jy3aixs5i00a25wcwxj40kzxv"; + rev = "e9b47f0f681f94cedd8af671b363dd2497a22c5c"; + sha256 = "09hbgb233szzbjmrdmkz9znxa6wpi3n06zvq2g7kqzisz87fd8bw"; fetchSubmodules = false; }; }; nvim-ts-autotag = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-ts-autotag"; - version = "2022-03-04"; + version = "2022-04-22"; src = pkgs.fetchFromGitHub { owner = "windwp"; repo = "nvim-ts-autotag"; - rev = "57035b5814f343bc6110676c9ae2eacfcd5340c2"; - sha256 = "06fj3bpfakbzbb4saqa2dss0wz6z98farljv3xmih162qbybr2c1"; + rev = "044a05c4c51051326900a53ba98fddacd15fea22"; + sha256 = "0c94vnhl216p36x19cplhypr1b3z0f7l5jdr19hl79qvdfp9djk2"; fetchSubmodules = false; }; }; @@ -439,12 +428,12 @@ }; gitsigns-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "gitsigns.nvim"; - version = "2022-04-20"; + version = "2022-04-22"; src = pkgs.fetchFromGitHub { owner = "lewis6991"; repo = "gitsigns.nvim"; - rev = "f83a2e11cd7a486e92f3c6630e71e93a073a11da"; - sha256 = "05lpq5v6ss3wdk6m5pj9llgq31490khfscvrmcyi3cv48kqzhchi"; + rev = "f2243468ee14f69df48e7de61f866889df8b17a7"; + sha256 = "0lfbgwnc8i4q2qymswja9d4mwlgzzvrzzy5vwpjk4r4zzps7lrw3"; fetchSubmodules = false; }; }; diff --git a/programs/nvim/plugins.yaml b/programs/nvim/plugins.yaml index 83d8380..8fd07dd 100644 --- a/programs/nvim/plugins.yaml +++ b/programs/nvim/plugins.yaml @@ -37,7 +37,6 @@ # LSP - src: neovim/nvim-lspconfig -- src: jubnzv/virtual-types.nvim # Linter - src: mfussenegger/nvim-lint