Revise IntelliJ code style to wrap function arguments
if long, with a new line after ( and before ), and
aligning arguments at the continuation indent rather
than the end of the function.
This always moves arguments back to near the function
level, which helps to avoid massive indent blocks when
the line before the arguments themselves are long.
This example function:
void foo(int a, int b, int c) {
//
}
was previously wrapped to:
void foo(int a,
int b,
int c) {
}
Now it becomes:
void foo(
int a, int b,
int c
) {
//
}
Here's a concrete example
Before
client_change_state_->async_send_request(request,
[this, transition](rclcpp::Client<lifecycle_msgs::srv::ChangeState>::SharedFuture future) {
auto response = future.get();
if (response->success) {
RCLCPP_INFO(parent_->get_logger(),
"Transition %i successfully triggered on component %s",
static_cast<int>(transition),
this->remote_node_name_.c_str());
} else {
RCLCPP_ERROR(parent_->get_logger(),
"Failed to trigger transition %i on component %s",
static_cast<unsigned int>(transition),
this->remote_node_name_.c_str());
}
});
After
client_change_state_->async_send_request(
request, [this, transition](rclcpp::Client<lifecycle_msgs::srv::ChangeState>::SharedFuture future) {
auto response = future.get();
if (response->success) {
RCLCPP_INFO(parent_->get_logger(), "Transition %i successfully triggered on component %s",
static_cast<int>(transition), this->remote_node_name_.c_str()
);
} else {
RCLCPP_ERROR(parent_->get_logger(), "Failed to trigger transition %i on component %s",
static_cast<unsigned int>(transition), this->remote_node_name_.c_str()
);
}
}
);
This always moves arguments back to near the function level, which helps to avoid massive indent blocks when the line before the arguments themselves are long.
This example function:
was previously wrapped to:
Now it becomes:
Here's a concrete example
Before
After