Navigation Menu

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

formatter issue: insert curly braces for orphan #16847

Closed
DartBot opened this issue Feb 15, 2014 · 11 comments
Closed

formatter issue: insert curly braces for orphan #16847

DartBot opened this issue Feb 15, 2014 · 11 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Feb 15, 2014

This issue was originally filed by @tatumizer


BEFORE:
  int zero;
  if (0==0)
    zero=0;
  else if (0==1)
    zero=1;
  else if (0==2)
    zero=2;
  
AFTER:
  int zero;
  if (0 == 0) zero = 0; else if (0 == 1) zero = 1; else if (0 == 2) zero = 2;

It is much easier to type without curly braces, and then hit some key and have them inserted, properly indented etc.
The way how formatter behaves right now makes things worse, not better IMO.
Otherwise, it's an excellent tool indeed

@kevmoo
Copy link
Member

kevmoo commented Feb 15, 2014

cc @pq.
Removed Priority-Unassigned label.
Added Priority-High, Area-Formatter, Triaged labels.

@clayberg
Copy link

The -t command line option should do this, but the formatter needs a pref page in the Editor to control its options.


Set owner to @pq.
Added this to the 1.3 milestone.
Removed Type-Defect, Priority-High labels.
Added Type-Enhancement, Priority-Medium labels.

@DartBot
Copy link
Author

DartBot commented Feb 16, 2014

This comment was originally written by @tatumizer


with or without flags, doesn't it look like a good idea to generate
if (0 == 0) zero = 0; else if (0 == 1) zero = 1; else if (0 == 2) zero = 2;
?
Formatter also concatenates array of 1-liner functions like
[ ()=> expr,
  () => expr,
  () ...
]
Probably it's a variant of previous problem.
 
 

@pq
Copy link
Member

pq commented Apr 9, 2014

Removed this from the 1.3 milestone.
Added this to the 1.4 milestone.

@kasperl
Copy link

kasperl commented May 8, 2014

Removed this from the 1.4 milestone.
Added this to the 1.5 milestone.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the 1.5 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@munificent
Copy link
Member

Added AssumedStale label.

@DartBot
Copy link
Author

DartBot commented Feb 13, 2015

This comment was originally written by @tatumizer


Bob: here's a brain-teaser for you.
  var x = [
    () => 5,
    () => 10,
    () => 15
  ];
If you invoke formatter (I use ver 1.9.0.dev_08_00) then it will concatenate it, so you get var x = [() => 5, () => 10, () => 15];
which is quite frustrating. And still, there's a way to cheat formatter into preserving original beauty.
Do you know how to do it (with some additional markup)?

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

This issue has been moved to dart-lang/dart_style#316.

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

6 participants