mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-22 12:35:08 +00:00
Format ExprTuple (#4963)
This implements formatting ExprTuple, including magic trailing comma. I intentionally didn't change the settings mechanism but just added a dummy global const flag. Besides the snapshots, I added custom breaking/joining tests and a deeply nested test case. The diffs look better than previously, proper black compatibility depends on parentheses handling. --------- Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
8161757229
commit
e586c27590
25 changed files with 735 additions and 219 deletions
|
@ -30,6 +30,10 @@ mod trivia;
|
|||
|
||||
include!("../../ruff_formatter/shared_traits.rs");
|
||||
|
||||
/// TODO(konstin): hook this up to the settings by replacing `SimpleFormatOptions` with a python
|
||||
/// specific struct.
|
||||
pub(crate) const USE_MAGIC_TRAILING_COMMA: bool = true;
|
||||
|
||||
/// 'ast is the lifetime of the source code (input), 'buf is the lifetime of the buffer (output)
|
||||
pub(crate) type PyFormatter<'ast, 'buf> = Formatter<'buf, PyFormatContext<'ast>>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue