Refactor LSP and add notify
This commit is contained in:
+24
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user