From 459f73362b6ff46b6f7177ae8d6d3dc7f7189df4 Mon Sep 17 00:00:00 2001 From: Alexander Courtis Date: Sat, 1 Jun 2024 16:15:11 +1000 Subject: [PATCH] refactor(#2787): replace deprecated --- lua/nvim-tree/actions/finders/search-node.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/actions/finders/search-node.lua b/lua/nvim-tree/actions/finders/search-node.lua index 2045cfac..9e8a45fb 100644 --- a/lua/nvim-tree/actions/finders/search-node.lua +++ b/lua/nvim-tree/actions/finders/search-node.lua @@ -69,8 +69,15 @@ function M.fn() -- temporarily set &path local bufnr = vim.api.nvim_get_current_buf() - local path_existed, path_opt = pcall(vim.api.nvim_buf_get_option, bufnr, "path") - vim.api.nvim_buf_set_option(bufnr, "path", core.get_cwd() .. "/**") + + local path_existed, path_opt + if vim.fn.has "nvim-0.10" == 1 then + path_existed, path_opt = pcall(vim.api.nvim_get_option_value, "path", { buf = bufnr }) + vim.api.nvim_set_option_value("path", core.get_cwd() .. "/**", { buf = bufnr }) + else + path_existed, path_opt = pcall(vim.api.nvim_buf_get_option, bufnr, "path") ---@diagnostic disable-line: deprecated + vim.api.nvim_buf_set_option(bufnr, "path", core.get_cwd() .. "/**") ---@diagnostic disable-line: deprecated + end vim.ui.input({ prompt = "Search: ", completion = "file_in_path" }, function(input_path) if not input_path or input_path == "" then