fix(lsp): mention function name in warning #31301

Problem: The warning message is the same in different functions.
It is not convenient to locate the specific function name

Solution: add function name in warning message
This commit is contained in:
glepnir 2024-11-27 21:44:29 +08:00 committed by GitHub
parent c24e6e66dd
commit 203e7a43d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1894,7 +1894,7 @@ function M.make_position_params(window, position_encoding)
local buf = api.nvim_win_get_buf(window) local buf = api.nvim_win_get_buf(window)
if position_encoding == nil then if position_encoding == nil then
vim.notify_once( vim.notify_once(
'warning: position_encoding is required, using the offset_encoding from the first client', 'position_encoding param is required in vim.lsp.util.make_position_params. Defaulting to position encoding of the first client.',
vim.log.levels.WARN vim.log.levels.WARN
) )
position_encoding = M._get_offset_encoding(buf) position_encoding = M._get_offset_encoding(buf)
@ -1950,7 +1950,7 @@ function M.make_range_params(window, position_encoding)
local buf = api.nvim_win_get_buf(window or 0) local buf = api.nvim_win_get_buf(window or 0)
if position_encoding == nil then if position_encoding == nil then
vim.notify_once( vim.notify_once(
'warning: position_encoding is required, using the offset_encoding from the first client', 'position_encoding param is required in vim.lsp.util.make_range_params. Defaulting to position encoding of the first client.',
vim.log.levels.WARN vim.log.levels.WARN
) )
position_encoding = M._get_offset_encoding(buf) position_encoding = M._get_offset_encoding(buf)
@ -1979,7 +1979,7 @@ function M.make_given_range_params(start_pos, end_pos, bufnr, position_encoding)
bufnr = bufnr or api.nvim_get_current_buf() bufnr = bufnr or api.nvim_get_current_buf()
if position_encoding == nil then if position_encoding == nil then
vim.notify_once( vim.notify_once(
'warning: position_encoding is required, using the offset_encoding from the first client', 'position_encoding param is required in vim.lsp.util.make_given_range_params. Defaulting to position encoding of the first client.',
vim.log.levels.WARN vim.log.levels.WARN
) )
position_encoding = M._get_offset_encoding(bufnr) position_encoding = M._get_offset_encoding(bufnr)