Reattach to the LSP client after connection lost.

closes #3
This commit is contained in:
mathijs-bakker
2025-09-01 12:41:13 +02:00
parent e1c1e0292e
commit 4eb8d3b4e5
2 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
local M = {}
M.reconnect_lsp = function()
local clients = vim.lsp.get_clients()
for _, client in ipairs(clients) do
if client.name == "godot" then
vim.lsp.stop_client(client.id, true)
end
end
vim.cmd("edit") -- triggers LSP reattach for current buffer
vim.notify("Godot LSP reconnected", vim.log.levels.INFO)
end
vim.api.nvim_create_user_command("GodotReconnectLSP", function()
M.reconnect_lsp()
end, {})
return M