Project Structure¶
Top-Level Layout¶
rescript-intellij-plugin/
├── src/
│ ├── main/
│ │ ├── kotlin/com/rescript/plugin/ # Kotlin source code
│ │ ├── java/com/rescript/plugin/lang/ # JFlex lexer definition
│ │ └── resources/ # Plugin resources
│ └── test/ # Test code
├── sphinx-docs/ # Documentation (Sphinx)
├── docs/ # Internal design documents
├── .steering/ # Steering workflow documents
├── .github/workflows/ # CI/CD workflows
├── build.gradle.kts # Gradle build script
├── gradle.properties # Version and platform config
├── settings.gradle.kts # Project settings
└── CLAUDE.md # Development conventions
Source Code Organization¶
All plugin code is under src/main/kotlin/com/rescript/plugin/:
Package |
Purpose |
Key Files |
|---|---|---|
|
Core definitions |
|
|
Lexer, parser, tokens |
|
|
PSI element classes |
|
|
Syntax highlighting |
|
|
LSP integration |
|
|
Run configurations |
|
|
Test runner |
|
|
Structure view |
|
|
Code folding |
|
|
Editor enhancements |
|
|
Completion features |
|
|
Navigation features |
|
|
Code analysis |
|
|
Formatting |
|
|
Code style |
|
|
Configuration |
|
|
Plugin settings |
|
|
Intention actions |
|
|
Surround with |
|
|
Import management |
|
|
Language injection |
|
|
Spellchecking |
|
|
Indexing |
|
|
File creation |
|
|
Status bar |
|
|
Code Lens |
|
|
JS preview |
|
|
Module hierarchy |
|
|
Paste actions |
|
|
Code generation |
|
|
Project wizard |
|
|
Comment toggle |
|
Resources¶
src/main/resources/
├── META-INF/
│ └── plugin.xml # Plugin descriptor (all extension points)
├── colorSchemes/
│ ├── RescriptDarcula.xml # Dark theme colors
│ └── RescriptDefault.xml # Light theme colors
├── liveTemplates/
│ └── ReScript.xml # 15 live templates
├── fileTemplates/internal/
│ ├── ReScript Module.res.ft
│ ├── ReScript Interface.resi.ft
│ └── ReScript Component.res.ft
├── schemas/
│ └── rescript.schema.json # JSON Schema for rescript.json
└── icons/ # SVG icons
Key Entry Points¶
plugin.xml¶
src/main/resources/META-INF/plugin.xml is the central registry for all plugin features. Every extension point implementation is registered here. When adding a new feature, you’ll almost always need to add an entry to this file.
Rescript.flex¶
src/main/java/com/rescript/plugin/lang/Rescript.flex defines the lexer rules. Changes here require running ./gradlew buildPlugin to regenerate RescriptFlexLexer.java.
RescriptTokenTypes.kt¶
src/main/kotlin/com/rescript/plugin/lang/RescriptTokenTypes.kt defines all token types and token sets. When adding new tokens to the lexer, you must also add them here.