GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1161

Groovy syntax highlighting does not work occasionally

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.1Release
    • Fix Version/s: 2.5.2.Release
    • Component/s: Editor
    • Labels:
      None
    • Environment:
      Linux/Kubuntu 10.10, Java 1.6.0_26, Spring IDE (STS) 2.7.1.201107082359-RELEASE, Groovy-Eclipse plugin 2.5.1.xx-20110627-1300-e36
    • Number of attachments :
      0

      Description

      Occasionally, when I start STS or after using it for a while, syntax highlighting in the Groovy editor stops working fully. Only keywords and strings are highlighted, everything else reverts to blank and white. The only way to make it work again is to restart STS and hope it works properly the next time. I'm not sure if it's relevant, but the STS log is full of exception messages like this one:

      !ENTRY org.eclipse.jdt.core 4 0 2011-07-30 14:35:07.444
      !MESSAGE Code assist internal error
      !STACK 0
      java.lang.NullPointerException
              at org.codehaus.groovy.antlr.parser.GroovyLexer.require(GroovyLexer.java:300)
              at org.codehaus.groovy.antlr.parser.GroovyLexer.mSTRING_CTOR_END(GroovyLexer.java:2355)
              at org.codehaus.groovy.antlr.parser.GroovyLexer.mSTRING_LITERAL(GroovyLexer.java:1964)
              at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:459)
              at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:249)
              at org.eclipse.jdt.groovy.core.util.GroovyScanner.nextToken(GroovyScanner.java:59)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyDocumentScanner.nextToken(GroovyDocumentScanner.java:119)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyDocumentScanner.getTokensIncludingEOF(GroovyDocumentScanner.java: 105)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyDocumentScanner.ensureScanned(GroovyDocumentScanner.java:96)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyDocumentScanner.findTokenFrom(GroovyDocumentScanner.java:297)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyDocumentScanner.getLastTokenBefore(GroovyDocumentScanner.java:340)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyIndentationService.getTokenBefore(GroovyIndentationService.java:  419)
              at org.codehaus.groovy.eclipse.refactoring.formatter.GroovyIndentationService.                                               computeIndentAfterNewline(GroovyIndentationService.java:204)
              at org.codehaus.groovy.eclipse.editor.GroovyAutoIndentStrategy.autoEditAfterNewline(GroovyAutoIndentStrategy.java:147)
              at org.codehaus.groovy.eclipse.editor.GroovyAutoIndentStrategy.customizeDocumentCommand(GroovyAutoIndentStrategy.java:61)
              at org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3741)
              at org.eclipse.jface.text.TextViewer.handleVerifyEvent(TextViewer.java:3778)
              at org.eclipse.jface.text.source.projection.ProjectionViewer.handleVerifyEvent(ProjectionViewer.java:1277)
              at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText(TextViewer.java:433)
              at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:255)
              at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
              at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
              at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
              at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
              at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1061)
              at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7140)
              at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:7986)
              at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2459)
              at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5932)
              at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5962)
              at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5656)
              at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
              at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
              at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
              at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
              at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1294)
              at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:730)
              at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2841)
              at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:734)
              at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1743)
              at org.eclipse.swt.widgets.Control.windowProc(Control.java:4796)
              at org.eclipse.swt.widgets.Display.windowProc(Display.java:4360)
              at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
              at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8189)
              at org.eclipse.swt.widgets.Display.eventProc(Display.java:1238)
              at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
              at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2237)
              at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3159)
              at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
              at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
              at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
              at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
              at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
              at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
              at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
              at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
              at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
              at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
              at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
              at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
              at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
              at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
              at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
              at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
      

      I'm not sure if that exception is related to the problem, but it is the only type of exception reported in the log since I started STS today.

      I just restarted STS and Groovy syntax highlighting still wasn't working. I restarted it again and Groovy syntax highlighting was working again. The only difference was that I had selected a different editor. I have several files open in editors when I start my STS session. If I start with a Groovy editor selected (from when I last quit STS), syntax highlighting works; if I start with a GSP editor selected, syntax highlighting doesn't work when I switch to a Groovy editor. During all of these restarts, no new messages were added to the workspace log.

        Activity

        Hide
        D Gardner added a comment - - edited

        Sorry, I forgot to mention that I have noticed this problem in every STS release from 2.5.1 to 2.7.1.

        Also, to simplify things a bit more, I closed all editors before quitting STS. When I started STS again, if I first opened a GSP file and then a Groovy file, Groovy syntax highlighting was broken. If I opened a Groovy file first, syntax highlighting was OK. It doesn't appear to be an issue with the start-up of the whole workspace, then, just some conflict between these two editors and the order in which they are first used.

        I'd add that above, but I can't figure out how to edit the descriptions of my own bugs (which would be handy, as I could change "blank and white" to "black and white", too).

        Show
        D Gardner added a comment - - edited Sorry, I forgot to mention that I have noticed this problem in every STS release from 2.5.1 to 2.7.1. Also, to simplify things a bit more, I closed all editors before quitting STS. When I started STS again, if I first opened a GSP file and then a Groovy file, Groovy syntax highlighting was broken. If I opened a Groovy file first, syntax highlighting was OK. It doesn't appear to be an issue with the start-up of the whole workspace, then, just some conflict between these two editors and the order in which they are first used. I'd add that above, but I can't figure out how to edit the descriptions of my own bugs (which would be handy, as I could change "blank and white" to "black and white", too).
        Hide
        Andrew Eisenberg added a comment -

        I can reproduce this. Thanks for a detailed description of the problem.

        Show
        Andrew Eisenberg added a comment - I can reproduce this. Thanks for a detailed description of the problem.
        Hide
        D Gardner added a comment -

        That's good to hear. Thank you for your quick attention. As I figured out yesterday how to avoid this problem, I can wait patiently for a fix. GRECLIPSE-1137 is a more regular annoyance for me, though.

        Show
        D Gardner added a comment - That's good to hear. Thank you for your quick attention. As I figured out yesterday how to avoid this problem, I can wait patiently for a fix. GRECLIPSE-1137 is a more regular annoyance for me, though.
        Hide
        Andrew Eisenberg added a comment - - edited

        Turns out that this was purely an STS issue. We had been incorrectly setting the property store for GSP syntax highlighting. The property store is the thing that (among other things) persists the color preferences for syntax highlighting. The property store is used to populate the colors and then these colors are cached until they are changed. Since we were using the wrong store, when asked to populate the colors, the store didn't know anything about them and so it just defaulted everything to black (which is cached and used in Groovy editors).

        This is now changed in STS and things are working as expected.

        Show
        Andrew Eisenberg added a comment - - edited Turns out that this was purely an STS issue. We had been incorrectly setting the property store for GSP syntax highlighting. The property store is the thing that (among other things) persists the color preferences for syntax highlighting. The property store is used to populate the colors and then these colors are cached until they are changed. Since we were using the wrong store, when asked to populate the colors, the store didn't know anything about them and so it just defaulted everything to black (which is cached and used in Groovy editors). This is now changed in STS and things are working as expected.

          People

          • Assignee:
            Andrew Eisenberg
            Reporter:
            D Gardner
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: