mirror of
https://github.com/ray-x/navigator.lua
synced 2024-11-17 15:26:03 +00:00
28 lines
591 B
Lua
28 lines
591 B
Lua
local lsp = require("vim.lsp")
|
|
|
|
M = {}
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
|
|
function M.reload_lsp()
|
|
vim.cmd("LspStop")
|
|
local timer = vim.loop.new_timer()
|
|
local i = 0
|
|
timer:start(500, 100, function()
|
|
if i >= 5 then
|
|
timer:close() -- Always close handles to avoid leaks.
|
|
end
|
|
i = i + 1
|
|
end)
|
|
vim.cmd("LspStart")
|
|
vim.cmd([[write]])
|
|
vim.cmd([[edit]])
|
|
end
|
|
|
|
function M.open_lsp_log()
|
|
local path = vim.lsp.get_log_path()
|
|
vim.cmd("edit " .. path)
|
|
end
|
|
|
|
return M
|