summaryrefslogtreecommitdiff
path: root/lua/utils/init.lua
diff options
context:
space:
mode:
authorLuc Sinet <[email protected]>2021-08-13 22:32:56 +0200
committerGitHub <[email protected]>2021-08-14 01:02:56 +0430
commit70d139ac2771fac9b072aaebe505f9ac77480b2a (patch)
treef914460477982486f20bb00676f8a36c89618635 /lua/utils/init.lua
parent53869f00be7eda020088342e6e1a160ef5fc2a53 (diff)
[Refactor/Bugfix] Improve null ls handler (#1277)
Diffstat (limited to 'lua/utils/init.lua')
-rw-r--r--lua/utils/init.lua51
1 files changed, 3 insertions, 48 deletions
diff --git a/lua/utils/init.lua b/lua/utils/init.lua
index 8264189d..0f42623b 100644
--- a/lua/utils/init.lua
+++ b/lua/utils/init.lua
@@ -99,55 +99,10 @@ function utils.reload_lv_config()
vim.cmd ":PackerCompile"
vim.cmd ":PackerInstall"
-- vim.cmd ":PackerClean"
- Log:get_default().info "Reloaded configuration"
-end
-
-function utils.check_lsp_client_active(name)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == name then
- return true
- end
- end
- return false
-end
-
-function utils.get_active_client_by_ft(filetype)
- local clients = vim.lsp.get_active_clients()
- for _, client in pairs(clients) do
- if client.name == lvim.lang[filetype].lsp.provider then
- return client
- end
- end
- return nil
-end
+ local null_ls = require "lsp.null-ls"
+ null_ls.setup(vim.bo.filetype, { force_reload = true })
--- 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
+ Log:get_default().info "Reloaded configuration"
end
function utils.unrequire(m)