Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/peterjclaw/vscode-tuck

VSCode extension for Tuck
https://github.com/peterjclaw/vscode-tuck

formatter python vscode-extension

Last synced: about 1 month ago
JSON representation

VSCode extension for Tuck

Awesome Lists containing this project

README

        

# VSCode Tuck

[![CircleCI](https://circleci.com/gh/PeterJCLaw/vscode-tuck.svg?style=svg)](https://circleci.com/gh/PeterJCLaw/vscode-tuck)

VSCode extension for [tuck][] -- semi-automated Python formatting.

[tuck]: https://github.com/PeterJCLaw/tuck

## Install

Install from the [Extension Marketplace][marketplace] using this extension's
full name: `peterjclaw.tuck`.

[marketplace]: https://marketplace.visualstudio.com/items?itemName=peterjclaw.tuck

## Features

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.

### Examples

#### Function definition

Place cursor on `foo` or within the parentheses, then run the command:

``` python
def foo(bar: str, quox: int = 0) -> float:
return 4.2
```

wraps to:

``` python
def foo(
bar: str,
quox: int = 0,
) -> float:
return 4.2
```

#### List comprehension

Place cursor on `for`, then run the command:

``` python
[x for x in 'aBcD' if x.isupper()]
```

wraps to:

``` python
[
x
for x in 'aBcD'
if x.isupper()
]
```

## Release Notes

See [CHANGELOG.md](./CHANGELOG.md).

## Attribution

Tuck uses [`asttokens`][asttokens] to aid its handling of the Python AST.
`asttokens` is included in the extension, licensed under Apache 2.0.

[asttokens]: https://pypi.org/project/asttokens/