diff options
author | christianchiarulli <[email protected]> | 2021-08-29 14:17:32 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-08-29 14:17:32 -0400 |
commit | ed5559d259e38a78796a7d81421f02ba6dafac4b (patch) | |
tree | afa9c00c017382bac547265a8a1e16b9770a07eb /lua/lsp/null-ls/init.lua | |
parent | e7b6d3b6f5982ea1042ffd499a7b85c18f0b782e (diff) | |
parent | c7a5122fe2c14dba0f28f1c077f838f957884afc (diff) |
Merge branch 'rolling' of github.com:ChristianChiarulli/LunarVim
Diffstat (limited to 'lua/lsp/null-ls/init.lua')
-rw-r--r-- | lua/lsp/null-ls/init.lua | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lua/lsp/null-ls/init.lua b/lua/lsp/null-ls/init.lua new file mode 100644 index 00000000..ce4c07d9 --- /dev/null +++ b/lua/lsp/null-ls/init.lua @@ -0,0 +1,44 @@ +local M = {} + +function M.list_supported_provider_names(filetype) + local names = {} + + local formatters = require "lsp.null-ls.formatters" + local linters = require "lsp.null-ls.linters" + + vim.list_extend(names, formatters.list_supported_names(filetype)) + vim.list_extend(names, linters.list_supported_names(filetype)) + + return names +end + +function M.list_unsupported_provider_names(filetype) + local names = {} + + local formatters = require "lsp.null-ls.formatters" + local linters = require "lsp.null-ls.linters" + + vim.list_extend(names, formatters.list_unsupported_names(filetype)) + vim.list_extend(names, linters.list_unsupported_names(filetype)) + + return names +end + +-- TODO: for linters and formatters with spaces and '-' replace with '_' +function M.setup(filetype, options) + options = options or {} + + local ok, _ = pcall(require, "null-ls") + if not ok then + require("core.log"):error "Missing null-ls dependency" + return + end + + local formatters = require "lsp.null-ls.formatters" + local linters = require "lsp.null-ls.linters" + + formatters.setup(filetype, options) + linters.setup(filetype, options) +end + +return M |