Skip to content

Commit ff51fb2

Browse files
devkanroCopilot
andauthored
chore: update build plugins for 2026.1 (#293)
* chore: update build plugins for 2026.1 Update IntelliJ Platform Gradle Plugin, Grammar-Kit, and Gradle wrapper versions. Adapt the IntelliJ Platform dependency declaration to the latest plugin API and restore README plugin description markers required by patchPluginXml. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: record build tooling reflection Capture lessons from updating the IntelliJ Platform and Grammar-Kit build tooling for the 2026.1 target. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs: add knowledge reference docs Add the generated knowledge reference materials covering architecture, design decisions, modules, and workflow notes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * chore: add knowledge MCP config Configure the knowledge MCP server so the repository knowledge base can be used by coding agents. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4b96c74 commit ff51fb2

33 files changed

Lines changed: 904 additions & 11 deletions

‎.github/knowledge.md‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
updated: 2026-05-09
3+
---
4+
5+
# Knowledge Base
6+
7+
Accumulated learnings from this project. Read this before starting new work.
8+
9+
## Project Patterns
10+
11+
- IntelliJ Platform Gradle Plugin upgrades can require both Gradle wrapper updates and build script API adjustments.
12+
- Grammar/parser generation depends on IntelliJ Platform classpath alignment; when `generateParser` fails with missing IntelliJ classes, check Grammar-Kit and IntelliJ Platform Gradle Plugin compatibility together.
13+
14+
## Common Pitfalls
15+
16+
- `README.md` must contain `<!-- Plugin description -->` and `<!-- Plugin description end -->` markers because `patchPluginXml` extracts the plugin description from that section.
17+
- Local Gradle project caches under `.gradle` can fail on Windows with file-lock or directory-creation errors; validating in a clean temporary workspace can distinguish local cache problems from source/build-script problems.
18+
19+
## Workflow Learnings
20+
21+
- For build-tooling updates, verify plugin portal versions first, then run a clean build after each compatibility-driven change.
22+
- When a standard workspace build is blocked by local cache permissions, document the workaround and validation command in the PR.
23+
24+
## Reflections
25+
26+
### 2026-05-09 — Build plugin update for 2026.1
27+
28+
**What was done**: Updated the build tooling for the 2026.1 target by upgrading the IntelliJ Platform Gradle Plugin, Grammar-Kit plugin, and Gradle wrapper. Adapted the `create()` dependency declaration to the newer API and restored README plugin-description markers required by `patchPluginXml`.
29+
30+
**What went well**:
31+
- Updating Grammar-Kit and IntelliJ Platform Gradle Plugin together resolved the original `generateParser` classpath failure.
32+
- A clean temporary workspace build isolated source/build-script issues from local `.gradle` cache permission problems.
33+
- The final build passed after adapting the dependency declaration and restoring README markers.
34+
35+
**What was harder than expected**:
36+
- IntelliJ Platform Gradle Plugin `2.16.0` required Gradle `9.0.0`, which introduced an API compatibility adjustment in `build.gradle.kts`.
37+
- The local workspace Gradle cache repeatedly failed with Windows file-lock/directory errors, so standard in-place build verification was not reliable.
38+
- `patchPluginXml` failed late because the README description markers were missing.
39+
40+
**Patterns noticed**:
41+
- Build-tooling upgrades often reveal chained compatibility requirements: Gradle plugin version, Gradle wrapper version, DSL API, and documentation-derived metadata all need to line up.
42+
- Local environment failures should be separated from source failures by using a clean copy and explicit temporary cache directories.
43+
44+
**Workflow observations**:
45+
- The ship flow caught the local standard-build failure, but the clean-workspace validation provided enough confidence to proceed with a documented PR note.
46+
- This was a quick build-tooling fix without a dedicated brainstorm; future non-trivial version migrations should start with a brief brainstorm entry before edits.

‎.mcp.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"mcpServers": {
3+
"knowledge": {
4+
"type": "stdio",
5+
"command": "npx",
6+
"args": ["-y", "knowledgebased"]
7+
}
8+
}
9+
}

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
---
1616

17+
<!-- Plugin description -->
18+
1719
## ✨ What It Does
1820

