2021-04-19 02:56:32 +00:00
|
|
|
local lsp = require("vim.lsp")
|
|
|
|
|
2021-05-02 13:54:30 +00:00
|
|
|
M = {}
|
2021-04-19 02:56:32 +00:00
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
|
|
|
|
|
|
function M.reload_lsp()
|
2021-08-06 07:24:03 +00:00
|
|
|
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]])
|
2021-04-19 02:56:32 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function M.open_lsp_log()
|
|
|
|
local path = vim.lsp.get_log_path()
|
|
|
|
vim.cmd("edit " .. path)
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|