- 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)
44 lines
994 B
Lua
44 lines
994 B
Lua
local cfg = require "outline.config"
|
|
|
|
local M = {}
|
|
local import_prefix = "outline/providers/"
|
|
|
|
_G._outline_current_provider = nil
|
|
|
|
|
|
function M.find_provider()
|
|
if not M.providers then
|
|
M.providers = vim.tbl_map(function(p) return import_prefix..p end, cfg.get_providers())
|
|
end
|
|
for _, name in ipairs(M.providers) do
|
|
local provider = require(name)
|
|
if provider.should_use_provider(0) then
|
|
return provider, name
|
|
end
|
|
end
|
|
return nil, nil
|
|
end
|
|
|
|
---@return boolean found_provider
|
|
function M.has_provider()
|
|
return M.find_provider() ~= nil
|
|
end
|
|
|
|
---@param on_symbols function
|
|
---@param opts outline.OutlineOpts?
|
|
---@return boolean found_provider
|
|
function M.request_symbols(on_symbols, opts)
|
|
local provider, name = M.find_provider()
|
|
if not provider then
|
|
return false
|
|
end
|
|
_G._outline_current_provider = provider
|
|
if not provider.name then
|
|
_G._outline_current_provider.name = name
|
|
end
|
|
provider.request_symbols(on_symbols, opts)
|
|
return true
|
|
end
|
|
|
|
return M
|