nvim-lspconfig icon indicating copy to clipboard operation
nvim-lspconfig copied to clipboard

Remove handlers in config.

Open glepnir opened this issue 4 months ago • 0 comments

Description

The current behavior config.handlers works like a bridge. Then it is passed to vim.lsp.handler.. The purpose is to locate the override handlers in LspInfo. Currently checkhealth supports the vim.lsp module. In order to extract the redundant management behavior of lspconfig. The subsequent steps can add the override handler file location in checkhealth vim.lsp.

something like

diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index 18066a84d..faf43ddcd 100644
--- a/runtime/lua/vim/lsp/health.lua
+++ b/runtime/lua/vim/lsp/health.lua
@@ -159,6 +159,16 @@ local function check_position_encodings()
   end
 end

+function M.check_handlers_override()
+  local handlers = vim.lsp.handlers
+  for name, handler in ipairs(handlers) do
+    local source = debug.getinfo(handler, 'S').source
+    if not source:find('vim/lsp/handlers.lua') then
+      report_info(('Handler of method %s override in: %s '):format(name, source))
+    end
+  end
+end
+
 --- Performs a healthcheck for LSP
 function M.check()
   check_log()

ref https://github.com/neovim/nvim-lspconfig/pull/3335

glepnir avatar Oct 03 '24 10:10 glepnir