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?

11 comments

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.

0

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.

0

AlexanderD wrote:

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.


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?

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.


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)

0

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?

Yes.

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)

I'll ask responsible developer to take a look.

0

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)

0

develar wrote:

We support sourcemaps only for Google Chrome.

OK.

>> "It opens a new Chrome window but the window is blank"
Please send me idea log (Help -> Show Log in)


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.

0

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.

0

Splaktar wrote:

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.

0

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).

0

EAP with the fix and new version of Dart plugin will be published next week.


0

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!

0

Please sign in to leave a comment.