Skip to content
guillermooo edited this page Oct 3, 2014 · 6 revisions

You can run Dart files without leaving Sublime Text.

The Dart plugin for Sublime Text requires your project to follow the pub package layout conventions.

Smart Run

Detects the current file type and automatically starts the most suitable action.

To take full advantage of Smart Run, you need to configure the following settings:

  • dart_dartium_path
  • dart_user_browsers

See the Settings section for more information.

Key Bindings

Key Sequence Function
F7 Runs the primary action for the file type.
Ctrl+F7 Runs the secondary action for the file type.
General Notes

Whenever you use the keyboard shortcuts mentioned above (or their equivalent command palette items), Smart Run will remember the file name of the active file. Subsequently, it will keep running the same file regardless of the active file in Sublime Text.

To update the file name remembered by Smart Run with the active file in Sublime Text, use these keyboard shortcuts (or their equivalent items in the command palette).

Key Sequence Function
Shift+F7 Runs the primary action on the active file.
Ctrl+Shift+F7 Runs the secondary action on the active file.
Primary Action

If the active file in Sublime Text is under the web directory, the project will be served as Dart code via pub serve and Dartium will be started (if present on the system).

If the active file is under the bin directory, it will be run as a script.

If the active file is under the example directory, it will be run either as as a web app or as a script, depending on some heuristics.

If the active file is pubspec.yaml, pub get is run.

Secondary Action

If the active file in Sublime Text is under the web directory, the project will be served via pub serve and a user-defined default browser will be started (if defined in the User settings).

To change the default user-defined browser, you can edit the User settings file manually or use the Dart: Set Default User Browser command available from the command palette. (See the Keyboard Shorcuts topic for more information.)

If the active file is under the bin directory, it will be run as a script through the Observatory.

If the active file is under the example directory, it will be run either as as a web app or as a script as just described, depending on some heuristics.

If the active file is pubspec.yaml, a menu with multiple options will be shown.

Stopping Smart Run

To stop any processes started by Smart Run, select Dart: Stop from the command palette or use a keyboard shortcut. (See the Keyboard Shortcuts topic for more information.)


Clone this wiki locally