groovy.tmbundle icon indicating copy to clipboard operation
groovy.tmbundle copied to clipboard

Groovy syntax highlighting and quoted method names

Open dexX7 opened this issue 10 years ago • 1 comments

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
}

dexX7 avatar Jan 29 '15 05:01 dexX7

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?

alisonatwork avatar Apr 06 '21 01:04 alisonatwork