diff options
author | Maria José Solano <majosolano99@gmail.com> | 2023-09-29 08:37:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 17:37:14 +0200 |
commit | 9ed830a3ca5847a9152b91fca5e1eaf712bed55b (patch) | |
tree | 6dd4d7486a5e95ab9670c75312ff3a80e934e6ec | |
parent | af7d317f3ff31d5ac5d8724b5057a422e1451b54 (diff) | |
download | rneovim-9ed830a3ca5847a9152b91fca5e1eaf712bed55b.tar.gz rneovim-9ed830a3ca5847a9152b91fca5e1eaf712bed55b.tar.bz2 rneovim-9ed830a3ca5847a9152b91fca5e1eaf712bed55b.zip |
refactor(lsp): deprecate util methods (#25400)
-rw-r--r-- | runtime/doc/deprecated.txt | 2 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 27 | ||||
-rw-r--r-- | runtime/doc/news.txt | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 5 |
4 files changed, 7 insertions, 29 deletions
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 407d7ae9fb..7a2b29f8c8 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -142,6 +142,8 @@ LSP FUNCTIONS - *vim.lsp.get_active_clients()* Use |vim.lsp.get_clients()| - *vim.lsp.for_each_buffer_client()* Use |vim.lsp.get_clients()| - *vim.lsp.util.trim_empty_lines()* Use |vim.split()| with `trimempty` instead. +- *vim.lsp.util.try_trim_markdown_code_blocks()* +- *vim.lsp.util.set_lines()* TREESITTER FUNCTIONS - *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()| diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 23902f8bc3..5d32a1b4d0 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1955,20 +1955,6 @@ rename({old_fname}, {new_fname}, {opts}) *vim.lsp.util.rename()* Parameters: ~ • {opts} (table) -set_lines({lines}, {A}, {B}, {new_lines}) *vim.lsp.util.set_lines()* - Replaces text in a range with new text. - - CAUTION: Changes in-place! - - Parameters: ~ - • {lines} (table) Original list of strings - • {A} (table) Start position; a 2-tuple of {line,col} numbers - • {B} (table) End position; a 2-tuple of {line,col} numbers - • {new_lines} (table) list of strings to replace the original - - Return: ~ - (table) The modified {lines} object - *vim.lsp.util.show_document()* show_document({location}, {offset_encoding}, {opts}) Shows document and optionally jumps to the location. @@ -2033,19 +2019,6 @@ text_document_completion_list_to_complete_items({result}, {prefix}) See also: ~ • complete-items - *vim.lsp.util.try_trim_markdown_code_blocks()* -try_trim_markdown_code_blocks({lines}) - Accepts markdown lines and tries to reduce them to a filetype if they - comprise just a single code block. - - CAUTION: Modifies the input in-place! - - Parameters: ~ - • {lines} (table) list of lines - - Return: ~ - (string) filetype or "markdown" if it was unchanged. - ============================================================================== Lua module: vim.lsp.log *lsp-log* diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index ff0ccfb08f..3062c4c393 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -281,6 +281,8 @@ release. - |vim.lsp.get_active_clients()| Use |vim.lsp.get_clients()| instead. - |vim.lsp.for_each_buffer_client()| Use |vim.lsp.get_clients()| instead. - |vim.lsp.util.trim_empty_lines()| Use |vim.split()| with `trimempty` instead. + - |vim.lsp.util.try_trim_markdown_code_blocks()| + - |vim.lsp.util.set_lines()| • `vim.loop` has been renamed to `vim.uv`. diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 0d1e3cc0d1..51ed87219c 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -168,10 +168,12 @@ end local _str_utfindex_enc = M._str_utfindex_enc local _str_byteindex_enc = M._str_byteindex_enc + --- Replaces text in a range with new text. --- --- CAUTION: Changes in-place! --- +---@deprecated ---@param lines (table) Original list of strings ---@param A (table) Start position; a 2-tuple of {line,col} numbers ---@param B (table) End position; a 2-tuple of {line,col} numbers @@ -320,9 +322,7 @@ local function get_line(bufnr, row) end --- Position is a https://microsoft.github.io/language-server-protocol/specifications/specification-current/#position ---- Returns a zero-indexed column, since set_lines() does the conversion to ---@param offset_encoding string|nil utf-8|utf-16|utf-32 ---- 1-indexed ---@return integer local function get_line_byte_from_position(bufnr, position, offset_encoding) -- LSP's line and characters are 0-indexed @@ -1991,6 +1991,7 @@ end --- --- CAUTION: Modifies the input in-place! --- +---@deprecated ---@param lines table list of lines ---@return string filetype or "markdown" if it was unchanged. function M.try_trim_markdown_code_blocks(lines) |