Sublime Forum

Sublime doesn't index protobuf files

#1

I am not able to use goto definition on Protobuf files.

0 Likes

#2

let’s assume you are using https://packagecontrol.io/packages/Protobuf%20Syntax%20Hightlighting
probably you should log an issue at
https://github.com/VcamX/protobuf-syntax-highlighting/issues
because there is no tmPreferences file to tell ST what scopes to index and I guess the syntax doesn’t scope anything in such a way that it would automatically be included in the index

2 Likes

#3

Hi there.
So I was looking at that repo again and I’m specifically interested in the
Protobuf.sublime-syntax file.

My setup:

I have just downloaded and placed that file in User generated new syntax file directory and I was looking at it there.

My State:

Not a sublime text plugin expert unfortunately, but would love to path the syntax file to get up and running with my gRPC adventure.

Observation:

I noticed a distinct thing in Protobuf.sublime-syntax:

If I comment out the option_inline: section (in the above images) the syntaxes in the lines down get somewhat properly highlighted. But on the same line, after the variable name, nothing get’s highlighted.

If I keep that section, then after one definition of “Option” in 1st line, nothing, afterwards and below get’s highlighted.

.
.
.
# Option
  option:
    - match: '\b(option)\b'
      scope: storage.type.annotation.proto
      push:
        - match: ';'
          scope: punctuation.terminator.option.proto
          pop: true
        - include: option_inline
        - include: or_pop
  # option_inline:
  #   - match: '{{ident}}'
  #     scope: variable.annotation.proto
  #   - include: full_option_name
  #   - match: = 
  #     scope: keyword.operator.assignment.proto
  #     push: option_value

  full_option_name:
    - match: \(
      scope: punctuation.definition.name.option.begin.proto
      push:
        - match: (\))(?:(\.){{ident}})?
          captures:
            1: punctuation.definition.name.option.end.proto
            2: punctuation.accessor.proto
            3: variable.annotation.proto
          pop: true
        - match: '{{ident}}(\.)'
          captures:
            1: variable.namespace.proto
            2: punctuation.accessor.proto
        - match: '{{ident}}'
          scope: variable.annotation.proto
.
.
.

Can some syntax experts here, help edit this grammar file?

0 Likes

#4

Can some syntax experts here, help edit this grammar file?

Why you want to modify it or what you are trying to accomplish?

0 Likes