summaryrefslogtreecommitdiff
path: root/lua/lsp/null-ls.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-08-06 16:27:19 +0200
committerGitHub <[email protected]>2021-08-06 16:27:19 +0200
commit47ebd70817c99c657271e399c0b98b920f765f29 (patch)
tree06bacc3be91464d4fed9387052f938c51d28c515 /lua/lsp/null-ls.lua
parentc8d1b957121956e36e193d1e7104423aa5901d9b (diff)
Add LunarVim info panel (Experimental) (#1241)
* feat: lunarvim info (Experimental) * Add missing providers info * Use nvim api directly to create the popup * width tweaks
Diffstat (limited to 'lua/lsp/null-ls.lua')
-rw-r--r--lua/lsp/null-ls.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua
index 7adfa218..19727e15 100644
--- a/lua/lsp/null-ls.lua
+++ b/lua/lsp/null-ls.lua
@@ -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