I just started playing with Dart in Dart Editor.

Since Dart Editor is a distribution of Eclipse, I figured that to format my code, all I'd need to do is press crtl + shift + f. However, when I did this, it brought up the "find/replace" window instead. I tried seeing if there were any options in "preferences" to fix this, but I found none. (The preferences seem a bit bare-bones at this point.)

So, is there a short-cut key for formatting code? And if there is, why is it not crtl + shift + f like it is in other distributions of Eclipse?

有帮助吗?

解决方案

Update:

With Dart 1.2, released 2/26, you can format code through the Source menu, although the source menu doesn't exist in some situations and I'm not sure why. You can also use the shortcut Ctrl + Shift + R by default. To modify what the short cut is, you can go to Tools --> Preferences --> Key Bindings --> Export to File. Then search in the file for "Format" and modify the correct key binding, then reimport it.

Old answer:

The autoformat function for Dart code in the Dart Editor has not been introduced yet. From what I've read in the Dart formatter issue on the Dart issue tracker, it sounds like it should be introduced in version 1.2 of the Dart Editor, which hopefully won't be too long from now.

I actually did see it and use it for a few days (I think they rolled back 1.2), but there was still no keyboard shortcut for it. It was an option you needed to manually click. (Hopefully you can bind it yourself to a shortcut.)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top