commit f89886dadce5f06b25a9fef4002b0bd8a1b1f12f
parent 25c02b342d75826490dcdf479bb47d8eadcdd299
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date: Fri, 26 Aug 2022 11:12:04 +0200
feat: use codelens
Diffstat:
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua
@@ -5,8 +5,8 @@ vim.diagnostic.config {
virtual_lines = false
}
-vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'solid' })
-vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'solid' })
+vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
+vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'single' })
local function on_attach(client, bufnr)
local function set_keymap(lhs, func, ...)
@@ -32,7 +32,9 @@ local function on_attach(client, bufnr)
-- See `:help vim.lsp.*` for documentation on any of the below functions
set_keymap('gD', vim.lsp.buf.implementation)
set_keymap('<Leader>d', vim.lsp.buf.definition)
- set_keymap('K', vim.lsp.buf.hover)
+ if client.server_capabilities.hoverProvider then
+ set_keymap('K', vim.lsp.buf.hover)
+ end
set_keymap('gr', vim.lsp.buf.rename)
set_keymap('<Leader>a', vim.lsp.buf.code_action)
set_keymap('[d', vim.diagnostic.goto_prev)
@@ -65,6 +67,10 @@ local function on_attach(client, bufnr)
set_autocmd("CursorMoved", vim.lsp.buf.clear_references)
end
+ if client.supports_method('textDocument/codeLens') then
+ set_autocmd({"BufEnter", "CursorHoldI", "InsertLeave"}, vim.lsp.codelens.refresh)
+ end
+
set_autocmd("CursorHold", function()
if not vim.diagnostic.config().virtual_lines then
vim.diagnostic.open_float { focusable = false, scope = 'line' }
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -60,10 +60,10 @@ return packer.startup(function(use)
config = function()
require('suit').setup({
input = {
- border = 'solid',
+ border = 'single',
},
select = {
- border = 'solid',
+ border = 'single',
},
})
end