tree-sitter / tree-sitter-ruby

Ruby grammar for tree-sitter
MIT License
176 stars 58 forks source link

bug: highlight tests failing with tree-sitter 0.22.2 #253

Closed MatthewGentoo closed 4 months ago

MatthewGentoo commented 5 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

tree-sitter 0.22.2

Describe the bug

After updating to tree-sitter 0.22.2, the highlight tests fail.

syntax highlighting:
    ✗ literals.rb
      Failure - row: 30, column: 2, expected highlight 'constant', actual highlights: 'constructor'
    ✗ constants.rb
      Failure - row: 3, column: 4, expected highlight 'constant', actual highlights: 'constructor'
    ✗ classes.rb
      Failure - row: 0, column: 2, expected highlight 'function.method.builtin', actual highlights: 'variable'
    ✗ patterns.rb
      Failure - row: 0, column: 16, expected highlight 'constant.builtin', actual highlights: 'variable'
    ✗ variables.rb
      Failure - row: 4, column: 11, expected highlight 'function.method', actual highlights: 'variable'

Tests also failing in CI.

I think that this is because of the last-wins precedence rules in tree-sitter 0.21.

Steps To Reproduce/Bad Parse Tree

  1. Ensure that tree-sitter 0.22.2 is installed.
  2. git clone https://github.com/tree-sitter/tree-sitter-ruby.git
  3. cd tree-sitter-ruby
  4. npm test

Expected Behavior/Parse Tree

Tests pass.

Repro

// Example code that causes the issue
void foo() {
  // Code that fails to parse, or causes an error
}