This plugin provides support for the Dart programming language.
See the plugin documentation for help to get started with Dart development and the IntelliJ IDEA plugin.
Please file issues at YouTrack bug tracker.
How to set up IntelliJ IDEA project for developing Dart Plugin.
Prerequisites:
- Git command line client
- The latest IntelliJ IDEA Ultimate installed. Ensure the following installed plugins are enabled: Git, Kotlin, Java Internationalization, IntelliLang, JUnit, Plugin DevKit, Properties, UI Designer. Additionally install 'Dart' and 'Grammar-Kit' plugins: start IntelliJ IDEA, on Welcome screen click Plugins. Find plugins and install them. Restart IDE.
-
Clone the following 2 repositories to neighbor folders (on Windows use a short path, as there is a maximum allowed length):
git clone https://github.com/JetBrains/intellij-plugins
git clone https://github.com/JetBrains/intellij-community
Run
getPlugins.sh
(getPlugins.bat
on Windows) fromintellij-community/
. It will clonehttps://github.com/JetBrains/android.git
repository to theintellij-community/android
folder. If it's already cloned, just update it usinggit pull
. -
Open and build the
intellij-community
project as described in its README file. -
Open File | Project Structure | Modules |
[+]
| Import Module, selectintellij-plugins/Dart/Dart-community.iml
. In the same Project Structure dialog open the Dependencies tab of theintellij.idea.community.main
module (intellij
>idea
>community
>main
), click[+]
and add a module dependency on theDart-community
module. -
Open Settings (Preferences) | Version Control | Directory Mappings and add
intellij-plugins
as a 3rd Git root if it's not already there. -
The project is ready to use. Use
IDEA
run configuration to start IntelliJ IDEA Community Edition + Dart Plugin from sources. -
In order to be able to run tests that use real Dart Analysis Server, do the following:
- Make sure you have Dart SDK installed locally. It can be downloaded from the Dart SDK Archive.
- Open
Run | Edit Configurations...
dialog. - Click
Edit configuration templates...
in the bottom-left corner. - Find
JUnit
and add Dart SDK path to the VM Options field like this:-Ddart.sdk=path/to/real/dart/sdk
. VM Options field is the one that has only-ea
text by default.
-
To run all Dart plugin tests, right-click the
Dart/testSrc
folder in the Project View and select 'Run all tests'.- To run only those tests that do not use real Dart Analysis Server, use context menu of the
Dart/testSrc/com/jetbrains/lang/dart
folder. (At the moment of writing, 3 of them are expected to fail:DartInjectionTest.testRegExp()
,DartHighlightingTest.testSimplePolymer()
, andDartHighlightingTest.testScriptSrcPathToPackagesFolder()
.) - Tests that use real Dart Analysis Server reside in the
Dart/testSrc/com.jetbrains.dart/analysisServer
folder. A few of them are expected to fail.
- To run only those tests that do not use real Dart Analysis Server, use context menu of the
-
[Optional] To enable internal developer actions add "idea.is.internal=true" to the idea.properties file (Help -> Edit Custom Properties...). The menu actions Tools -> View PSI Structure... as well as the Tools -> Internal Actions should be visible after restarting.
-
Enjoy! All functionality should work. Most of the tests should pass. Zero mandatory local changes in
intellij-plugins
repository. There should be 3 locally changed files inintellij-community
repository, each having exactly one added line, just keep these files in a separate '~never commit' changelist and do not worry about them:- intellij-community/intellij.idea.community.main.iml (line
<orderEntry type="module" module-name="Dart-community" />
) - intellij-community/.idea/modules.xml (line
<module fileurl="file://$PROJECT_DIR$/../intellij-plugins/Dart/Dart-community.iml" ... />
) - intellij-community/.idea/vcs.xml (line
<mapping directory="$PROJECT_DIR$/../intellij-plugins" vcs="Git" />
)
- intellij-community/intellij.idea.community.main.iml (line
All contributed PRs should:
- be formatted with the Java formatter (Code -> Reformat Code)
- not introduce new warnings reported by the IDE
- not break any of the tests that were passing before your changes
- if possible, additional tests for the change in functionality should be included
- Open the Registry... dialog by opening Find Action,
Ctrl + Shift + A
and typingRegistry...
- Find the key
dart.server.vm.options
and include the flags:--disable-service-auth-codes --observe=8888
- Restart the Dart Analysis Server by clicking on the
Restart Dart Analysis Server
button in the Analysis window - Open a Observatory browser at
http://localhost:8888/
- To open Dart Devtools, copy the
ws://localhost:8888/ws
portion ofvm@ws://localhost:8888/ws
out of thename
field at the top of Observatory. - If you haven't already install DevTools with
pub global activate devtools
, the Dart SDK must be2.3.0
or higher - Launch DevTools with
devtools
, when prompted paste in thews://localhost:8888/ws
contents