IntelliJ for the Fuchsia Tree
This plugin assists developers working on Dart and Fuchsia code that‘s developed in the main Fuchsia development tree to use IntelliJ. Because of the intricacies and peculiarities of the Fuchsia build system the stock Dart and Flutter plugins don’t work well out of the box.
- Check out and build the Fuchsia tree.
- Symlink the default analysis options file into the root of your Fuchsia tree:
ln -s build/dart/default_analysis_options .analysis_options. This will allow the analysis server running under IntelliJ to pick up Fuchsia's analysis settings.
- Install IntelliJ IDEA, Community Edition is fine.
- Start IntelliJ IDEA
- On the Welcome screen select the Configure drop down and choose Plugins.
- Install the Dart and Flutter plugins from the repository.
- Install plugin from disk... select
- Restart IntelliJ IDEA to activate the plugins.
- Pick Create New Project on the Welcome screen.
- Choose Empty Project.
- Choose the location of your top-level Fuchsia source directory.
- When the Project Structure UI comes up just hit OK.
- A notification saying New Modules Found should pop up, press Add.
- If you don’t see it try tapping the little speech bubble in the lower right corner of the screen.
- Note: if you have
.packages files left in your tree the modules will be misconfigured. Delete the
.packages files before adding the modules.
When the plugin is installed if treats any project with a
.jiri_manifest file in its root as a Fuchsia tree.
In a Fuchsia tree plugin currently does the following:
- Configures the Dart plugin to use the Dart SDK in
out/debug-x86-64/host_x64/dart-sdk. This makes analysis of Dart and Flutter code for Fuchsia to work correctly. In particular, files generated for FIDL interfaces are found so that source navigation, completion and analysis work well.
- Uses GN to find all directories in the configured build that contain Dart or Flutter code. It prompts to add these as modules when the project is opened and adds a menu item to do that after the fact under Tools/Fuchsia Tree menu.
The work is just beginning. Future improvements might include:
- Suppressing suggestions to run
pub from the Dart plugin.
- Configuring Git VCS roots automatically.
- Building from IntelliJ.
- Deploying to a Fuchsia device from IntelliJ.
- Launching code on a Fuchsia device and attaching a debugger to running code.
- Test support.
- Configuring the Copyright plugin automatically.
- FIDL language support.
- Navigation from generated FIDL methods to the FIDL file that declares them.
- Jiri source control integration.
- Configure the analyzer correctly without having to symlink
- Creating new modules from within the IDE.
BUILD.gn files as source files are added / removed / renamed.
- Translating dependencies between GN targets into dependencies between IntelliJ modules.
- Support for Fuchsia development outside of the Fuchsia tree (perhaps in a separate plugin).
- Scripts to build the plugin.
- Icons in the plugin UI.
I have no plans to implement most of this. It will be driven by my needs, help and feedback.
This plugin just glues together the existing work in the Flutter plugin, Dart plugin, Fuchsia build system and Fuchsia Dart SDK. Ian McKellar wrote the code but Devon Carew supplied excellent advice.
Follow the first 3 or 4 steps of the flutter-intellij instructions but with this repo instead of theirs.