diff options
author | Lewis Russell <lewis6991@gmail.com> | 2024-10-16 09:45:12 +0100 |
---|---|---|
committer | Lewis Russell <lewis6991@gmail.com> | 2024-10-17 12:52:45 +0100 |
commit | 1edfe5c09ebcb9e81464f805f99d276de4bcef9b (patch) | |
tree | aefd3d0cf901843af07ed78af6bfe3c9370afc99 /runtime/lua/vim/lsp/util.lua | |
parent | 92e4e3fb76c250fa82a704823a5731fde5f220e1 (diff) | |
download | rneovim-1edfe5c09ebcb9e81464f805f99d276de4bcef9b.tar.gz rneovim-1edfe5c09ebcb9e81464f805f99d276de4bcef9b.tar.bz2 rneovim-1edfe5c09ebcb9e81464f805f99d276de4bcef9b.zip |
feat(lsp.util): use vim.api alias
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 26692e0bcd..e1027685ee 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -125,10 +125,10 @@ local function split_lines(s, no_blank) end local function create_window_without_focus() - local prev = vim.api.nvim_get_current_win() + local prev = api.nvim_get_current_win() vim.cmd.new() - local new = vim.api.nvim_get_current_win() - vim.api.nvim_set_current_win(prev) + local new = api.nvim_get_current_win() + api.nvim_set_current_win(prev) return new end @@ -496,7 +496,7 @@ function M.apply_text_edits(text_edits, bufnr, offset_encoding) -- make sure we don't go out of bounds pos[1] = math.min(pos[1], max) pos[2] = math.min(pos[2], #(get_line(bufnr, pos[1] - 1) or '')) - vim.api.nvim_buf_set_mark(bufnr or 0, mark, pos[1], pos[2], {}) + api.nvim_buf_set_mark(bufnr or 0, mark, pos[1], pos[2], {}) end end @@ -572,8 +572,8 @@ end local function get_bufs_with_prefix(prefix) local prefix_parts = path_components(prefix) local buffers = {} - for _, v in ipairs(vim.api.nvim_list_bufs()) do - local bname = vim.api.nvim_buf_get_name(v) + for _, v in ipairs(api.nvim_list_bufs()) do + local bname = api.nvim_buf_get_name(v) local path = path_components(vim.fs.normalize(bname, { expand_env = false })) if path_under_prefix(path, prefix_parts) then table.insert(buffers, v) @@ -632,7 +632,7 @@ function M.rename(old_fname, new_fname, opts) -- conflicting buffer may not be associated with a file. For example, 'buftype' can be "nofile" -- or "nowrite", or the buffer can be a normal buffer but has not been written to the file yet. -- Renaming should fail in such cases to avoid losing the contents of the conflicting buffer. - local old_bname = vim.api.nvim_buf_get_name(b) + local old_bname = api.nvim_buf_get_name(b) local new_bname = old_bname:gsub(old_fname_pat, escape_gsub_repl(new_fname)) if vim.fn.bufexists(new_bname) == 1 then local existing_buf = vim.fn.bufnr(new_bname) @@ -2173,7 +2173,7 @@ local function make_line_range_params(bufnr, start_line, end_line, offset_encodi ---@type lsp.Position local end_pos - if end_line == last_line and not vim.api.nvim_get_option_value('endofline', { buf = bufnr }) then + if end_line == last_line and not vim.bo[bufnr].endofline then end_pos = { line = end_line, character = M.character_offset(bufnr, end_line, #get_line(bufnr, end_line), offset_encoding), |