From 518b1d4167162a54a6e76784038d30191613b76d Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 20 Sep 2022 14:11:58 +0430 Subject: 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 <59826753+kylo252@users.noreply.github.com> --- lua/lvim/lsp/utils.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lua/lvim/lsp/utils.lua') 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" -- cgit v1.2.3