summaryrefslogtreecommitdiff
path: root/fnl/conf/pkgs/null-ls.fnl
blob: 9908823ddaa1aa094388158eb9b983cf51853295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(local lsp-conf (require :conf.lsp))
(local null-ls (require :null-ls))

(local fmt null-ls.builtins.formatting)
(local diag null-ls.builtins.diagnostics)

(fn executable? [program]
  (fn []
    (= 1 (vim.fn.executable program))))

(null-ls.setup {:update_in_insert false
                :debug true
                :on_attach (fn [client buf]
                             (lsp-conf.attach client buf true))
                :sources [fmt.alejandra
                          fmt.fnlfmt
                          (fmt.black.with {:condition (executable? :black)})
                          (fmt.goimports.with {:condition (executable? :goimports)})
                          (fmt.gofumpt.with {:condition (executable? :gofumpt)})
                          (fmt.raco_fmt.with {:condition (executable? :raco)})
                          (fmt.terraform_fmt.with {:condition (executable? :terraform)})]})