summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp/null-ls/init.lua
blob: 571fb6bfc629359449a9bd46cb38e5ada2921421 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local M = {}

local Log = require "core.log"
local formatters = require "lsp.null-ls.formatters"
local linters = require "lsp.null-ls.linters"

function M:setup()
  local status_ok, null_ls = pcall(require, "null-ls")
  if not status_ok then
    Log:error "Missing null-ls dependency"
    return
  end

  null_ls.config()
  require("lspconfig")["null-ls"].setup(options.lsp.null_ls.setup)
  for _, filetype in pairs(options.lang) do
    if filetype.formatters then
      formatters.setup(filetype.formatters, filetype)
    end
    if filetype.linters then
      linters.setup(filetype.linters, filetype)
    end
  end
end

return M