Skip to content

feat: add Protobuf language support (tree-sitter Niveau 1) - #175

Open
flupkede wants to merge 1 commit into
developfrom
feat/protobuf-language-support
Open

feat: add Protobuf language support (tree-sitter Niveau 1)#175
flupkede wants to merge 1 commit into
developfrom
feat/protobuf-language-support

Conversation

@flupkede

Copy link
Copy Markdown
Owner

Add .proto as a first-class text-indexable language (Niveau 1), implementing the cheap half of GitHub #162.

What

  • New tree-sitter-proto = "0.4.0" grammar dependency.
  • Language::Protobuf enum variant wired through the full per-language pipeline: from_extension("proto"), from_name("protobuf"|"proto"), supports_tree_sitter(), name().
  • grammar.rs: load_grammar returns tree_sitter_proto::LANGUAGE.into() (+ added to supported_languages).
  • extractor.rs: new ProtobufExtractor — chunks .proto files aligned to message/enum/service/rpc definition boundaries instead of naive line-windowing. Names are read from the grammar's dedicated message_name/enum_name/service_name/rpc_name child nodes (proto grammar has no name field).

Why Niveau 1 only
Text-aware chunking makes .proto searchable with syntax awareness (definitions as chunk boundaries, named, classified). Niveau 2 (SCIP symbol index → find_impact/call-graph) is deferred: there is no scip-protobuf emitter and no current .proto corpus in any indexed repo to justify the work. Adding language support is harmless/costless — see #162 discussion.

Validation
cargo fmt --check, cargo check --all-targets, cargo clippy -D warnings, cargo test --lib --bins (1220 passed, 0 failed). Includes new tests: proto detection, proto grammar load, is_supported, get_extractor, protobuf definition_types.

Closes nothing yet (#162 left open — Niveau 2 / motivating use-case still pending).

Add .proto as a first-class text-indexable language via the tree-sitter-proto 0.4.0 grammar, mirroring the existing per-language pattern.

- Cargo.toml: tree-sitter-proto = "0.4.0"
- src/file/language.rs: Language::Protobuf variant + from_extension("proto") + from_name("protobuf"|"proto") + supports_tree_sitter + name()
- src/chunker/grammar.rs: load_grammar arm (tree_sitter_proto::LANGUAGE.into()) + supported_languages
- src/chunker/extractor.rs: ProtobufExtractor (definition_types: message/enum/service/rpc; names read from the *_name child nodes since proto grammar has no name field; classify message->Struct/enum->Enum/service->Interface/rpc->Method) + get_extractor arm

Tests: .proto detection, proto grammar load, is_supported, get_extractor, protobuf definition_types. All 1220 lib/bin tests pass.

This is Niveau 1 (text-aware chunking aligned to message/service/enum boundaries). Niveau 2 (SCIP symbols -> find_impact/call-graph) is deliberately deferred: no scip-protobuf emitter exists and there is no current .proto corpus to justify it. See GitHub #162.
@flupkede
flupkede force-pushed the feat/protobuf-language-support branch from 5d66ac2 to be61891 Compare July 29, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant