diff --git a/nix/base-system/init.lua b/nix/base-system/init.lua index f826fbf..fd8b462 100644 --- a/nix/base-system/init.lua +++ b/nix/base-system/init.lua @@ -54,10 +54,15 @@ au BufNewFile,BufRead *.hrl filetype indent off --https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md +local caps = vim.tbl_deep_extend( + 'force', + vim.lsp.protocol.make_client_capabilities(), + {} +); + local lspconfig = require("lspconfig") -- Nix language server support -lspconfig.nil_ls.setup{{ -}} +lspconfig.nil_ls.setup{} local vim_pid = vim.fn.getpid() @@ -133,14 +138,23 @@ vim.api.nvim_create_autocmd('LspAttach', { end, opts) vim.keymap.set({"n", "v"}, "a", vim.lsp.buf.code_action, opts) vim.keymap.set("n", "f", vim.lsp.buf.format, opts) - -- We use F2 to rename things + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client.server_capabilities.codelens then + vim.lsp.codelens.refresh() + end end, }) -vim.api.nvim_create_autocmd({'LspAttach', 'BufEnter', 'InsertLeave', 'CursorHold'}, { - callback = function(ev) +vim.api.nvim_create_autocmd({'BufEnter', 'InsertLeave', 'CursorHold'}, { + callback = function(_) if vim.lsp.buf.server_ready() then - vim.lsp.codelens.refresh() + local clients = vim.lsp.get_active_clients() + for cid = 1, #clients do + if clients[cid].server_capabilities.codelens then + vim.lsp.codelens.refresh() + break + end + end end end, }) @@ -217,6 +231,7 @@ require('nvim-treesitter.configs').setup { max_file_lines = nil, }, --textobjects = { + -- enable = true, -- select = { -- enable = true, -- lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim @@ -355,12 +370,17 @@ end) -- Telelscope configuration local telescope = require('telescope') local telescope_builtins = require('telescope.builtin') ---local telescope_actions = require('telescope.actions') +local telescope_actions = require('telescope.actions') -- https://github.com/nvim-telescope/telescope.nvim telescope.setup({ defaults = { initial_mode = "normal", + mappings = { + n = { + ["ql"] = telescope_actions.send_selected_to_qflist + telescope_actions.open_qflist, + }, + }, }, }) @@ -375,3 +395,7 @@ vim.keymap.set("n", "rr", vim.lsp.codelens.run) -- Show whatever errors we have in our trouble pane vim.keymap.set("n", "se", "TroubleToggle", { silent = true, noremap = true }) + +-- logging +--vim.lsp.set_log_level("debug") +--vim.lsp.log.set_format_func(vim.inspect) diff --git a/nix/darwin/flake.lock b/nix/darwin/flake.lock index d0b3704..1a92986 100644 --- a/nix/darwin/flake.lock +++ b/nix/darwin/flake.lock @@ -34,12 +34,12 @@ }, "locked": { "lastModified": 1, - "narHash": "sha256-NrEKLtKqw6lOwfxz2f8OAScfVPzdsZz849sAceUrOk4=", - "path": "/nix/store/6s1z7nf9wb66a3gcx0fvjdbhm05bmcx4-source/nix/base-system", + "narHash": "sha256-zUkrSqkKiphniy9Dv8MJpsJKt4HMEoPIpoW6SQyzeOQ=", + "path": "/nix/store/f9c9966csi39qz43kg1j16w3phnkdj4d-source/nix/base-system", "type": "path" }, "original": { - "path": "/nix/store/6s1z7nf9wb66a3gcx0fvjdbhm05bmcx4-source/nix/base-system", + "path": "/nix/store/f9c9966csi39qz43kg1j16w3phnkdj4d-source/nix/base-system", "type": "path" } },