aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-12-25 21:28:28 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-12-27 00:05:36 +0100
commit5f9d4d8afeb5dc3d5df4965c24cbb4c6e01694f7 (patch)
tree38d4f038774c077b61aeb32bea2b19f55ab14cb8 /runtime/lua/vim/lsp/util.lua
parent0f22ea400ce5319a1e74eda41505fd9cfb788e35 (diff)
downloadrneovim-5f9d4d8afeb5dc3d5df4965c24cbb4c6e01694f7.tar.gz
rneovim-5f9d4d8afeb5dc3d5df4965c24cbb4c6e01694f7.tar.bz2
rneovim-5f9d4d8afeb5dc3d5df4965c24cbb4c6e01694f7.zip
refactor: use vim.deprecate on all deprecated functions
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 63c4c1e7fc..ba7ce3c2b6 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -180,6 +180,7 @@ local _str_byteindex_enc = M._str_byteindex_enc
---@param new_lines (table) list of strings to replace the original
---@return table The modified {lines} object
function M.set_lines(lines, A, B, new_lines)
+ vim.deprecate('vim.lsp.util.set_lines()', 'nil', '0.12')
-- 0-indexing to 1-indexing
local i_0 = A[1] + 1
-- If it extends past the end, truncate it to the end. This is because the
@@ -346,7 +347,7 @@ end
---@private
---@deprecated Use vim.lsp.status() or access client.progress directly
function M.get_progress_messages()
- vim.deprecate('vim.lsp.util.get_progress_messages', 'vim.lsp.status', '0.11.0')
+ vim.deprecate('vim.lsp.util.get_progress_messages()', 'vim.lsp.status()', '0.11')
local new_messages = {}
local progress_remove = {}
@@ -552,7 +553,7 @@ end
---@return lsp.CompletionItem[] List of completion items
---@see https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
function M.extract_completion_items(result)
- vim.deprecate('vim.lsp.util.extract_completion_items', nil, '0.11')
+ vim.deprecate('vim.lsp.util.extract_completion_items()', nil, '0.11')
if type(result) == 'table' and result.items then
-- result is a `CompletionList`
return result.items
@@ -612,7 +613,7 @@ end
---@param input string unparsed snippet
---@return string parsed snippet
function M.parse_snippet(input)
- vim.deprecate('vim.lsp.util.parse_snippet', nil, '0.11')
+ vim.deprecate('vim.lsp.util.parse_snippet()', nil, '0.11')
local ok, parsed = pcall(function()
return snippet.parse(input)
end)
@@ -634,7 +635,7 @@ end
---@return table[] items
---@see complete-items
function M.text_document_completion_list_to_complete_items(result, prefix)
- vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items', nil, '0.11')
+ vim.deprecate('vim.lsp.util.text_document_completion_list_to_complete_items()', nil, '0.11')
return require('vim.lsp._completion')._lsp_to_complete_items(result, prefix)
end
@@ -1885,6 +1886,7 @@ end
---@param lines table list of lines to trim
---@return table trimmed list of lines
function M.trim_empty_lines(lines)
+ vim.deprecate('vim.lsp.util.trim_empty_lines()', 'vim.split() with `trimempty`', '0.12')
local start = 1
for i = 1, #lines do
if lines[i] ~= nil and #lines[i] > 0 then
@@ -1911,6 +1913,7 @@ end
---@param lines table list of lines
---@return string filetype or "markdown" if it was unchanged.
function M.try_trim_markdown_code_blocks(lines)
+ vim.deprecate('vim.lsp.util.try_trim_markdown_code_blocks()', 'nil', '0.12')
local language_id = lines[1]:match('^```(.*)')
if language_id then
local has_inner_code_fence = false