aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-01-03 06:48:01 -0700
committerGitHub <noreply@github.com>2022-01-03 06:48:01 -0700
commit36662c961244f41996720a0eec8eac67a18f2ec0 (patch)
treeb80fce845c79138589755318f4cd237bb86dcd0e /runtime/lua/vim/lsp/util.lua
parent2f31e7b88b1147fa5f48b1ab1d140cb8ccc1e801 (diff)
downloadrneovim-36662c961244f41996720a0eec8eac67a18f2ec0.tar.gz
rneovim-36662c961244f41996720a0eec8eac67a18f2ec0.tar.bz2
rneovim-36662c961244f41996720a0eec8eac67a18f2ec0.zip
fix: resolve nil arguments to API functions (#16889)
As revealed by #16745, some functions pass a nil value to API functions, which have been implicitly converted to 0. #16745 breaks this implicit conversion, so explicitly pass a resolved buffer number to these API functions.
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index ae667c4106..603ed0d290 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -1677,7 +1677,7 @@ function M.symbols_to_items(symbols, bufnr)
end
return _items
end
- return _symbols_to_items(symbols, {}, bufnr)
+ return _symbols_to_items(symbols, {}, bufnr or 0)
end
--- Removes empty lines from the beginning and end.
@@ -1796,7 +1796,7 @@ end
---@returns { textDocument = { uri = `current_file_uri` }, range = { start =
---`current_position`, end = `current_position` } }
function M.make_range_params(window, offset_encoding)
- local buf = vim.api.nvim_win_get_buf(window)
+ local buf = vim.api.nvim_win_get_buf(window or 0)
offset_encoding = offset_encoding or M._get_offset_encoding(buf)
local position = make_position_param(window, offset_encoding)
return {