From 857678c2ec4a25baf79f1d614df5e7c01b233f90 Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Sat, 25 Dec 2021 11:42:29 -0500 Subject: [PATCH] refactor(lsp): remove usage of deprecated function (#16787) (cherry picked from commit bb31d3f21a2c6a378b7cfea64a9aae1730112266) Co-authored-by: Gregory Anders --- runtime/lua/vim/lsp.lua | 3 ++- runtime/lua/vim/lsp/diagnostic.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index e1c85d5ce6..00839ec181 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -489,7 +489,8 @@ local function text_document_did_open_handler(bufnr, client) -- Protect against a race where the buffer disappears -- between `did_open_handler` and the scheduled function firing. if vim.api.nvim_buf_is_valid(bufnr) then - vim.lsp.diagnostic.redraw(bufnr, client.id) + local namespace = vim.lsp.diagnostic.get_namespace(client.id) + vim.diagnostic.show(namespace, bufnr) end end) end diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index d6030b4db5..8850d25233 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -584,7 +584,7 @@ end --- Redraw diagnostics for the given buffer and client --- ----@deprecated Prefer |vim.diagnostic.redraw()| +---@deprecated Prefer |vim.diagnostic.show()| --- --- This calls the "textDocument/publishDiagnostics" handler manually using --- the cached diagnostics already received from the server. This can be useful