Development Setup¶
This guide walks through setting up a development environment for the BerryCrush IntelliJ plugin.
Prerequisites¶
Required Software¶
| Software | Version | Download |
|---|---|---|
| JDK | 21+ | Adoptium |
| IntelliJ IDEA | 2025.3+ | JetBrains |
| Git | 2.x | Git |
Verify Installation¶
# Java
java -version
# Should show Java 21 or higher
# Gradle (optional, wrapper included)
./gradlew --version
# Git
git --version
Clone Repository¶
IDE Setup¶
Open Project¶
- Launch IntelliJ IDEA
- File → Open
- Navigate to
berrycrush-workspace/intellij - Click OK
- Select Open as Project
Import Gradle Project¶
When prompted: 1. Select Import Gradle Project 2. Use Gradle wrapper 3. Enable auto-import
Configure JDK¶
- File → Project Structure (or
Cmd+;) - Project → SDK
- Select JDK 21 or add new one
- Apply → OK
Recommended Plugins¶
Install these plugins for better development experience:
| Plugin | Purpose |
|---|---|
| Grammar-Kit | BNF grammar support |
| PsiViewer | PSI tree inspection |
| Plugin DevKit | Plugin development support |
Install via Settings → Plugins → Marketplace
Build Project¶
From Terminal¶
From IDE¶
- Open Gradle tool window
- Navigate to Tasks → build → build
- Double-click to run
Expected Output¶
Run Plugin¶
Launch Sandbox IDE¶
Or from IDE: 1. Gradle → Tasks → intellij → runIde
This launches a new IntelliJ instance with your plugin installed.
Test Plugin Features¶
In the sandbox IDE:
1. Create a new project
2. Create a .scenario file
3. Verify syntax highlighting works
4. Test completion, navigation, etc.
Run Tests¶
All Tests¶
Single Test Class¶
Single Test Method¶
From IDE¶
- Right-click on test file
- Select Run 'TestName'
Debug Plugin¶
Debug in Sandbox¶
- Create a run configuration:
- Run → Edit Configurations
- Click + → Gradle
- Task:
runIde - Name: "Debug Plugin"
- Set breakpoints in your code
- Click Debug button
Debug Tests¶
- Open test file
- Set breakpoints
- Right-click test → Debug 'TestName'
Project Structure¶
intellij/
├── build.gradle.kts # Main build file
├── settings.gradle.kts # Project settings
├── gradle.properties # Properties (version, etc.)
├── gradlew # Gradle wrapper (Unix)
├── gradlew.bat # Gradle wrapper (Windows)
│
├── src/main/
│ ├── kotlin/ # Kotlin source files
│ │ └── com/berrycrush/intellij/
│ │ ├── language/ # Language definitions
│ │ ├── parser/ # Lexer and parser
│ │ ├── psi/ # PSI elements
│ │ ├── services/ # Application services
│ │ ├── navigation/ # Go to, find usages
│ │ ├── completion/ # Code completion
│ │ ├── refactoring/ # Rename, safe delete
│ │ ├── inspections/ # Code inspections
│ │ └── highlighting/ # Syntax highlighting
│ │
│ └── resources/
│ └── META-INF/
│ └── plugin.xml # Plugin descriptor
│
├── src/test/
│ ├── kotlin/ # Test files
│ └── testData/ # Test fixtures
│
├── config/
│ ├── detekt/ # Code style config
│ └── spotbugs/ # Bug detector config
│
└── gradle/
└── libs.versions.toml # Dependency versions
Key Files¶
plugin.xml¶
Plugin descriptor declaring all extensions:
<idea-plugin>
<id>com.berrycrush.intellij</id>
<name>BerryCrush</name>
<extensions defaultExtensionNs="com.intellij">
<fileType name="BerryCrush"
implementationClass="...BerryCrushFileType"
extensions="scenario;fragment"/>
<lang.parserDefinition
language="BerryCrush"
implementationClass="...BerryCrushParserDefinition"/>
<!-- More extensions... -->
</extensions>
</idea-plugin>
build.gradle.kts¶
Build configuration:
plugins {
id("org.jetbrains.intellij") version "1.17.0"
kotlin("jvm") version "1.9.22"
}
intellij {
version.set("2025.3")
plugins.set(listOf(/* dependencies */))
}
tasks {
patchPluginXml {
sinceBuild.set("253")
untilBuild.set("253.*")
}
}
gradle.properties¶
Common Tasks¶
Clean Build¶
Check Code Style¶
Run All Checks¶
Includes: compile, test, detekt, spotbugs
Build Distribution¶
Output: build/distributions/berrycrush-intellij-{version}.zip
Publish to Marketplace¶
Requires token in gradle.properties:
Troubleshooting¶
Gradle Sync Failed¶
- Check internet connection
- File → Invalidate Caches / Restart
- Delete
.gradledirectory and re-sync
Tests Not Found¶
- Ensure test files are in
src/test/kotlin - Check test classes extend
BasePlatformTestCase - Run Gradle → Tasks → verification → test
Plugin Not Loading¶
- Check
plugin.xmlsyntax - Verify all extension classes exist
- Check IntelliJ log: Help → Show Log in Finder
Sandbox IDE Crashes¶
- Increase memory in
gradle.properties: - Clean and rebuild
PSI Issues¶
- Install PsiViewer plugin
- Use Tools → View PSI Structure
- Compare expected vs actual PSI tree