textmate / groovy.tmbundle

TextMate support for Groovy
69 stars 31 forks source link

Groovy syntax highlighting and quoted method names #11

Open dexX7 opened 9 years ago

dexX7 commented 9 years ago

Hi there, when using Groovy and quoted method names, it looks like two or more words at the beginning, followed by parenthesis breaks the syntax highlighting:

def "Those () or () () and neither (x) breaks a quoted method name"() {
  expect: true
}

def "Word and () however breaks a quoted method name"() {
  expect: true
}
alisonatwork commented 3 years ago

I think the bug is that quoted method names are not detected as method names as at all.

See:

https://github.com/textmate/groovy.tmbundle/blob/6f903cacfb2d5397a350eeb73bc36b2c40f3da70/Syntaxes/Groovy.tmLanguage#L1380-L1382

I think it's this piece of code which detects a method declaration. If it is, then we have this ([^=]+\s+)?\w+\s*\( regex fragment where \w+ is the piece that's supposed to be matching the method name. I am pretty sure it should be one of [a-zA-Z_]\w* or a quoted string matcher. I just submitted a similar change for Pygments https://github.com/pygments/pygments/pull/1765 and would be happy to make one here too, but I am not sure if the project is still maintained?