diff options
author | Abouzar Parvan <[email protected]> | 2022-09-20 14:11:58 +0430 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-20 14:11:58 +0430 |
commit | 518b1d4167162a54a6e76784038d30191613b76d (patch) | |
tree | 6007451a5e1f77db9ee116ee1a262c8f0639115d /lua/lvim/lsp | |
parent | 03ec31253fc868b3ab5a8217640ec04248ae0046 (diff) |
Fix: make sure latest plugins are customizable (#3044)
* fix: make navim-navic configurable
* fix: make sure vim-illuminate is configurable
* fix: make sure theme is configurable
* fix(ci): don't verify uninstalled plugins
* refactor(lsp): add setup_document_symbols util
* revert: keep onedarker on freeze branch
* refactor(lsp): avoid duplicate hl autocmds
Co-authored-by: kylo252 <[email protected]>
Diffstat (limited to 'lua/lvim/lsp')
-rw-r--r-- | lua/lvim/lsp/config.lua | 2 | ||||
-rw-r--r-- | lua/lvim/lsp/handlers.lua | 3 | ||||
-rw-r--r-- | lua/lvim/lsp/init.lua | 11 | ||||
-rw-r--r-- | lua/lvim/lsp/utils.lua | 18 |
4 files changed, 23 insertions, 11 deletions
diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 7e91db52..d842f099 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -72,7 +72,7 @@ return { end, }, }, - document_highlight = true, + document_highlight = false, code_lens_refresh = true, float = { focusable = true, diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 45b1989d..81342885 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -12,6 +12,9 @@ function M.setup() float = lvim.lsp.diagnostics.float, } vim.diagnostic.config(config) + if not lvim.builtin.illuminate.active then + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float) + end vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float) end diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index ac3f6925..1072329b 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -60,15 +60,6 @@ function M.common_on_init(client, bufnr) end end -local function attach_navic(client, bufnr) - vim.g.navic_silence = true - local status_ok, navic = pcall(require, "nvim-navic") - if not status_ok then - return - end - navic.attach(client, bufnr) -end - function M.common_on_attach(client, bufnr) if lvim.lsp.on_attach_callback then lvim.lsp.on_attach_callback(client, bufnr) @@ -83,7 +74,7 @@ function M.common_on_attach(client, bufnr) end add_lsp_buffer_keybindings(bufnr) add_lsp_buffer_options(bufnr) - attach_navic(client, bufnr) + lu.setup_document_symbols(client, bufnr) end function M.get_common_opts() diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 3be7e52f..c2ffe3fa 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -1,6 +1,7 @@ local M = {} local tbl = require "lvim.utils.table" +local Log = require "lvim.core.log" function M.is_client_active(name) local clients = vim.lsp.get_active_clients() @@ -82,6 +83,10 @@ function M.get_all_supported_filetypes() end function M.setup_document_highlight(client, bufnr) + if lvim.builtin.illuminate.active then + Log:debug "skipping setup for document_highlight, illuminate already active" + return + end local status_ok, highlight_supported = pcall(function() return client.supports_method "textDocument/documentHighlight" end) @@ -114,6 +119,19 @@ function M.setup_document_highlight(client, bufnr) }) end +function M.setup_document_symbols(client, bufnr) + vim.g.navic_silence = false -- can be set to true to supress error + local symbols_supported = client.supports_method "textDocument/documentSymbol" + if not symbols_supported then + Log:debug("skipping setup for document_symbols, method not supported by " .. client.name) + return + end + local status_ok, navic = pcall(require, "nvim-navic") + if status_ok then + navic.attach(client, bufnr) + end +end + function M.setup_codelens_refresh(client, bufnr) local status_ok, codelens_supported = pcall(function() return client.supports_method "textDocument/codeLens" |