Skip to content

Sublime Text syntax definition #73

@AndydeCleyre

Description

@AndydeCleyre

Hi, and thanks! I'm just starting to use and like prr.

Using Sublime Text, I wanted better syntax highlighting for the .prr files.

I just threw the existing vim syntax definition at Claude and got the following prr.sublime-syntax definition,
which seems to work nicely. I haven't tested it with many features of prr yet.

Maybe it will help someone else searching for the same.

I would have put this under Discussions if they were enabled.

prr.sublime-syntax
%YAML 1.2
---
# Language: prr
# Credits: Bram Moolenaar <Bram@vim.org>,
#          Łukasz Niemier <lukasz@niemier.pl>
#          Daniel Xu <dxu@dxuuu.xyz>

name: prr
file_extensions:
  - prr
scope: source.prr

contexts:
  main:
    # match + but not +++
    - match: '^> \+(?!\+\+).*'
      scope: markup.inserted.prr

    # match - but not ---
    - match: '^> -(?!--).*'
      scope: markup.deleted.prr

    # diff header
    - match: '^> diff --git .*'
      scope: meta.header.prr

    # index line
    - match: '^> index \w*\.\.\w*( \w*)?'
      scope: comment.line.prr

    # chunk header
    - match: '^> @@ .* @@'
      scope: entity.name.function.prr

    # prr tags
    - match: '^@.*'
      scope: meta.tag.prr
      push: prr_tag

  prr_tag:
    - match: '@prr'
      scope: keyword.other.prr
      push: prr_result

    - match: '$'
      pop: true

    - match: '.'
      scope: meta.tag.prr

  prr_result:
    - match: '\b(approve|reject|comment)\b'
      scope: string.unquoted.prr

    - match: '$'
      pop: true

    - match: '.'
      scope: meta.tag.prr

Screenshot:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions