add: tidy up the code, more modular

This commit is contained in:
asep.komarudin 2024-05-21 08:33:21 +07:00
parent 1545d8335d
commit 1f424a1225
10 changed files with 583 additions and 522 deletions

19
lua/user/utils/linter.lua Normal file
View file

@ -0,0 +1,19 @@
local null_ls = require("null-ls")
local M = {}
M.alternative_methods = {
null_ls.methods.DIAGNOSTICS,
null_ls.methods.DIAGNOSTICS_ON_OPEN,
null_ls.methods.DIAGNOSTICS_ON_SAVE,
}
M.linter_list_registered = function(filetype)
local registered_providers = require("user.utils.lsp").list_registered_providers_names(filetype)
local providers_for_methods = vim.iter(vim.tbl_map(function(m)
return registered_providers[m] or {}
end, M.alternative_methods))
return providers_for_methods
end
return M