Extension Points

March 9, 2026 · View on GitHub

The plugin defines custom extension points that allow third-party plugins to extend its functionality. All extension points are dynamic (support runtime loading/unloading).

rootProvider

Interface: io.kanro.idea.plugin.protobuf.lang.root.ProtobufRootProvider

Provides import root directories for proto file resolution. When the plugin encounters an import statement, it queries all registered root providers to find the imported file.

Built-in Providers

ProviderSource
ModuleSourceRootProviderModule source directories marked as proto roots
LibraryRootProviderJAR libraries containing .proto files
EmbeddedRootProviderGoogle's standard proto definitions bundled with the plugin
DecompiledRootProviderProto files reconstructed from compiled descriptors
GoRootProviderGo module proto paths (from golang integration)

Usage

<extensions defaultExtensionNs="io.kanro.idea.plugin.protobuf">
    <rootProvider implementation="com.example.MyRootProvider"/>
</extensions>
class MyRootProvider : ProtobufRootProvider {
    override fun roots(context: ProtobufRootProviderContext): List<VirtualFile> {
        // Return directories containing .proto files
    }
}

symbolReferenceProvider

Interface: io.kanro.idea.plugin.protobuf.lang.psi.feature.ProtobufSymbolReferenceProvider

Provides custom symbol references beyond standard proto references. Used by AIP to resolve resource type names in string literals.

Built-in Providers

  • AipResourceReferenceProvider — Resolves (google.api.resource_reference) type strings

indexProvider

Interface: io.kanro.idea.plugin.protobuf.lang.psi.feature.ProtobufIndexProvider

Contributes index entries for proto elements, enabling navigation between proto definitions and generated code.

Built-in Providers

ProviderPurpose
JavaIndexProviderIndex Java generated class names
GoIndexProviderIndex Go generated type names
SisyphusIndexProviderIndex Sisyphus Kotlin type names

Usage

class MyIndexProvider : ProtobufIndexProvider {
    override fun buildIndex(element: ProtobufElement): Map<StubIndexKey<*, *>, List<String>> {
        // Return index entries for this element
    }
}

stubExternalProvider

Interface: io.kanro.idea.plugin.protobuf.lang.psi.feature.ProtobufStubExternalProvider

Provides additional external data to be stored alongside PSI stubs. Used by Java integration to cache Java option values.

Built-in Providers

  • FileJavaOptionsProvider — Extracts java_package, java_outer_classname, java_multiple_files options

protocPlugin

Interface: io.kanro.idea.plugin.protobuf.compile.ProtobufCompilerPlugin

Hooks into the protobuf compilation process, allowing custom code generation plugins.

Built-in Compilers

CompilerPurpose
FileCompilerFile-level compilation
MessageCompilerMessage type compilation
EnumCompilerEnum type compilation
MessageFieldCompilerMessage field compilation
MessageMapEntryCompilerMap entry type compilation
MessageMapFieldCompilerMap field compilation
MessageOneofCompilerOneof field compilation
EnumValueCompilerEnum value compilation
ServiceCompilerService compilation
ServiceMethodCompilerService method compilation