dartboard
dartboard copied to clipboard
Respect the Dart style guide by default
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.
#2 Related
- [ ] Set indentation (at first plugin start, for dart files)
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
@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.
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.
I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=549447 for this.
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?