VSCode extension for tuck -- semi-automated Python formatting.
Install from the Extension Marketplace using this extension's
full name: peterjclaw.tuck
.
This extension current provides a single command, equivalent to calling tuck against the current file and using the cursor position as the position to wrap.
The command can most easily be run using the keyboard shortcut Alt+Shift+W.
Place cursor on foo
or within the parentheses, then run the command:
def foo(bar: str, quox: int = 0) -> float:
return 4.2
wraps to:
def foo(
bar: str,
quox: int = 0,
) -> float:
return 4.2
Place cursor on for
, then run the command:
[x for x in 'aBcD' if x.isupper()]
wraps to:
[
x
for x in 'aBcD'
if x.isupper()
]
See CHANGELOG.md.
Tuck uses asttokens
to aid its handling of the Python AST.
asttokens
is included in the extension, licensed under Apache 2.0.