atom / language-ruby

Ruby package for Atom
Other
101 stars 144 forks source link

[tree-sitter] "then" keyword is not recognized, and 'case' statement is not folded #237

Closed t9md closed 6 years ago

t9md commented 6 years ago

Prerequisites

Description

I'm trying to use Tree-sitter parser and found some issues.

Steps to Reproduce

With sample code below

def test(grade)

  if true
    puts "hello"
  elsif false
    puts "hello"
  else
    puts "hi"
  end

  case grade
  when "A", "A+" then
    puts 'Well done!'
  when "B", "B+" then
    puts 'Try harder!'
  when "C" then
    puts 'You need help!!!'
  else
    puts "You just making it up!"
  end

end

test "A"

TextMate

text-mate

Tree-sitter: See syntax color of 'then' and also foldable marker on the gutter.

tree-sitter

Tree-sitter: GIF below is when I add then to the case-statement is Tree-sitter

then-broken-syntax

Expected behavior: [What you expect to happen]

Tree-sitter parser works as accurately as TextMate parser.

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

Atom    : 1.31.0-beta1
Electron: 2.0.7
Chrome  : 61.0.3163.100
Node    : 8.9.3
Ben3eeE commented 6 years ago

/cc: @maxbrunsfeld

t9md commented 6 years ago

Ignore "puts" part, it seems to be OK(no problem).