Merge pull request #159 from ksonj/python-isort

languages/python: add black-and-isort formatter
This commit is contained in:
NotAShelf 2023-10-20 17:49:09 +03:00 committed by GitHub
commit 0631fccccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View file

@ -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

View file

@ -39,6 +39,34 @@ with builtins; let
)
'';
};
isort = {
package = pkgs.isort;
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";