1921
This plugin turns your JetBrains IDE into a protobuf-aware development environment — not just syntax highlighting, but deep understanding of your schema.
@@ -22,6 +24,8 @@ This plugin turns your JetBrains IDE into a protobuf-aware development environme
2224
> Not compatible with the bundled [JetBrains Protocol Buffer plugin](https://plugins.jetbrains.com/plugin/14004-protocol-buffers).
2325
> Disable **Protocol Buffer** and **gRPC** before installing.
2426
27+
<!-- Plugin description end -->
28+
2529
## 🚀 Quick Start
2630

2731
1. Open **Settings → Plugins → Marketplace**

‎build.gradle.kts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ dependencies {
4343

4444
// IntelliJ Platform Gradle Plugin Dependencies Extension - read more: https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-dependencies-extension.html
4545
intellijPlatform {
46-
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion"), useInstaller = false)
46+
create(providers.gradleProperty("platformType"), providers.gradleProperty("platformVersion")) {
47+
useInstaller = false
48+
}
4749

4850
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties file for bundled IntelliJ Platform plugins.
4951
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })

‎gradle.properties‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ pluginName=IntelliJ Protobuf Language Plugin
44
pluginRepositoryUrl=https://github.com/devkanro/intellij-protobuf-plugin
55

66
# SemVer format -> https://semver.org
7-
pluginVersion=2.3.0
7+
pluginVersion=2.4.0
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
10-
pluginSinceBuild=253
11-
pluginUntilBuild=253.*
10+
pluginSinceBuild=261
11+
pluginUntilBuild=261.*
1212

1313
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1414
platformType=IU
15-
platformVersion=2025.3
15+
platformVersion=2026.1
1616

1717
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1818
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP, com.intellij.grpc:251.23774.350
19-
platformPlugins=org.jetbrains.plugins.go:253.28294.251, com.jetbrains.restClient:253.28294.251
19+
platformPlugins=org.jetbrains.plugins.go:261.22158.277, com.jetbrains.restClient:261.22158.182
2020
# Example: platformBundledPlugins = com.intellij.java
2121
platformBundledPlugins=com.intellij.java, org.jetbrains.kotlin, com.intellij.modules.json, org.intellij.plugins.markdown
2222

2323
# Gradle Releases -> https://github.com/gradle/gradle/releases
24-
gradleVersion = 8.10.2
24+
gradleVersion = 9.0.0
2525

2626
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
2727
kotlin.stdlib.default.dependency = false

‎gradle/libs.versions.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ junit = "4.13.2"
44

55
# plugins
66
changelog = "2.2.1"
7-
intelliJPlatform = "2.5.0"
8-
kotlin = "2.3.0-RC3"
7+
intelliJPlatform = "2.16.0"
8+
kotlin = "2.3.20"
99
kover = "0.8.3"
1010
qodana = "2024.2.3"
11-
grammarkit = "2023.3"
11+
grammarkit = "2023.3.0.3"
1212

1313
[libraries]
1414
junit = { group = "junit", name = "junit", version.ref = "junit" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
tags: [architecture, extension-points, api]
3+
related: [architecture/layer-diagram, modules/java, modules/go]
4+
refs: [docs/extension-points.md]
5+
---
6+
# Extension Points
7+
8+
Five extension points allow third-party plugins to extend the core. All are dynamic (support runtime loading/unloading).
9+
10+
## rootProvider
11+
12+
**Interface**: `ProtobufRootProvider`
13+
14+
Provides import root directories for proto file resolution. Built-in: `ModuleSourceRootProvider`, `LibraryRootProvider`, `EmbeddedRootProvider`, `DecompiledRootProvider`, `GoRootProvider`.
15+
16+
```xml
17+
<extensions defaultExtensionNs="io.kanro.idea.plugin.protobuf">
18+
<rootProvider implementation="com.example.MyRootProvider"/>
19+
</extensions>
20+
```
21+
22+
## symbolReferenceProvider
23+
24+
**Interface**: `ProtobufSymbolReferenceProvider`
25+
26+
Custom symbol references beyond standard proto references. Used by AIP to resolve resource type names in string literals.
27+
28+
## indexProvider
29+
30+
**Interface**: `ProtobufIndexProvider`
31+
32+
Contributes index entries for proto elements, enabling navigation between proto definitions and generated code. Built-in: `JavaIndexProvider`, `GoIndexProvider`, `SisyphusIndexProvider`.
33+
34+
## stubExternalProvider
35+
36+
**Interface**: `ProtobufStubExternalProvider`
37+
38+
Provides additional external data stored alongside PSI stubs. Used by Java integration to cache Java option values (`java_package`, `java_outer_classname`, `java_multiple_files`).
39+
40+
## protocPlugin
41+
42+
**Interface**: `ProtobufCompilerPlugin`
43+
44+
Hooks into the protobuf compilation process. 10 built-in compilers cover File, Message, Field, Oneof, MapEntry, MapField, Enum, EnumValue, Service, and ServiceMethod compilation.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
tags: [architecture, overview, layers]
3+
related: [architecture/extension-points, design/psi-mixin-injection]
4+
refs: [docs/architecture.md, docs/overview.md]
5+
---
6+
# Plugin Architecture Layers
7+
8+
IntelliJ Protobuf Language Plugin is a full-featured Protocol Buffers language plugin for JetBrains IDEs with deep semantic understanding, cross-file symbol resolution, multi-language integration, and Editions support.
9+
10+
## Layer Diagram
11+
12+
```
13+
┌─────────────────────────────────────────────┐
14+
│ UI & Settings │
15+
│ Settings, Structure View, Icons, Actions │
16+
├─────────────────────────────────────────────┤
17+
│ Language Support │
18+
│ Completion, Formatting, Annotations, │
19+
│ References, Quick Fixes, Find Usages │
20+
├─────────────────────────────────────────────┤
21+
│ PSI (Program Structure) │
22+
│ Elements, Mixins, Scope, Features │
23+
├─────────────────────────────────────────────┤
24+
│ Indexing & Stubs │
25+
│ Stub Indices, Root Providers, Caching │
26+
├─────────────────────────────────────────────┤
27+
│ Parsing & Lexing │
28+
│ Lexer (FLEX), Parser (BNF), Language Def │
29+
├─────────────────────────────────────────────┤
30+
│ Integration Modules (Optional) │
31+
│ Java, Go, Sisyphus, gRPC, AIP │
32+
└─────────────────────────────────────────────┘
33+
```
34+
35+
Each layer depends only on the layer below it. Integration modules sit alongside, hooking into specific layers via extension points.
36+
37+
## Key Concepts
38+
39+
- **Proto Files as First-Class Code**: `.proto` files get full PSI trees, stub indices, and cross-project reference resolution like Java or Kotlin.
40+
- **Multi-Source Symbol Resolution**: Root providers aggregate proto files from project sources, library JARs, the protobuf SDK, and decompiled descriptors.
41+
- **Integration Modules**: Language-specific features activate only when relevant IDE plugins are present, keeping the core lightweight.
42+
- **Internal Compiler**: In-process protobuf compiler produces `FileDescriptorProto` from PSI without external `protoc`.
43+
44+
## Parsing & Lexing
45+
46+
Grammar files in `src/main/grammar/` define the syntax — `protobuf.bnf` for proto2/proto3/editions, `prototext.bnf` for text format. Grammar-Kit and JFlex generate the parser and lexer. Generated code goes to `build/generated/sources/grammar/`.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
tags: [design, annotation, validation, proto2, proto3]
3+
related: [design/annotation-quick-fixes, design/editions-feature-model]
4+
refs: [docs/design/annotation-system.md]
5+
---
6+
# Annotation System — Layered Validation
7+
8+
Protobuf is three divergent dialects sharing one syntax. Proto2 *requires* field labels; proto3 *forbids* `required`. Proto3 bans groups, extensions, default values — all legal in proto2. A single validator would devolve into a tangle of conditionals.
9+
10+
## Per-Version Annotators
11+
12+
| Layer | Class | Activates When |
13+
|-------|-------|----------------|
14+
| Universal | `ProtobufAnnotator` | Always (all `.proto` files) |
15+
| Proto2 | `Protobuf2Annotator` | `syntax` is `"proto2"` or unspecified |
16+
| Proto3 | `Protobuf3Annotator` | `syntax` is exactly `"proto3"` |
17+
| Editions | `ProtobufEditionAnnotator` | `edition()` is non-null |
18+
19+
Each version annotator self-gates with an early return. Gating is cheap — a single `file.syntax()` call.
20+
21+
## Annotators Over Inspections
22+
23+
Protobuf errors are specification violations — `protoc` will reject the file. Making them suppressible via inspections would let users silence real errors. Annotators mirror the compiler: always on, not negotiable. Naming convention warnings use `WEAK_WARNING` severity.
24+
25+
## Trackers (Cached Utilities)
26+
27+
`FileTracker`, `NumberTracker`, and `ScopeTracker` use `CachedValuesManager` to compute constraint sets once per PSI modification. Individual `visit()` calls check a single element against the cached set — O(1) lookup, avoiding O(n²) recomputation.
28+
29+
**Record-Visit pattern**: Each tracker records all definitions in a scope during construction, then exposes `visit(element, holder)` methods that check one element against the recorded set.

0 commit comments

Comments
 (0)