Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline strings should be weighted more towards alignment #133

Closed
nex3 opened this issue Jan 13, 2015 · 2 comments
Closed

Multiline strings should be weighted more towards alignment #133

nex3 opened this issue Jan 13, 2015 · 2 comments

Comments

@nex3
Copy link
Member

nex3 commented Jan 13, 2015

Currently this:

testCase._error(
    'Callback ${id}called ($actualCalls) after test case '  
    '${testCase.description} has already been marked as '
    '${testCase.result}.$reason');

is formatted as so:

testCase._error('Callback ${id}called ($actualCalls) after test case '  
    '${testCase.description} has already been marked as '
    '${testCase.result}.$reason');

I like the heuristic of putting an argument on the opening line in general, but I think when it's a continued multiline string it's more important that each line be aligned.

@Hixie
Copy link

Hixie commented Aug 24, 2016

In #526, the proposed formatting would make the above example format as follows:

testCase._error(
  'Callback ${id}called ($actualCalls) after test case '  
  '${testCase.description} has already been marked as '
  '${testCase.result}.$reason'
);

...which makes it even clearer where the expression starts and ends.

nex3 added a commit that referenced this issue Jun 15, 2017
This adds a zero-width split before the first string, and forces it to
split if the adjacent strings split.

Closes #133
@munificent
Copy link
Member

In the forthcoming tall style, this code gets formatted as:

testCase._error(
  'Callback ${id}called ($actualCalls) after test case '  
  '${testCase.description} has already been marked as '
  '${testCase.result}.$reason',
);

All of the strings are aligned, so I think this is done now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants