From 20a23988776d89872bb02e1bbae6a01aebfdc776 Mon Sep 17 00:00:00 2001 From: Matthew Hughes Date: Fri, 1 May 2026 07:28:22 +1000 Subject: [PATCH] docs: Update instructions for debugging LSP (#39527) docs: update instructions for debugging LSP Previously, it was suggested to set: vim.lsp.log.set_format_func(vim.inspect) This made sense before f72c13341afb3e2459202d3f6e57cd00614c2ab5, when `format_func` was called once per argument being logged, but since that commit it's called with the log level followed by the other args, so the suggested setting would call `vim.inspect(log_level, ....)` which would just print the human readable name of the current log level and no other details, for example with this set I saw in my logs: "DEBUG""DEBUG""DEBUG""DEBUG" Instead just rely on the default formatter, which will: > ... log the level, date, source and line number of the caller, followed by the arguments. (cherry picked from commit 578727c25ec084dd3734d4c5f166e0cb4e3e0a70) --- runtime/doc/lsp.txt | 1 - runtime/lua/vim/lsp/log.lua | 1 - 2 files changed, 2 deletions(-) diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 8f805255b3..77cede0d59 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -2542,7 +2542,6 @@ The `vim.lsp.log` module provides logging for the Nvim LSP client. When debugging language servers, it is helpful to enable extra-verbose logging of the LSP client RPC events. Example: >lua vim.lsp.log.set_level 'trace' - vim.lsp.log.set_format_func(vim.inspect) < Then try to run the language server, and open the log with: >vim diff --git a/runtime/lua/vim/lsp/log.lua b/runtime/lua/vim/lsp/log.lua index beab643191..2e94fde96f 100644 --- a/runtime/lua/vim/lsp/log.lua +++ b/runtime/lua/vim/lsp/log.lua @@ -5,7 +5,6 @@ --- RPC events. Example: --- ```lua --- vim.lsp.log.set_level 'trace' ---- vim.lsp.log.set_format_func(vim.inspect) --- ``` --- --- Then try to run the language server, and open the log with: