2022-02-25 10:38:52 +01:00
|
|
|
local null_ls = require("null-ls")
|
2022-03-08 20:20:22 +01:00
|
|
|
local lsp = require("ambroisie.lsp")
|
2022-03-01 11:20:50 +01:00
|
|
|
local utils = require("ambroisie.utils")
|
|
|
|
|
2022-02-25 10:38:52 +01:00
|
|
|
null_ls.setup({
|
2022-03-08 20:20:22 +01:00
|
|
|
on_attach = lsp.on_attach,
|
2022-02-25 10:38:52 +01:00
|
|
|
})
|
2022-03-01 11:20:50 +01:00
|
|
|
|
2023-05-09 21:22:29 +02:00
|
|
|
-- Bazel
|
|
|
|
null_ls.register({
|
|
|
|
null_ls.builtins.diagnostics.buildifier.with({
|
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("buildifier"),
|
|
|
|
}),
|
|
|
|
null_ls.builtins.formatting.buildifier.with({
|
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("buildifier"),
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
|
2022-03-01 11:20:50 +01:00
|
|
|
-- Nix
|
|
|
|
null_ls.register({
|
|
|
|
null_ls.builtins.formatting.nixpkgs_fmt.with({
|
2024-03-12 12:31:16 +01:00
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("nixpkgs-fmt"),
|
2022-03-01 11:20:50 +01:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Python
|
|
|
|
null_ls.register({
|
|
|
|
null_ls.builtins.diagnostics.mypy.with({
|
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("mypy"),
|
|
|
|
}),
|
|
|
|
null_ls.builtins.diagnostics.pylint.with({
|
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("pylint"),
|
|
|
|
}),
|
|
|
|
null_ls.builtins.formatting.black.with({
|
|
|
|
extra_args = { "--fast" },
|
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("black"),
|
|
|
|
}),
|
|
|
|
null_ls.builtins.formatting.isort.with({
|
|
|
|
-- Only used if available
|
|
|
|
condition = utils.is_executable_condition("isort"),
|
|
|
|
}),
|
|
|
|
})
|