IntelliJ Platform plugin with IDE support for .oap files. These are module descriptors for the
OAP IoC/DI kernel. Each one declares an application module, its services,
dependencies and configurations.
- Plugin id:
oap - Version: see
versioningradle.properties - Compatibility: IntelliJ IDEA 2025.1+ (build 251+); Java features need the bundled Java plugin
Language reference: OAP Application.
A file describes one module. Brace (HOCON-like) and YAML-style colon/indent syntax can be mixed freely:
name = my-module
enabled = true
dependsOn = [oap-ws, other-module]
include required("shared.conf")
services {
my-service {
implementation = com.example.MyService
parameters {
timeout = 10s
listener = <modules.this.other-service>
}
supervision.supervise = true
}
}
configurations = [{
loader = com.example.MyLoader
config { key = value }
}]
The same thing in YAML style:
name: my-module
services:
my-service:
implementation = com.example.MyService
parameters:
filters:
- <modules.this.filter-a>
- <modules.this.filter-b>
description: |
multi-line
block scalar
Supported syntax:
=and:assignment{}objects and:indented blocks[]arrays and-dash lists|/>block scalars<modules.X.Y>/<services.self.X>/<kernel.self>references${ENV}values//and#comments
- Highlighting:
- lexer-based highlighting plus an annotator
- configurable colors (Settings > Editor > Color Scheme > OAP)
- Navigation (Go To Declaration):
- module names in
dependsOnand references (resolved through a stub index) - service names
include required("...")files- Java classes in
implementation/loader parameterskeys to the Java setter, constructor parameter or field
- module names in
- Completion:
- keywords
- module/service references
- Java parameter names
supervisionentries
- Inspections:
- unknown classes
- unknown modules/services in
dependsOnand references - unknown parameters
- missing includes
- Refactoring: renaming a Java field, parameter or setter updates the matching
parameterskeys in.oapfiles. - Editor:
- formatter with code style settings
- brace matching
- folding
- line comment/uncomment
- breadcrumbs
- structure view
- service line markers, in both
.oapand Java
- oap-ws
@WsValidate(Java): navigation, completion and shape validation for validator method names.
Requires Java 21.
./gradlew build # build the plugin (zip in build/distributions/)
./gradlew test # run all tests
./gradlew test --tests "oap.application.plugin.parser.OapParserTest"
./gradlew runIde # start a sandbox IDE with the plugin installedThese files are the source of the language:
grammars/oap.bnf(Grammar-Kit)grammars/_OapLexer.flex(JFlex)
The parser, lexer and PSI classes in gen/ are generated from them, so never edit gen/ by hand.
After editing either grammar file:
./gradlew generateParser generateLexer- Bump
VERSIONinsrc/main/kotlin/oap/application/plugin/stub/types/OapFileElementType.kt, so IDEA rebuilds stale stub indexes. Without this, users getUpToDateStubIndexMismatch. - Add or update parser fixtures in
testdata/parser/and run the tests.
| Path | Contents |
|---|---|
grammars/ |
BNF grammar and JFlex lexer |
gen/ |
Generated parser, lexer, PSI |
src/main/kotlin/oap/application/plugin/ |
Plugin code: lang, lexer, parser, psi, highlight, completion, ref (references + inspections), formatter, editor, stub, structure, misc |
src/main/resources/META-INF/plugin.xml |
Extension registrations |
src/test/kotlin/ |
Tests (BasePlatformTestCase via OapFixtureTestCase) |
testdata/<category>/ |
Test fixtures: .oap input + expected .txt PSI trees |
Parser tests compare the PSI tree of testdata/parser/X.oap with X.txt. On first run a missing .txt
is generated and the test fails once. Review the generated file, then rerun.
OapStubConsistencyTest checks that the stub tree matches the AST for every parser fixture.