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:
hedy
2023-11-16 15:41:37 +08:00
parent 22051b6555
commit 5278eb5b2b
6 changed files with 120 additions and 54 deletions

View File

@@ -1,9 +1,20 @@
-- NOTE
-- Our own markdown provider is used because legacy symbols-outline considered
-- the case where markdown does not have an LSP. However, it does, so as of now
-- this module is kept for use when user opens symbols outline before the
-- markdown LSP is ready. Please also see comment in providers/init.lua
-- markdown LSP is ready.
--
-- On buffer open the LSP may not be attached immediately. Before the LSP is
-- ready if the user opens the outline, our own markdown provider will be used.
-- After refreshing/reopening, the provider will then switch to the LSP (if the
-- user has a markdown LSP). That is, if the user has an applicable markdown LSP.
--
-- If they don't this provider will always work as usual.
local M = {
name = 'markdown',
}
local M = {}
---@return boolean ft_is_markdown
function M.should_use_provider(bufnr)