refactor(#2787): use inline deprecation disabling

This commit is contained in:
Alexander Courtis
2024-06-01 16:17:58 +10:00
parent 459f73362b
commit a5f1b867bd
5 changed files with 7 additions and 14 deletions

View File

@@ -31,8 +31,7 @@ function M.change_root(path, bufnr)
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
ft = vim.api.nvim_get_option_value("filetype", { buf = bufnr }) or "" ft = vim.api.nvim_get_option_value("filetype", { buf = bufnr }) or ""
else else
---@diagnostic disable-next-line: deprecated ft = vim.api.nvim_buf_get_option(bufnr, "filetype") or "" ---@diagnostic disable-line: deprecated
ft = vim.api.nvim_buf_get_option(bufnr, "filetype") or ""
end end
for _, value in pairs(_config.update_focused_file.update_root.ignore_list) do for _, value in pairs(_config.update_focused_file.update_root.ignore_list) do
@@ -91,8 +90,7 @@ function M.tab_enter()
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) or "" ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) or ""
else else
---@diagnostic disable-next-line: deprecated ft = vim.api.nvim_buf_get_option(0, "ft") ---@diagnostic disable-line: deprecated
ft = vim.api.nvim_buf_get_option(0, "ft")
end end
for _, filter in ipairs(M.config.tab.sync.ignore) do for _, filter in ipairs(M.config.tab.sync.ignore) do

View File

@@ -177,8 +177,7 @@ local function open()
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value("modifiable", false, { buf = M.bufnr }) vim.api.nvim_set_option_value("modifiable", false, { buf = M.bufnr })
else else
---@diagnostic disable-next-line: deprecated vim.api.nvim_buf_set_option(M.bufnr, "modifiable", false) ---@diagnostic disable-line: deprecated
vim.api.nvim_buf_set_option(M.bufnr, "modifiable", false)
end end
-- highlight it -- highlight it

View File

@@ -85,8 +85,7 @@ function M.get_last_group_node(node)
node = node.group_next node = node.group_next
end end
---@diagnostic disable-next-line: return-type-mismatch -- it can't be nil return node ---@diagnostic disable-line: return-type-mismatch -- it can't be nil
return node
end end
---Group empty folders ---Group empty folders

View File

@@ -154,8 +154,7 @@ local function create_overlay()
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value("modifiable", true, { buf = overlay_bufnr }) vim.api.nvim_set_option_value("modifiable", true, { buf = overlay_bufnr })
else else
---@diagnostic disable-next-line: deprecated vim.api.nvim_buf_set_option(overlay_bufnr, "modifiable", true) ---@diagnostic disable-line: deprecated
vim.api.nvim_buf_set_option(overlay_bufnr, "modifiable", true)
end end
vim.api.nvim_buf_set_lines(overlay_bufnr, 0, -1, false, { M.filter }) vim.api.nvim_buf_set_lines(overlay_bufnr, 0, -1, false, { M.filter })

View File

@@ -22,8 +22,7 @@ local function _draw(bufnr, lines, hl_args, signs)
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr }) vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr })
else else
---@diagnostic disable-next-line: deprecated vim.api.nvim_buf_set_option(bufnr, "modifiable", true) ---@diagnostic disable-line: deprecated
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
end end
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
@@ -32,8 +31,7 @@ local function _draw(bufnr, lines, hl_args, signs)
if vim.fn.has "nvim-0.10" == 1 then if vim.fn.has "nvim-0.10" == 1 then
vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr }) vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr })
else else
---@diagnostic disable-next-line: deprecated vim.api.nvim_buf_set_option(bufnr, "modifiable", false) ---@diagnostic disable-line: deprecated
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
end end
vim.fn.sign_unplace(SIGN_GROUP) vim.fn.sign_unplace(SIGN_GROUP)