fix(lsp): deprecate vim.lsp.set_log_level, vim.lsp.get_log_path #35274

This commit is contained in:
Maria José Solano
2025-08-11 13:51:40 -07:00
committed by GitHub
parent b52f9a19b3
commit f7802dd5d5
6 changed files with 15 additions and 27 deletions

View File

@@ -1504,10 +1504,13 @@ lsp.log_levels = log.levels
---
--- Use `lsp.log_levels` for reverse lookup.
---
---@deprecated
---@see |vim.lsp.log_levels|
---
---@param level (integer|string) the case insensitive level name or number
function lsp.set_log_level(level)
vim.deprecate('vim.lsp.set_log_level()', 'vim.lsp.log.set_level()', '0.13')
if type(level) == 'string' or type(level) == 'number' then
log.set_level(level)
else
@@ -1516,8 +1519,12 @@ function lsp.set_log_level(level)
end
--- Gets the path of the logfile used by the LSP client.
---
---@deprecated
---@return string path to log file
function lsp.get_log_path()
vim.deprecate('vim.lsp.get_log_path()', 'vim.lsp.log.get_filename()', '0.13')
return log.get_filename()
end

View File

@@ -1272,7 +1272,7 @@ function Client:_on_exit(code, signal)
self and self.name or 'unknown',
code,
signal,
lsp.get_log_path()
log.get_filename()
)
vim.notify(msg, vim.log.levels.WARN)
end

View File

@@ -18,7 +18,7 @@ local function check_log()
)
end
local log_path = vim.lsp.get_log_path()
local log_path = log.get_filename()
report_info(string.format('Log path: %s', log_path))
local log_file = vim.uv.fs_stat(log_path)

View File

@@ -4,13 +4,13 @@
--- When debugging language servers, it is helpful to enable extra-verbose logging of the LSP client
--- RPC events. Example:
--- ```lua
--- vim.lsp.set_log_level 'trace'
--- vim.lsp.log.set_level 'trace'
--- require('vim.lsp.log').set_format_func(vim.inspect)
--- ```
---
--- Then try to run the language server, and open the log with:
--- ```vim
--- :lua vim.cmd('tabnew ' .. vim.lsp.get_log_path())
--- :lua vim.cmd('tabnew ' .. vim.lsp.log.get_filename())
--- ```
---
--- (Or use `:LspLog` if you have nvim-lspconfig installed.)