From 47ebd70817c99c657271e399c0b98b920f765f29 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 6 Aug 2021 16:27:19 +0200 Subject: Add LunarVim info panel (Experimental) (#1241) * feat: lunarvim info (Experimental) * Add missing providers info * Use nvim api directly to create the popup * width tweaks --- lua/utils/init.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'lua/utils/init.lua') 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 -- cgit v1.2.3