|
1 | 1 | # IntelliJ Erlang Plugin Development Guide
|
2 | 2 |
|
| 3 | +## Official IntelliJ Platform SDK Documentation |
| 4 | + |
| 5 | +This project follows the IntelliJ Platform Plugin SDK guidelines. For comprehensive information on plugin development, refer to: |
| 6 | + |
| 7 | +- [IntelliJ Platform SDK Documentation](https://plugins.jetbrains.com/docs/intellij/welcome.html) |
| 8 | +- [IntelliJ Plugin Development Quick Start Guide](https://plugins.jetbrains.com/docs/intellij/plugins-quick-start.html) |
| 9 | +- [Gradle IntelliJ Plugin Documentation](https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html) |
| 10 | + |
| 11 | +## Standard Gradle Commands |
| 12 | + |
| 13 | +The plugin uses the Gradle build system with the Gradle IntelliJ Plugin. Here are the common commands: |
| 14 | + |
| 15 | +```bash |
| 16 | +# Build the plugin distribution (zip file) |
| 17 | +./gradlew buildPlugin |
| 18 | + |
| 19 | +# Run the tests |
| 20 | +./gradlew test |
| 21 | + |
| 22 | +# Run an IDE instance with the plugin installed |
| 23 | +./gradlew runIde |
| 24 | + |
| 25 | +# Clean build directory |
| 26 | +./gradlew clean |
| 27 | + |
| 28 | +# Verify plugin compatibility with specified IDE version |
| 29 | +./gradlew verifyPlugin |
| 30 | +``` |
| 31 | + |
3 | 32 | ## Java Version Compatibility Requirements
|
4 | 33 |
|
5 | 34 | The IntelliJ Erlang plugin has specific Java version requirements for different components:
|
@@ -94,4 +123,53 @@ This setup addresses the following issues:
|
94 | 123 | - #957: Java version compatibility error with JpsErlangModelSerializerExtension
|
95 | 124 | - #976: IntelliJ 2022.1 class version compatibility error
|
96 | 125 | - #1022: Unsupported class version error
|
97 |
| -- #1054: Intellij Erlang plugin run configuration not working |
| 126 | +- #1054: Intellij Erlang plugin run configuration not working |
| 127 | + |
| 128 | +## Getting Started with Plugin Development |
| 129 | + |
| 130 | +To start contributing to the Erlang plugin: |
| 131 | + |
| 132 | +1. Fork the repository on GitHub |
| 133 | +2. Clone your fork locally |
| 134 | +3. Import the project as a Gradle project in IntelliJ IDEA |
| 135 | +4. Run `./gradlew runIde` to test your changes in a development instance |
| 136 | + |
| 137 | +### Project Structure |
| 138 | + |
| 139 | +- `src/` - Main plugin source code |
| 140 | +- `jps-plugin/` - JPS module for build system integration |
| 141 | +- `resources/` - Plugin resources (icons, templates, etc.) |
| 142 | +- `testData/` - Test data files |
| 143 | +- `tests/` - Test source code |
| 144 | + |
| 145 | +### Development Workflow |
| 146 | + |
| 147 | +1. Create a branch for your feature or fix |
| 148 | +2. Make your changes |
| 149 | +3. Run tests with `./gradlew test` |
| 150 | +4. Test the plugin with `./gradlew runIde` |
| 151 | +5. Submit a pull request |
| 152 | + |
| 153 | +### Common Development Tasks |
| 154 | + |
| 155 | +- **Adding a new inspection**: Create a class that extends `org.intellij.erlang.inspection.ErlangInspection` |
| 156 | +- **Adding a new intention action**: Create a class that implements `org.intellij.erlang.intention.ErlangIntention` |
| 157 | +- **Adding new file templates**: Add template files to `resources/fileTemplates/` |
| 158 | +- **Modifying the parser**: Update `grammars/erlang.bnf` and run the grammar generator |
| 159 | + |
| 160 | +## Debugging |
| 161 | + |
| 162 | +To debug the plugin: |
| 163 | + |
| 164 | +### Method 1: Using Gradle command line |
| 165 | +1. Run `./gradlew runIde --debug-jvm` |
| 166 | +2. Connect to the JVM using remote debugging in IntelliJ IDEA |
| 167 | +3. Set breakpoints in your code |
| 168 | + |
| 169 | +### Method 2: Using IntelliJ directly (recommended) |
| 170 | +1. Open the Gradle tool window in IntelliJ IDEA |
| 171 | +2. Navigate to Tasks → intellij → runIde |
| 172 | +3. Right-click on runIde and select "Debug 'intellij-erlang [runIde]'" |
| 173 | +4. Set breakpoints in your code |
| 174 | + |
| 175 | +This second method is more convenient as it allows you to simply click the debug button on an existing run configuration or create a permanent run configuration with debugging enabled. The debugger will attach automatically, and you can start debugging right away without manual connection steps. |
0 commit comments