diff options
author | dundargoc <gocdundar@gmail.com> | 2024-06-08 21:40:18 +0200 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-06-28 19:58:31 +0200 |
commit | aa6b9c677d83d76d448c3bb0973bf8d14bfdf922 (patch) | |
tree | 11b53f3dfac47faa94b375280d392959c754f4bd /runtime/lua/vim/lsp/util.lua | |
parent | 496091b63241f33dffc15411e35e89d8018e6fa2 (diff) | |
download | rneovim-aa6b9c677d83d76d448c3bb0973bf8d14bfdf922.tar.gz rneovim-aa6b9c677d83d76d448c3bb0973bf8d14bfdf922.tar.bz2 rneovim-aa6b9c677d83d76d448c3bb0973bf8d14bfdf922.zip |
refactor: use `vim._with` where possible
This mostly means replacing `nvim_buf_call` and `nvim_win_call` with
`vim._with`.
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index a5cf13ed0f..b0fd25af3a 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -640,7 +640,7 @@ function M.rename(old_fname, new_fname, opts) -- Rename with :saveas. This does two things: -- * Unset BF_WRITE_MASK, so that users don't get E13 when they do :write. -- * Send didClose and didOpen via textDocument/didSave handler. - api.nvim_buf_call(b, function() + vim._with({ buf = b }, function() vim.cmd('keepalt saveas! ' .. vim.fn.fnameescape(rename.to)) end) -- Delete the new buffer with the old name created by :saveas. nvim_buf_delete and @@ -1014,7 +1014,7 @@ function M.show_document(location, offset_encoding, opts) local row = range.start.line local col = get_line_byte_from_position(bufnr, range.start, offset_encoding) api.nvim_win_set_cursor(win, { row + 1, col }) - api.nvim_win_call(win, function() + vim._with({ win = win }, function() -- Open folds under the cursor vim.cmd('normal! zv') end) @@ -1334,7 +1334,7 @@ function M.stylize_markdown(bufnr, contents, opts) end -- needs to run in the buffer for the regions to work - api.nvim_buf_call(bufnr, function() + vim._with({ buf = bufnr }, function() -- we need to apply lsp_markdown regions speperately, since otherwise -- markdown regions can "bleed" through the other syntax regions -- and mess up the formatting |