Dart plugin: equivalent of DartEditor "Run as Javascript"
In the DartEditor, the Javascript version of a Dart application can be executed by selecting "Run as Javascript". Is there an equivalent function available in IDEA with the Dart plugin?
Please sign in to leave a comment.
We are in process of finding the best workflow for this. At the moment the following options are available:
1. Right click on pubspec.yaml, select Dart: Build. After successful build right click on *.html file in the build folder and select 'Create *.html...' . It creates run configuration and opens the dialog. In the dialog select browser in which you wish to debug.
2. Right click on *.dart file(s) and select 'Compile Dart to JavaScript'. Then create run configuration for the *.hml file in the same way. If you already have run configuration for this *.html file there will be no 'Create ...' option in the context menu. In this case open Run | Edit Configurations... and update existing JavaScript Debug run configuration or make its copy targeting another browser.
If you do not want to debug JavaScript, but just to test it in non-Dartium browser then after Dart:Build or 'Compile Dart to JavaScript' simply right click *.html file and select Open In Browser.
Normally the build folder is hidden from the Project view since it is excluded as an output folder. Is the only way to make this option work to make the build folder non-excluded?
This approach creates "compiled" files in my source directory so Option #1 is preferable to me. However, "Open In Browser" does work with these generated files so its an ok solution for now.
On a related note, I wasn't able to get "JavaScript Debug" to work with either Chrome. It opens a new Chrome window but the window is blank and the Jetbrains debug plugin does not activate. With Firefox, the JavaScript debug works. Are there any plans to use the source map information generated by the dart compiler to assist with javascript debugging of dart sources?
(I am on Linux)
Yes.
I'll ask responsible developer to take a look.
We support sourcemaps only for Google Chrome.
>> "It opens a new Chrome window but the window is blank"
Please send me idea log (Help -> Show Log in)
OK.
I took a look at the idea log, and nothing is put into the log at all when this happens: http://pastie.org/private/xhja7rezsrvycmjg5bhnw
The debugger starts and an empty Chrome window starts as well. After a few seconds, the debugger reports "Please ensure you have installed the extension and IDE port configured (current port 63342), or see Help". The extension is installed and configured on that port.
When I do Open in Browser->Dartium, it opens up my Chromium install instead of Dartium. I'm not sure why. It is pointing to the Chromium in my Dart SDK dir /opt/dart/chromium/chrome, but it isn't launching Dartium. Do I need to add a custom command line option or use a custom profile dir? Dartium runs fine from the DartEditor, but not from Intellij IDEA 13.1 with the latest Dart plugin.
Not a solution for you, but just FYI, Open in Browser -> Dartium works for me on 13.1.1 with the latest Dart plugin.
There's a bug inIntelliJ IDEA 13.1: if Chrome, Chromium or any other browser from chromium family IS running at the moment when you launch Open in Browser->Dartium or Debug in dartium then Dart app is opened in the new tab of already running browser instead of starting dartium. Workaround is to close all Chromium browsers before starting Dart app in Dartium. Other workaround is to disable JetBrains Extension in Chromium (but not in Dartium).
EAP with the fix and new version of Dart plugin will be published next week.
Thank you for the feedback.
I am indeed running Chrome (beta) while trying to launch Dartium from IDEA 13.1.1. It was still opening Chromium though (and apparently the Dartium version of it).
It looks like it was using my Chromium profile and all of those plugins to run Dartium (which confused me). I used the new option for using a custom profile in IDEA's Dart settings and this appears to be giving me the same behavior that I am seeing in the DartEditor!