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

dartanalyzer forces things like indents and spaces when reformatting afile. Should it use a preferences file for it? #261

Closed
DartBot opened this issue Jun 4, 2015 · 9 comments

Comments

@DartBot
Copy link

DartBot commented Jun 4, 2015

Originally opened as dart-lang/sdk#23511

This issue was originally filed by [email protected]


What steps will clearly show the issue / need for enhancement?

  1. Use dart-tools package for atom
  2. On package settings change space tab to something different of 2
  3. Type some code
  4. save the file (Ctrl + S)

What is the current output?
When formatting, dartanalyzer forces things like tab length to 2 and removes spaces on parenthesis and curly braces.

What would you like to see instead?
Since Dart Editor is going to dissapear, It'd be nice if dartanalyzer respect user preferences, maybe as flags or config files (maybe a analyzer.json?), when formatting code.

What version of the product are you using? On what operating system?
I'm using dart-sdk 1.10.0 on Windows 7.

Please provide any additional information below.
I opened a bug on dart-tools project which brings dart tools to atom users as an option to Java IDEs (radicaled/dart-tools#29).

Thanks in advance

@DartBot
Copy link
Author

DartBot commented Jun 4, 2015

<img src="https://avatars.githubusercontent.com/u/5840555?v=3" align="left" width="48" height="48"hspace="10"> Comment by bwilkerson


Added Area-Formatter, Triaged labels.

@munificent
Copy link
Member

The main goal of the formatter is to make code more consistent from user to user. Configurability, while I understand why people want it, doesn't line up with that goal. Sorry.

@Aza1
Copy link

Aza1 commented Jun 22, 2015

@munificent Some Organizations like to standardize on a specific formatting style.
Surely you should allow them to settle on what works for them.
You can't enforce your preferences on the entire Dart Community... :D

@munificent
Copy link
Member

Some Organizations like to standardize on a specific formatting style.

That's great! The best style for this is the one that everyone else is also using.

You can't enforce your preferences on the entire Dart Community... :D

Not on the entire community, but on the subset of the community that choose to use the formatter... yes we can. :)

The FAQ has some more details on why the formatter is written this way.

@Aza1
Copy link

Aza1 commented Jun 23, 2015

@munificent
Could we then at least standardize on 4 spaces, 2 is too CLUNKY and crammed together.
I know I'm being silly requesting this, but still....

@a14n
Copy link
Contributor

a14n commented Jun 23, 2015

Nooooo, 2 spaces is way better than 4. It allows to maximize the information density of code on the page, while still having enough white space that indentation is easily visible.

I <3 the current style guide and its formatter.

@Aza1
Copy link

Aza1 commented Jun 23, 2015

@a14n
"information density"
Why is this worth more than clearer visibility.
Many of us don't have as great an eyesight as you do.

How can 'convenience' win over 'usability'?

@a14n
Copy link
Contributor

a14n commented Jun 23, 2015

I'm not arguing for density over visibility. 2 spaces is imho a good balance between them.

I use 4 spaces in my day to day job and 2 spaces on my free time job and I feel the code more readable with 2 spaces indent. But you're free to disagree ;)

@munificent
Copy link
Member

Could we then at least standardize on 4 spaces, 2 is too CLUNKY and crammed together.

We have already standardized on two. Google has always used that for almost all of our languages, and much of the web ecosystem seems to have settled on two as well.

Personally, I like four as well, but almost all Dart code used two, even before the formatter or style guide existed.

gosom pushed a commit to gosom/coala-bears that referenced this issue Jul 15, 2017
As pointed out here dart-lang/dart_style#261,
dartanalyzer only supports indentation using 2 spaces. This commit
changes DartLintBear to check that ``use_spaces`` is True and
``indent_size`` is 2 and raises a ``ValueError`` if not.

Fixes coala#897
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

4 participants