dartboard icon indicating copy to clipboard operation
dartboard copied to clipboard

Respect the Dart style guide by default

Open jonas-jonas opened this issue 6 years ago • 7 comments

The Dart style guide sets some rules (recommendations) on how to format Dart code: https://www.dartlang.org/guides/language/effective-dart/style

We should set these by default from the plugin.

jonas-jonas avatar Jan 15 '19 14:01 jonas-jonas

#2 Related

jonas-jonas avatar Jan 15 '19 14:01 jonas-jonas

  • [ ] Set indentation (at first plugin start, for dart files)

jonas-jonas avatar Jan 29 '19 19:01 jonas-jonas

Currently it doesn't seem to be possible to set these settings per editor/contentType. It would be nice to have this set for only the Dart contentType as the formatter is quite inflexible. See https://github.com/dart-lang/sdk/issues/37451

jonas-jonas avatar Jul 09 '19 18:07 jonas-jonas

@mickaelistria

Do you know if it's possible to set the indentation settings (for example TabWidth), and related settings, on a per contentType basis?

For us it would be nice to set these settings for only Dart files as the Dart formatter is very opinionated and forces 2-space indentation on every file. Thus it would be nice to just set these settings for all Dart files.

jonas-jonas avatar Jul 16 '19 07:07 jonas-jonas

Do you know if it's possible to set the indentation settings (for example TabWidth), and related settings, on a per contentType basis?

I don't think it's possible right now. But there are things in Platform that might allow to implement it efficiently. This could for example be a new PreferenceScope for a given content-type, and then this Scope could be added to other scopes used by editors. In any case, it seems more like work to do in Platform first.

mickaelistria avatar Jul 16 '19 08:07 mickaelistria

I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=549447 for this.

jonas-jonas avatar Jul 21 '19 17:07 jonas-jonas

As this "feature" in the platform will likely not be addressed in the near future, I think we should show a Dialog on first access of preferences (which translates to creating or importing a new project or opening a Dart file) indicating, what the current situation is. The dialog should also give an option for the user to select if he wants to update the global settings for indentation or not.

I feel like this is a major usability issue (having the formatter & IDE not working together properly). So I will see if I find the time to work on this in the platform in the next month.

It might also be something for @lak-proddev to work on?

jonas-jonas avatar Jul 31 '19 12:07 jonas-jonas