mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 05:19:48 +01:00
languages/python: add black-and-isort formatter
Adds two additional formatters for python: - isort, to only sort imports - black-and-isort, which runs black + isort in a compatible manner
This commit is contained in:
parent
897493a65f
commit
e3b55d9798
2 changed files with 30 additions and 0 deletions
|
@ -73,3 +73,5 @@ https://github.com/jacekpoz[jacekpoz]:
|
|||
https://github.com/ksonj[ksonj]:
|
||||
|
||||
* Add support to change mappings to utility/surround
|
||||
|
||||
* Add black-and-isort python formatter
|
||||
|
|
|
@ -39,6 +39,34 @@ with builtins; let
|
|||
)
|
||||
'';
|
||||
};
|
||||
isort = {
|
||||
package = pkgs.black;
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.isort.with({
|
||||
command = "${cfg.format.package}/bin/isort",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
black-and-isort = {
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "black";
|
||||
text = ''
|
||||
black --quiet - "$@" | isort --profile black -
|
||||
'';
|
||||
runtimeInputs = [pkgs.black pkgs.isort];
|
||||
};
|
||||
nullConfig = ''
|
||||
table.insert(
|
||||
ls_sources,
|
||||
null_ls.builtins.formatting.black.with({
|
||||
command = "${cfg.format.package}/bin/black",
|
||||
})
|
||||
)
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
defaultDebugger = "debugpy";
|
||||
|
|
Loading…
Reference in a new issue