HTD / NST

New Source Tree Komodo Addon
32 stars 20 forks source link

ruby: while loops/blocks not recognized #14

Closed ccaroon closed 11 years ago

ccaroon commented 11 years ago

The Ruby parser does not increment the depth for 'while' loops, which causes the indention to be off for method names after a 'while' loop appears in the code.

Here's a patch:

1204c1204
<         else if ( code.match(/^(if|unless|case)\b/) ) {

---
>         else if ( code.match(/^(if|unless|case|while)\b/) ) {
jumpercc commented 11 years ago

wrong highlighted code:

class One
  def foo
    while true
      puts "hello!"
    end
  end

  def bar
    i = 0
    begin
      i +=1
    end while i < 5
  end

  def baz
    i = 0
    begin
      i = 10
    end if false
  end

  def quux
    # here
  end
end

"foo", "bar", "baz" and "quux" must be on the same level

jumpercc commented 11 years ago

fixed in "testing" $ git push Counting objects: 7, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 494 bytes, done. Total 4 (delta 2), reused 0 (delta 0) To git@github.com:HTD/NST.git 8b4df59..c4240da testing -> testing