local null_ls = require("null-ls")

null_ls.setup({
  sources = {
    -- Code actions
    null_ls.builtins.code_actions.shellcheck,
    null_ls.builtins.code_actions.statix,
    -- Completion
    null_ls.builtins.completion.spell,
    -- Diagnostics
    null_ls.builtins.diagnostics.deadnix,
    null_ls.builtins.diagnostics.shellcheck,
    null_ls.builtins.diagnostics.statix,
  },
})

-- disable (c)spell initially
null_ls.disable("spell")

-- make sources toggle able
require("which-key").register({
  n = {
    name = "null-ls",
    s = {
      function()
        null_ls.toggle("spell")
      end,
      "spell",
    },
  },
}, { prefix = "<leader>t" })
