mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-01 10:41:52 +00:00
language/python: migrate to conform/nvim-lint
This commit is contained in:
parent
09e5a13c61
commit
a5deffb890
1 changed files with 16 additions and 35 deletions
|
@ -66,26 +66,10 @@
|
|||
formats = {
|
||||
black = {
|
||||
package = pkgs.black;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.black.with({
|
||||
command = "${cfg.format.package}/bin/black",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
isort = {
|
||||
package = pkgs.isort;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.isort.with({
|
||||
command = "${cfg.format.package}/bin/isort",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
black-and-isort = {
|
||||
|
@ -96,15 +80,6 @@
|
|||
black --quiet - "$@" | isort --profile black -
|
||||
'';
|
||||
};
|
||||
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.black.with({
|
||||
command = "${cfg.format.package}/bin/black",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
|
||||
ruff = {
|
||||
|
@ -115,14 +90,6 @@
|
|||
ruff format -
|
||||
'';
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.ruff.with({
|
||||
command = "${cfg.format.package}/bin/ruff",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -272,8 +239,22 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
vim.lsp.null-ls.enable = true;
|
||||
vim.lsp.null-ls.sources.python-format = formats.${cfg.format.type}.nullConfig;
|
||||
vim.formatter.conform-nvim = {
|
||||
enable = true;
|
||||
# HACK: I'm planning to remove these soon so I just took the easiest way out
|
||||
setupOpts.formatters_by_ft.python =
|
||||
if cfg.format.type == "black-and-isort"
|
||||
then ["black"]
|
||||
else [cfg.format.type];
|
||||
setupOpts.formatters =
|
||||
if (cfg.format.type == "black-and-isort")
|
||||
then {
|
||||
black.command = "${cfg.format.package}/bin/black";
|
||||
}
|
||||
else {
|
||||
${cfg.format.type}.command = getExe cfg.format.package;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.dap.enable {
|
||||
|
|
Loading…
Add table
Reference in a new issue