summaryrefslogtreecommitdiff
path: root/lua/lvim/lsp/utils.lua
diff options
context:
space:
mode:
authorAbouzar Parvan <[email protected]>2022-09-20 14:11:58 +0430
committerGitHub <[email protected]>2022-09-20 14:11:58 +0430
commit518b1d4167162a54a6e76784038d30191613b76d (patch)
tree6007451a5e1f77db9ee116ee1a262c8f0639115d /lua/lvim/lsp/utils.lua
parent03ec31253fc868b3ab5a8217640ec04248ae0046 (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/utils.lua')
-rw-r--r--lua/lvim/lsp/utils.lua18
1 files changed, 18 insertions, 0 deletions
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"