Merge pull request #70 from lvim-tech/main

Fix deprecated get_active_clients
This commit is contained in:
~hedy
2024-06-05 20:57:01 +08:00
committed by GitHub
3 changed files with 12 additions and 2 deletions

View File

@@ -349,6 +349,7 @@ function M.setup(opts)
_G._outline_nvim_has = { _G._outline_nvim_has = {
[8] = minor >= 8, [8] = minor >= 8,
[9] = minor >= 9, [9] = minor >= 9,
[10] = minor >= 10,
} }
cfg.setup(opts) cfg.setup(opts)

View File

@@ -35,7 +35,11 @@ local function get_appropriate_client(bufnr, capability)
local clients, use_client local clients, use_client
if _G._outline_nvim_has[8] then if _G._outline_nvim_has[8] then
clients = l.get_active_clients({ bufnr = bufnr }) if _G._outline_nvim_has[10] then
clients = l.get_clients({ bufnr = bufnr })
else
clients = l.get_active_clients({ bufnr = bufnr })
end
for _, client in ipairs(clients) do for _, client in ipairs(clients) do
if _check_client(client, capability) then if _check_client(client, capability) then
use_client = client use_client = client

View File

@@ -3,7 +3,12 @@ local config = require('outline.config')
local M = {} local M = {}
function M.is_buf_attached_to_lsp(bufnr) function M.is_buf_attached_to_lsp(bufnr)
local clients = vim.lsp.get_active_clients({ bufnr = bufnr or 0 }) local clients
if _G._outline_nvim_has[10] then
clients = vim.lsp.get_clients({ bufnr = bufnr or 0 })
else
clients = vim.lsp.get_active_clients({ bufnr = bufnr or 0 })
end
return clients ~= nil and #clients > 0 return clients ~= nil and #clients > 0
end end