Refactor LSP and add notify

This commit is contained in:
2023-09-03 00:33:33 +02:00
parent a4f0d30976
commit e6bd54bb0c
11 changed files with 102 additions and 287 deletions
+24 -1
View File
@@ -43,7 +43,7 @@ end
--- @param exe string: Array to look for
function M.assert_available(exe)
if not M.is_available(exe) then
error("Missing executable '" .. exe .. "'.")
M.notify("Missing executable '" .. exe .. "'.")
end
end
@@ -65,4 +65,27 @@ function M.assert_python3_module(mod)
end
end
function M.notify(msg, title, level)
if title and not pcall(require, "notify") then
msg = "[" .. title .. "] " .. msg
end
vim.notify(msg, level, { title = title, })
end
function M.debug(msg, title)
M.notify(msg, title, vim.log.levels.DEBUG)
end
function M.info(msg, title)
M.notify(msg, title, vim.log.levels.INFO)
end
function M.warn(msg, title)
M.notify(msg, title, vim.log.levels.WARN)
end
function M.err(msg, title)
M.notify(msg, title, vim.log.levels.ERROR)
end
return M