summaryrefslogtreecommitdiff
path: root/lua/utils/init.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/utils/init.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/utils/init.lua')
-rw-r--r--lua/utils/init.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/lua/utils/init.lua b/lua/utils/init.lua
index 16ad5e4a..df472c66 100644
--- a/lua/utils/init.lua
+++ b/lua/utils/init.lua
@@ -113,6 +113,34 @@ function utils.get_active_client_by_ft(filetype)
return nil
end
+-- TODO: consider porting this logic to null-ls instead
+function utils.get_supported_linters_by_filetype(filetype)
+ local null_ls = require "null-ls"
+ local matches = {}
+ for _, provider in pairs(null_ls.builtins.diagnostics) do
+ if vim.tbl_contains(provider.filetypes, filetype) then
+ local provider_name = provider.name
+
+ table.insert(matches, provider_name)
+ end
+ end
+
+ return matches
+end
+
+function utils.get_supported_formatters_by_filetype(filetype)
+ local null_ls = require "null-ls"
+ local matches = {}
+ for _, provider in pairs(null_ls.builtins.formatting) do
+ if provider.filetypes and vim.tbl_contains(provider.filetypes, filetype) then
+ -- table.insert(matches, { provider.name, ft })
+ table.insert(matches, provider.name)
+ end
+ end
+
+ return matches
+end
+
function utils.unrequire(m)
package.loaded[m] = nil
_G[m] = nil