プロジェクト構造¶
トップレベルレイアウト¶
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
ソースコードの構成¶
すべてのプラグインコードは src/main/kotlin/com/rescript/plugin/ 配下にあります:
パッケージ |
用途 |
主要ファイル |
|---|---|---|
|
コア定義 |
|
|
レキサー、パーサー、トークン |
|
|
PSI 要素クラス |
|
|
シンタックスハイライト |
|
|
LSP 統合 |
|
|
実行構成 |
|
|
テストランナー |
|
|
ストラクチャービュー |
|
|
コード折りたたみ |
|
|
エディタ拡張 |
|
|
補完機能 |
|
|
ナビゲーション機能 |
|
|
コード分析 |
|
|
フォーマット |
|
|
コードスタイル |
|
|
設定 |
|
|
プラグイン設定 |
|
|
インテンションアクション |
|
|
Surround with |
|
|
インポート管理 |
|
|
言語インジェクション |
|
|
スペルチェック |
|
|
インデックス |
|
|
ファイル作成 |
|
|
ステータスバー |
|
|
Code Lens |
|
|
JS プレビュー |
|
|
モジュール階層 |
|
|
ペーストアクション |
|
|
コード生成 |
|
|
プロジェクトウィザード |
|
|
コメント切り替え |
|
リソース¶
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
主要なエントリポイント¶
plugin.xml¶
src/main/resources/META-INF/plugin.xml はすべてのプラグイン機能の中央レジストリです。すべての Extension Point 実装がここに登録されます。新しい機能を追加する場合、ほぼ必ずこのファイルにエントリを追加する必要があります。
Rescript.flex¶
src/main/java/com/rescript/plugin/lang/Rescript.flex はレキサールールを定義しています。ここを変更した場合、./gradlew buildPlugin を実行して RescriptFlexLexer.java を再生成する必要があります。
RescriptTokenTypes.kt¶
src/main/kotlin/com/rescript/plugin/lang/RescriptTokenTypes.kt はすべてのトークンタイプとトークンセットを定義しています。レキサーに新しいトークンを追加する場合、ここにも追加する必要があります。