summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp/null-ls/init.lua
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
commit977990584331307dd5e71ebbbbd6b45b9c961996 (patch)
treea8b3d78e80f586da192a576dd678e2fbc8ac8e00 /.config/nvim/lua/lsp/null-ls/init.lua
parent99d00f47fe780dbb021149db2f93d202a2b8b025 (diff)
Updates to nvim lsp
Diffstat (limited to '.config/nvim/lua/lsp/null-ls/init.lua')
-rw-r--r--.config/nvim/lua/lsp/null-ls/init.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/.config/nvim/lua/lsp/null-ls/init.lua b/.config/nvim/lua/lsp/null-ls/init.lua
new file mode 100644
index 0000000..f2b1042
--- /dev/null
+++ b/.config/nvim/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, option)
+ option = option or {}
+
+ local ok, _ = pcall(require, "null-ls")
+ if not ok then
+ require("core.log"):get_default().error "Missing null-ls dependency"
+ return
+ end
+
+ local formatters = require "lsp.null-ls.formatters"
+ local linters = require "lsp.null-ls.linters"
+
+ formatters.setup(filetype, option)
+ linters.setup(filetype, option)
+end
+
+return M