Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.
84 stars 39 forks source link

Errors with annotations highlighting #82

Closed vincekd closed 7 years ago

vincekd commented 7 years ago

I get this error Error during redisplay: (jit-lock-function 1001) signaled (void-variable c-annotation-face) when I have annotations on the page, which screws up keyword highlighting for the rest of the file.

Looking at java-mode it seems they just set annotations to the font-lock-function-name-face.

vincekd commented 7 years ago

Nevermind about the font-lock-function-name-face, that was just a product of java-mode being confused by groovy syntax.

But everything works fine if you load a c-derived mode before groovy-mode.

vincekd commented 7 years ago

Fixed by adding (require 'cc-fonts) but I'm not sure that's the best solution, considering this is the only font from that group that's used.

Looks like cc-fonts just defines it as the font-lock-constant-face https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/cc-fonts.el#L196-L202

Wilfred commented 7 years ago

Aha, great debugging!

Agreed we should just use font-lock-constant-face (or define a groovy-annotation-face that inherits from it).

Playing with this, I've also noticed that we highlight @interface as @ followed by the keyword interface, rather than an annotation. That's a bug.

vincekd commented 7 years ago

Playing with this, I've also noticed that we highlight @interface as @ followed by the keyword interface, rather than an annotation. That's a bug.

I think that's an invalid name for an annotation anyway, flycheck throws an error for it. Also, groovy console behaves the same way (and throws a compilation error).

Wilfred commented 7 years ago

Declaring annotations uses @interface: http://groovy-lang.org/objectorientation.html#_annotation unless I'm missing something?

vincekd commented 7 years ago

oh, oops. I was being an idiot and thought you meant creating an annotation named "interface", instead of talking about the actual interface annotation.