mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00
Avoid hard line break after dangling open-parenthesis comments (#6380)
## Summary Given: ```python [ # comment first, second, third ] # another comment ``` We were adding a hard line break as part of the formatting of `# comment`, which led to the following formatting: ```python [first, second, third] # comment # another comment ``` Closes https://github.com/astral-sh/ruff/issues/6367.
This commit is contained in:
parent
63692b3798
commit
b763973357
6 changed files with 82 additions and 18 deletions
|
@ -95,8 +95,9 @@ use std::rc::Rc;
|
|||
use ruff_python_ast::{Mod, Ranged};
|
||||
|
||||
pub(crate) use format::{
|
||||
dangling_comments, dangling_node_comments, leading_alternate_branch_comments, leading_comments,
|
||||
leading_node_comments, trailing_comments, trailing_node_comments,
|
||||
dangling_comments, dangling_node_comments, dangling_open_parenthesis_comments,
|
||||
leading_alternate_branch_comments, leading_comments, leading_node_comments, trailing_comments,
|
||||
trailing_node_comments,
|
||||
};
|
||||
use ruff_formatter::{SourceCode, SourceCodeSlice};
|
||||
use ruff_python_ast::node::AnyNodeRef;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue