pojokcodeid.nvim-lazy/lua/user/utils/linter.lua

28 lines
635 B
Lua
Raw Normal View History

local ok, null_ls = pcall(require, "null-ls")
2024-05-21 08:33:21 +07:00
local M = {}
if ok then
M.alternative_methods = {
null_ls.methods.DIAGNOSTICS,
null_ls.methods.DIAGNOSTICS_ON_OPEN,
null_ls.methods.DIAGNOSTICS_ON_SAVE,
}
else
M.alternative_methods = {}
end
2024-05-21 08:33:21 +07:00
M.linter_list_registered = function(filetype)
if ok then
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))
2024-05-21 08:33:21 +07:00
return providers_for_methods
else
return {}
end
2024-05-21 08:33:21 +07:00
end
return M