Add LunarVim info panel (Experimental) (#1241)

* feat: lunarvim info (Experimental)

* Add missing providers info

* Use nvim api directly to create the popup

* width tweaks
This commit is contained in:
kylo252 2021-08-06 16:27:19 +02:00 committed by GitHub
parent c8d1b95712
commit 47ebd70817
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 268 additions and 0 deletions

View file

@ -23,6 +23,26 @@ function M.get_registered_providers_by_filetype(ft)
return matches
end
function M.get_missing_providers_by_filetype(ft)
local matches = {}
for _, provider in pairs(M.requested_providers) do
if vim.tbl_contains(provider.filetypes, ft) then
local provider_name = provider.name
table.insert(matches, provider_name)
end
end
return matches
end
local function register_failed_request(ft, provider, operation)
if not lvim.lang[ft][operation]._failed_requests then
lvim.lang[ft][operation]._failed_requests = {}
end
table.insert(lvim.lang[ft][operation]._failed_requests, provider)
end
local function validate_nodejs_provider(provider)
local command_path
local root_dir
@ -80,6 +100,9 @@ function M.setup(filetype)
builtin_formatter._opts.command = resolved_path
table.insert(M.requested_providers, builtin_formatter)
u.lvim_log(string.format("Using format provider: [%s]", builtin_formatter.name))
else
-- mark it here to avoid re-doing the lookup again
register_failed_request(filetype, formatter.exe, "formatters")
end
end
end
@ -101,6 +124,9 @@ function M.setup(filetype)
builtin_diagnoser._opts.command = resolved_path
table.insert(M.requested_providers, builtin_diagnoser)
u.lvim_log(string.format("Using linter provider: [%s]", builtin_diagnoser.name))
else
-- mark it here to avoid re-doing the lookup again
register_failed_request(filetype, linter.exe, "linters")
end
end
end