fix: adapt to Nvim deprecations in 0.10 (#3109)

This commit is contained in:
Christian Clason
2024-05-17 14:39:12 +02:00
committed by GitHub
parent 96610122a4
commit bbdbb7593f
10 changed files with 34 additions and 17 deletions

View File

@@ -12,7 +12,7 @@ local log = require "telescope.log"
local Path = require "plenary.path"
local flatten = vim.tbl_flatten
local flatten = utils.flatten
local filter = vim.tbl_filter
local files = {}

View File

@@ -51,7 +51,7 @@ git.files = function(opts)
prompt_title = "Git Files",
__locations_input = true,
finder = finders.new_oneshot_job(
vim.tbl_flatten {
utils.flatten {
opts.git_command,
show_untracked and "--others" or nil,
recurse_submodules and "--recurse-submodules" or nil,
@@ -193,7 +193,7 @@ git.bcommits = function(opts)
local title = "Git BCommits"
local finder = finders.new_oneshot_job(
vim.tbl_flatten {
utils.flatten {
opts.git_command,
opts.current_file,
},
@@ -234,7 +234,7 @@ git.bcommits_range = function(opts)
local title = "Git BCommits in range"
local finder = finders.new_oneshot_job(
vim.tbl_flatten {
utils.flatten {
opts.git_command,
line_range,
},
@@ -432,7 +432,7 @@ end
local try_worktrees = function(opts)
local worktrees = conf.git_worktrees
if vim.tbl_islist(worktrees) then
if utils.islist(worktrees) then
for _, wt in ipairs(worktrees) do
if vim.startswith(opts.cwd, wt.toplevel) then
opts.toplevel = wt.toplevel

View File

@@ -793,7 +793,7 @@ end
internal.man_pages = function(opts)
opts.sections = vim.F.if_nil(opts.sections, { "1" })
assert(vim.tbl_islist(opts.sections), "sections should be a list")
assert(utils.islist(opts.sections), "sections should be a list")
opts.man_cmd = utils.get_lazy_default(opts.man_cmd, function()
local uname = vim.loop.os_uname()
local sysname = string.lower(uname.sysname)

View File

@@ -153,7 +153,7 @@ local function list_or_jump(action, title, params, opts)
end
local locations = {}
if not vim.tbl_islist(result) then
if not utils.islist(result) then
locations = { result }
end
vim.list_extend(locations, result)
@@ -393,7 +393,9 @@ lsp.dynamic_workspace_symbols = function(opts)
end
local function check_capabilities(method, bufnr)
local clients = vim.lsp.get_active_clients { bufnr = bufnr }
--TODO(clason): remove when dropping support for Nvim 0.9
local get_clients = vim.fn.has "nvim-0.10" and vim.lsp.get_clients or vim.lsp.get_active_clients
local clients = get_clients { bufnr = bufnr }
for _, client in pairs(clients) do
if client.supports_method(method, { bufnr = bufnr }) then