blob: 33e652f3ab175bbcc8f7a57848a5f65c51673327 [file] [log] [blame] [view]
# IntelliJ Plugin for FIDL
This repository contains the IntelliJ plugin for
[FIDL](https://fuchsia.dev/fuchsia-src/development/languages/fidl). For
information about contributing to this project, please read
[CONTRIBUTING.md](./CONTRIBUTING.md).
## Setup
To start, `git clone` this repository into a local directory named `fidl-plugin`
(the name is important - it is referenced by the IntelliJ configs stored in the
`/.iwjb` folder). This may be done from either the command line or the built in
IntelliJ git interface.
If you do not already have [Bazel](https://bazel.build/), install the command
line `bazel` package, following the instructions for your platform.
Next, install the following 3 IntelliJ plugins. While not strictly required,
using these will make working on the FIDL plugin a much smoother experience:
* [Bazel](https://plugins.jetbrains.com/plugin/8609-bazel) - This repo uses
the [Bazel](https://bazel.build/) build system. The Bazel
[plugin](https://ij.bazel.build/) allows for easier build and debug
integration.
* [Grammar-Kit](https://plugins.jetbrains.com/plugin/6606-grammar-kit) - A
JetBrains authored plugin that provides syntax highlighting and automatic
code generation for
[.bnf](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form) and
[.flex](https://www.jflex.de/) files.
* [PSIViewer](https://plugins.jetbrains.com/plugin/227-psiviewer) - Helpful
for navigating the IntelliJ plugin model during development.
The FIDL plugin is developed using JetBrains'
[DevKit](https://plugins.jetbrains.com/docs/intellij/using-dev-kit.html)
platform, so open the repository in IntelliJ and follow the instructions found
[here](https://plugins.jetbrains.com/docs/intellij/setting-up-environment.html)
to set up a local plugin development environment.
## Building
If you are using the Bazel plugin mentioned above, you should have a `Build
Plugin` Run Configuration preloaded in IntelliJ for you. You may also build
from the command line by navigating to the `fidl-plugin` directory and invoking
the following command:
```bash
bazel build :fidlplugin
```
## Development
To test plugin changes, you'll need to go through the laborious process of
reloading the plugin from source, then restarting IntelliJ to view your changes.
The plugin can be reloaded as follows:
1. Navigate to **Plugins** in your settings, and uninstall the existing FIDL
Plugin (if one has already been installed).
2. At the top of the dialog, click the settings icon next to **Marketplace**
and **Installed**, then select **Install Plugin from Disk...** from the
dropdown.
3. Install the plugin JAR, located at `fidl-plugin/blaze-bin/fidlplugin.jar`.
Repeat the above each time you make a change. Note that there may be a more
ergonomic workflow that integrate with IntelliJ's "Run..." functionality to
automatically build and run a sandboxed copy of IJ with your plugin installed.
If you figure out how to do this, please update this document with instructions.
If you add/remove BNF rules, make sure to update the relevant generated `.java`
dependencies in the `/src/fuchsia/developer/plugin/fidl/BUILD` file.