Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions fixtures/small/array_call_chain_with_block_comment_actual.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
CommonFields::OBVIOUSLY,
CommonFields::THESE,
CommonFields::ARE,
CommonFields::FAKE_RESOURCE.with_wombo(true).with_combo(true).with_explosion(true)
]
.map do |field|
# Swap things out, to make sure.
override || field
end
10 changes: 10 additions & 0 deletions fixtures/small/array_call_chain_with_block_comment_expected.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
CommonFields::OBVIOUSLY,
CommonFields::THESE,
CommonFields::ARE,
CommonFields::FAKE_RESOURCE.with_wombo(true).with_combo(true).with_explosion(true)
]
.map do |field|
# Swap things out, to make sure.
override || field
end
2 changes: 1 addition & 1 deletion librubyfmt/src/format_prism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ fn call_chain_elements_are_user_multilined<'src>(
// placement, the user probably intended to break this onto multiple lines anyways.
let has_comment = ps.has_comment_in_offset_span(
call_chain_elements[0].location().end_offset(),
start_loc_for_call_node_in_chain(&call_chain_elements[1].as_call_node().unwrap()),
call_chain_elements.last().unwrap().location().end_offset(),
);
if is_literal_expression && !has_comment {
call_chain_elements = &call_chain_elements[1..];
Expand Down