mirror of
https://github.com/neovim/neovim.git
synced 2026-06-18 17:51:18 +00:00
feat(pos): create a cursor position by using the current of a window
Problem: `vim.pos.cursor(vim.api.nvim_get_current_buf(win), vim.api.nvim_win_get_cursor(win))` is too verbose to create a cursor position of a window, but it is a common use case. Solution: Overload `vim.pos.cursor()`, so that it accepts `win` as an argument when `pos` is omitted.
This commit is contained in:
@@ -490,7 +490,7 @@ function M.run(opts)
|
||||
|
||||
local winid = api.nvim_get_current_win()
|
||||
local bufnr = api.nvim_win_get_buf(winid)
|
||||
local pos = vim.pos.cursor(bufnr, api.nvim_win_get_cursor(winid))
|
||||
local pos = vim.pos.cursor(winid)
|
||||
local params = {
|
||||
textDocument = vim.lsp.util.make_text_document_params(bufnr),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user