feat: Better provider info and fix LSP deprecated warnings
- Provider priorities can now be configured through `providers.priority` - Each provider can have a get_status() function that returns a string for its status. For LSP it returns the client name. - :OutlineStatus logic refactored, together with provider checking functions in `providers/init.lua` - Switch from vim.lsp.buf_get_clients to vim.lsp.get_active_clients (former was deprecated) - Fixed a careless mistake from symbols-outline that seems to be an unreachable bug (lsp)
This commit is contained in:
@@ -71,6 +71,7 @@ M.defaults = {
|
||||
up_and_jump = '<C-k>',
|
||||
},
|
||||
providers = {
|
||||
priority = { 'lsp', 'coc', 'markdown' },
|
||||
lsp = {
|
||||
blacklist_clients = {},
|
||||
},
|
||||
@@ -182,14 +183,35 @@ function M.is_symbol_blacklisted(kind)
|
||||
return has_value(M.o.symbols.blacklist, kind)
|
||||
end
|
||||
|
||||
function M.is_client_blacklisted(client_id)
|
||||
local client = vim.lsp.get_client_by_id(client_id)
|
||||
---@param client vim.lsp.client|number
|
||||
function M.is_client_blacklisted(client)
|
||||
if not client then
|
||||
return false
|
||||
end
|
||||
if type(client) == 'number' then
|
||||
client = vim.lsp.get_client_by_id(client)
|
||||
if not client then
|
||||
return false
|
||||
end
|
||||
end
|
||||
return has_value(M.o.providers.lsp.blacklist_clients, client.name)
|
||||
end
|
||||
|
||||
function M.get_providers()
|
||||
if M.providers then
|
||||
return M.providers
|
||||
end
|
||||
|
||||
M.providers = {}
|
||||
for _, p in ipairs(M.o.providers.priority) do
|
||||
if p == 'lsp' then
|
||||
p = 'nvim-lsp' -- due to legacy reasons
|
||||
end
|
||||
table.insert(M.providers, p)
|
||||
end
|
||||
return M.providers
|
||||
end
|
||||
|
||||
function M.show_help()
|
||||
print 'Current keymaps:'
|
||||
print(vim.inspect(M.o.keymaps))
|
||||
|
||||
Reference in New Issue
Block a user