Skip to content

Commit a5f1b86

Browse files
committed
refactor(#2787): use inline deprecation disabling
1 parent 459f733 commit a5f1b86

File tree

5 files changed

+7
-14
lines changed

5 files changed

+7
-14
lines changed

lua/nvim-tree.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ function M.change_root(path, bufnr)
3131
if vim.fn.has "nvim-0.10" == 1 then
3232
ft = vim.api.nvim_get_option_value("filetype", { buf = bufnr }) or ""
3333
else
34-
---@diagnostic disable-next-line: deprecated
35-
ft = vim.api.nvim_buf_get_option(bufnr, "filetype") or ""
34+
ft = vim.api.nvim_buf_get_option(bufnr, "filetype") or "" ---@diagnostic disable-line: deprecated
3635
end
3736

3837
for _, value in pairs(_config.update_focused_file.update_root.ignore_list) do
@@ -91,8 +90,7 @@ function M.tab_enter()
9190
if vim.fn.has "nvim-0.10" == 1 then
9291
ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) or ""
9392
else
94-
---@diagnostic disable-next-line: deprecated
95-
ft = vim.api.nvim_buf_get_option(0, "ft")
93+
ft = vim.api.nvim_buf_get_option(0, "ft") ---@diagnostic disable-line: deprecated
9694
end
9795

9896
for _, filter in ipairs(M.config.tab.sync.ignore) do

lua/nvim-tree/help.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,7 @@ local function open()
177177
if vim.fn.has "nvim-0.10" == 1 then
178178
vim.api.nvim_set_option_value("modifiable", false, { buf = M.bufnr })
179179
else
180-
---@diagnostic disable-next-line: deprecated
181-
vim.api.nvim_buf_set_option(M.bufnr, "modifiable", false)
180+
vim.api.nvim_buf_set_option(M.bufnr, "modifiable", false) ---@diagnostic disable-line: deprecated
182181
end
183182

184183
-- highlight it

lua/nvim-tree/lib.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ function M.get_last_group_node(node)
8585
node = node.group_next
8686
end
8787

88-
---@diagnostic disable-next-line: return-type-mismatch -- it can't be nil
89-
return node
88+
return node ---@diagnostic disable-line: return-type-mismatch -- it can't be nil
9089
end
9190

9291
---Group empty folders

lua/nvim-tree/live-filter.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ local function create_overlay()
154154
if vim.fn.has "nvim-0.10" == 1 then
155155
vim.api.nvim_set_option_value("modifiable", true, { buf = overlay_bufnr })
156156
else
157-
---@diagnostic disable-next-line: deprecated
158-
vim.api.nvim_buf_set_option(overlay_bufnr, "modifiable", true)
157+
vim.api.nvim_buf_set_option(overlay_bufnr, "modifiable", true) ---@diagnostic disable-line: deprecated
159158
end
160159

161160
vim.api.nvim_buf_set_lines(overlay_bufnr, 0, -1, false, { M.filter })

lua/nvim-tree/renderer/init.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ local function _draw(bufnr, lines, hl_args, signs)
2222
if vim.fn.has "nvim-0.10" == 1 then
2323
vim.api.nvim_set_option_value("modifiable", true, { buf = bufnr })
2424
else
25-
---@diagnostic disable-next-line: deprecated
26-
vim.api.nvim_buf_set_option(bufnr, "modifiable", true)
25+
vim.api.nvim_buf_set_option(bufnr, "modifiable", true) ---@diagnostic disable-line: deprecated
2726
end
2827

2928
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines)
@@ -32,8 +31,7 @@ local function _draw(bufnr, lines, hl_args, signs)
3231
if vim.fn.has "nvim-0.10" == 1 then
3332
vim.api.nvim_set_option_value("modifiable", false, { buf = bufnr })
3433
else
35-
---@diagnostic disable-next-line: deprecated
36-
vim.api.nvim_buf_set_option(bufnr, "modifiable", false)
34+
vim.api.nvim_buf_set_option(bufnr, "modifiable", false) ---@diagnostic disable-line: deprecated
3735
end
3836

3937
vim.fn.sign_unplace(SIGN_GROUP)

0 commit comments

Comments
 (0)