diff --git a/lua/yaml-companion/context/init.lua b/lua/yaml-companion/context/init.lua index 6fc9b0e..2addb2f 100644 --- a/lua/yaml-companion/context/init.lua +++ b/lua/yaml-companion/context/init.lua @@ -106,7 +106,7 @@ M.setup = function(bufnr, client) -- remove yamlls from not yaml files -- https://github.com/towolf/vim-helm/issues/15 if vim.bo[bufnr].buftype ~= "" or vim.bo[bufnr].filetype == "helm" then - vim.diagnostic.disable(bufnr) + vim.diagnostic.enable(false, { bufnr = bufnr }) vim.defer_fn(function() vim.diagnostic.reset(nil, bufnr) end, 1000) diff --git a/lua/yaml-companion/lsp/util.lua b/lua/yaml-companion/lsp/util.lua index cf88517..0a68995 100644 --- a/lua/yaml-companion/lsp/util.lua +++ b/lua/yaml-companion/lsp/util.lua @@ -7,7 +7,9 @@ local sync_timeout = 5000 ---@param bufnr number ---@return vim.lsp.client | nil M.get_client = function(bufnr) - return vim.lsp.get_active_clients({ name = "yamlls", bufnr = bufnr })[1] + ---@diagnostic disable-next-line: deprecated + local get_clients = vim.lsp.get_clients and vim.lsp.get_clients or vim.lsp.get_active_clients + return get_clients({ name = "yamlls", bufnr = bufnr })[1] end ---@param bufnr number diff --git a/lua/yaml-companion/select/ui.lua b/lua/yaml-companion/select/ui.lua index 569539f..996f079 100644 --- a/lua/yaml-companion/select/ui.lua +++ b/lua/yaml-companion/select/ui.lua @@ -26,7 +26,7 @@ M.open_ui_select = function() vim.ui.select( schemas, - { format_item = display_schema_item, prompt = "Select YAML Schema" }, + { format_item = display_schema_item, prompt = "Select YAML Schema: " }, select_schema ) end diff --git a/tests/schema_spec.lua b/tests/schema_spec.lua index bbd3d68..47293c7 100644 --- a/tests/schema_spec.lua +++ b/tests/schema_spec.lua @@ -15,11 +15,13 @@ end local function buf(input, ft, name) local b = vim.api.nvim_create_buf(false, false) vim.api.nvim_buf_set_name(b, name) - vim.api.nvim_buf_set_option(b, "filetype", ft) + vim.api.nvim_set_option_value("filetype", ft, { buf = b }) vim.api.nvim_command("buffer " .. b) vim.api.nvim_buf_set_lines(b, 0, -1, true, vim.split(input, "\n")) return wait_until(function() - local clients = vim.lsp.get_active_clients() + ---@diagnostic disable-next-line: deprecated + local get_clients = vim.lsp.get_clients and vim.lsp.get_clients or vim.lsp.get_active_clients + local clients = get_clients() if #clients > 0 then return true end @@ -40,11 +42,13 @@ describe("user defined schemas:", function() vim.api.nvim_buf_delete(0, { force = true }) vim.fn.delete("foo.yaml", "rf") assert(wait_until(function() - local clients = vim.lsp.get_active_clients() + ---@diagnostic disable-next-line: deprecated + local get_clients = vim.lsp.get_clients and vim.lsp.get_clients or vim.lsp.get_active_clients + local clients = get_clients() if #clients == 0 then return true end - vim.lsp.stop_client(vim.lsp.get_active_clients(), true) + vim.lsp.stop_client(get_clients(), true) end)) end) diff --git a/tests/yaml-companion_spec.lua b/tests/yaml-companion_spec.lua index cec692d..849655a 100644 --- a/tests/yaml-companion_spec.lua +++ b/tests/yaml-companion_spec.lua @@ -13,11 +13,13 @@ end local function buf(input, ft, name) local b = vim.api.nvim_create_buf(false, false) vim.api.nvim_buf_set_name(b, name) - vim.api.nvim_buf_set_option(b, "filetype", ft) + vim.api.nvim_set_option_value("filetype", ft, { buf = b }) vim.api.nvim_command("buffer " .. b) vim.api.nvim_buf_set_lines(b, 0, -1, true, vim.split(input, "\n")) return wait_until(function() - local clients = vim.lsp.get_active_clients() + ---@diagnostic disable-next-line: deprecated + local get_clients = vim.lsp.get_clients and vim.lsp.get_clients or vim.lsp.get_active_clients + local clients = get_clients() if #clients > 0 then return true end