feat: add lsp configuration
This commit is contained in:
@@ -1,44 +1,44 @@
|
||||
local M = {}
|
||||
|
||||
cmdsList = nil
|
||||
CmdsList = nil
|
||||
|
||||
function M.checkCommand(cmd, desc)
|
||||
local toRun = ""
|
||||
local toRun = ""
|
||||
|
||||
if IS_UNIX then
|
||||
toRun = "command -v " .. cmd
|
||||
else
|
||||
toRun = "where " .. cmd
|
||||
end
|
||||
if IS_UNIX then
|
||||
toRun = "command -v " .. cmd
|
||||
else
|
||||
toRun = "where " .. cmd
|
||||
end
|
||||
|
||||
local p = io.popen(toRun)
|
||||
local output = p:read("*l")
|
||||
p:close()
|
||||
local p = io.popen(toRun)
|
||||
local output = p:read("*l")
|
||||
p:close()
|
||||
|
||||
if output == nil and desc ~= nil and desc ~= "" then
|
||||
vim.api.nvim_echo({ { " ✗ " .. cmd .. " [" .. desc .. "] - not found!", "DiagnosticError" } }, true, {})
|
||||
elseif output == nil then
|
||||
vim.api.nvim_echo({ { " ✗ " .. cmd .. " not found!", "DiagnosticError" } }, true, {})
|
||||
else
|
||||
vim.api.nvim_echo({ { " ✓ " .. cmd, "DiagnosticOk" } }, true, {})
|
||||
end
|
||||
if output == nil and desc ~= nil and desc ~= "" then
|
||||
vim.api.nvim_echo({ { " ✗ " .. cmd .. " [" .. desc .. "] - not found!", "DiagnosticError" } }, true, {})
|
||||
elseif output == nil then
|
||||
vim.api.nvim_echo({ { " ✗ " .. cmd .. " not found!", "DiagnosticError" } }, true, {})
|
||||
else
|
||||
vim.api.nvim_echo({ { " ✓ " .. cmd, "DiagnosticOk" } }, true, {})
|
||||
end
|
||||
end
|
||||
|
||||
function M.run()
|
||||
if cmdsList == nil or next(cmdsList) == nil then
|
||||
vim.api.nvim_echo({{"Dependencies list passed is null or empty, nothing to check", "DiagnosticWarn"}}, true, {})
|
||||
return
|
||||
end
|
||||
if CmdsList == nil or next(CmdsList) == nil then
|
||||
vim.api.nvim_echo({ { "Dependencies list passed is null or empty, nothing to check", "DiagnosticWarn" } }, true, {})
|
||||
return
|
||||
end
|
||||
|
||||
print("Check installed system commands:")
|
||||
for i, cmd in ipairs(cmdsList) do
|
||||
M.checkCommand(cmd.cmd, cmd.desc)
|
||||
end
|
||||
print("Check installed system commands:")
|
||||
for _, cmd in ipairs(CmdsList) do
|
||||
M.checkCommand(cmd.cmd, cmd.desc)
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(cmds)
|
||||
IS_UNIX = package.config:sub(1, 1) ~= "\\"
|
||||
cmdsList = cmds
|
||||
IS_UNIX = package.config:sub(1, 1) ~= "\\"
|
||||
CmdsList = cmds
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user