Skip to content

Protocol Buffers (.proto) files are not extracted #4510

Open

Description

@dasunNimantha

Problem

.proto files are not in CODE_EXTENSIONS, so Protocol Buffers schemas are skipped silently. In a repo that defines its service contracts in protobuf (gRPC services, or message schemas shared over a message bus), the contracts are absent from the graph:

  • explain "OrderRequest" finds nothing, and there is no node that a producer's or consumer's code could be traced through

Proposed behavior

Extract .proto files (proto2, proto3, editions) as code:

  • Nodes: the file, messages (nested), proto2 groups, enums and their values, services, rpcs and extension fields. The fully qualified protobuf name goes in metadata.fqn.
  • Edges: contains / method for structure; references for field, map, oneof, group and extend types and rpc request/response types; references from a declaration to the extension behind each custom (option) it sets; imports for import / import public.
  • Doc comments: leading doc comments become rationale nodes, attached the way protoc's SourceCodeInfo attaches them.
  • Metadata: deprecated, enum value numbers, rpc streaming and google.api.http bindings. On the file node, syntax / edition, package, and the code-generation options (java_package, go_package, csharp_namespace, ...).
  • Resolution: names resolve with protobuf's own scoping rule, in-file during extraction and across files in a language resolver. As with protoc, only imported files are in scope, and ambiguous references stay unbound rather than guessed.

Alternatives considered

  • There is no tree-sitter grammar for protobuf on PyPI.
  • proto-schema-parser (pure Python, ANTLR) parses well, but its AST carries no line numbers, so nodes would lose source_location.
  • A small dependency-free tokenizer over the declaring parts of the language keeps exact line numbers and needs no new extra.

Compatibility

Additive: .proto files were not extracted before, so no existing node ids, cache entries or graphs change.

Implementation: #4509

Activity

  1. github-actions commented on Oct 17, 2026

    @github-actions

    Thanks for opening this issue, @dasunNimantha. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions