Support neovim < 0.10 for lsp.get_clients

This commit is contained in:
~hedy
2024-06-05 20:54:26 +08:00
parent e6afff238c
commit 193e03a7b7
3 changed files with 12 additions and 2 deletions

View File

@@ -3,7 +3,12 @@ local config = require('outline.config')
local M = {}
function M.is_buf_attached_to_lsp(bufnr)
local clients = vim.lsp.get_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
end