Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Still issues with syntax highlighting

Help
Koen
2014-01-05
2014-01-17
  • Koen
    Koen
    2014-01-05

    I'm still having issues with the syntax highlighting. To the degree they make working on code very difficult. Installed versions:

    eclipse version: Kepler Service Release 1 - Build id: 20130919-0819
    eclipsefp version: 2.5.6.201312291829
    scion-browser: 0.2.19

    I think I have a reproducible case:

    1. Create a new eclipse project

    2. Copy a decent size source file in there. I used ch05/Prettify.hs from Real World Haskell (http://examples.oreilly.com/9780596514983/rwh-examples2.zip) which is about 3KiB

    3. Start typing a very long comment (paste in some text if you want) of this form after the module declaration (I have about 8-12 lines of text in there)

    {- This is an explanation of a library from real world haskell. We're trying to get the syntax highlighting
    - it doesn't seem to happen until now. Not sure what the issue is.
    - trying the backspace trick
    - asdfja;lkjfksdjfljfdflsflsjflsdjfsdf
    -}

    Then somewhere near the end start pressing backspace (and hold it). If it doesn't work the first time around, try doing this 2 or 3 times and make sure you save the changes every once and a while. I never got to the 3rd time. Symptoms:
    at a certain point the syntax colouring disappears
    if I then continue typing the comment and then hold backspace again, I get:

    java.lang.ArrayIndexOutOfBoundsException
    at java.lang.System.arraycopy(Native Method)
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:536)
    at java.lang.StringBuffer.append(StringBuffer.java:322)
    at org.eclipse.jface.text.GapTextStore.get(GapTextStore.java:164)
    at org.eclipse.jface.text.CopyOnWriteTextStore.get(CopyOnWriteTextStore.java:139)
    at org.eclipse.jface.text.AbstractDocument.get(AbstractDocument.java:1029)
    at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.text.ScionTokenScanner.setRange(ScionTokenScanner.java:322)
    at org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:172)
    at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:456)
    at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellPresentationReconciler.access$0(HaskellPresentationReconciler.java:1)
    at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellPresentationReconciler$SyntaxColoringJob.run(HaskellPresentationReconciler.java:65)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

    OR I get:

    java.lang.NullPointerException
    at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.text.ScionTokenScanner.nextToken(ScionTokenScanner.java:146)
    at org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:175)
    at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:456)
    at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellPresentationReconciler.access$0(HaskellPresentationReconciler.java:1)
    at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellPresentationReconciler$SyntaxColoringJob.run(HaskellPresentationReconciler.java:65)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

     
  • Koen
    Koen
    2014-01-06

    I may have a clue about what is going on: since my computer is rather old and thus slow, I think by continuously pressing backspace, particularly when passing line-endings, generates a lot of syntax highlighting requests and at a certain point the syntax highlighting results of a longer file are applied to a file that is already shorter. Hence the ArrayIndexOutOfBoundsException

     
  • JP Moresmau
    JP Moresmau
    2014-01-06

    Unfortunately I can't reproduce. But I'm made some enhancements in the synchronization of documents and scanners. It'll be part of 2.6.

     
  • Koen
    Koen
    2014-01-13

    Thanks for checking. I hope your improvements will work, because currently I often run into this situation, and it goes downhill from there. Typically shortly after, either:
    - moving the cursor down/up starts rendering lines one line higher/lower than expected, visually messing things up, and then typically ...
    - the "save" functionality gives a pop-up box without content, but with title "problem occurred" and then eclipse hangs, meaning I have to kill it from the command line with a kill -9. (kill -15 doesn't work)

    Is there anything logging / debugging wise that I could enable that provides more information?

     
    Last edit: Koen 2014-01-13
  • JP Moresmau
    JP Moresmau
    2014-01-13

    Check in the Eclipse Error log (Window -> Show View if you don't see it). Give me the stack traces of the errors so we can make the code more robust.

     
  • Koen
    Koen
    2014-01-16

    This seems to be the root cause, meaning it's the first exception in a long row that at a certain point leads to the "save failed" problem

    I just created once more a new project (because in the old one the problem occured in first 10sec of doing something) and imported all my sources again, and now stuff is working a lot faster and smoother. Maybe once this problem occurs it leaves some stuff around in the workspace that makes running in to it easier later on.

    java.lang.NullPointerException
        at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.text.ScionTokenScanner.nextToken(ScionTokenScanner.java:146)
        at org.eclipse.jface.text.rules.FastPartitioner.documentChanged2(FastPartitioner.java:339)
        at org.eclipse.jface.text.AbstractDocument.updateDocumentStructures(AbstractDocument.java:696)
        at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:793)
        at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1191)
        at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
        at org.eclipse.jface.text.projection.ProjectionTextStore.replace(ProjectionTextStore.java:111)
        at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1184)
        at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1210)
        at org.eclipse.jface.text.projection.ProjectionDocument.replace(ProjectionDocument.java:629)
        at org.eclipse.jface.text.DefaultDocumentAdapter.replaceTextRange(DefaultDocumentAdapter.java:248)
        at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7198)
        at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:8030)
        at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2474)
        at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5928)
        at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5959)
        at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5636)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
        at org.eclipse.swt.widgets.Widget.sendIMKeyEvent(Widget.java:1478)
        at org.eclipse.swt.widgets.Control.gtk_commit(Control.java:3021)
        at org.eclipse.swt.widgets.Canvas.gtk_commit(Canvas.java:160)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2080)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:5467)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4569)
        at org.eclipse.swt.internal.gtk.OS._gtk_im_context_filter_keypress(Native Method)
        at org.eclipse.swt.internal.gtk.OS.gtk_im_context_filter_keypress(OS.java:8167)
        at org.eclipse.swt.widgets.Control.filterKey(Control.java:2368)
        at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3229)
        at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:758)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2096)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:5467)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4569)
        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:8742)
        at org.eclipse.swt.widgets.Display.eventProc(Display.java:1243)
        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:2288)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3361)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
        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:354)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    
     
    Last edit: Koen 2014-01-16
  • Koen
    Koen
    2014-01-16

    So far for the good news, a few minutes later I'm back to the same problem in my new project

    Save Failed
    startLine (95) does not match endLine (96)
    
    java.lang.IllegalStateException: startLine (95) does not match endLine (96)
        at org.eclipse.jface.text.projection.ProjectionMapping.toImageLine(ProjectionMapping.java:480)
        at org.eclipse.jface.text.TextViewer.modelLine2WidgetLine(TextViewer.java:5306)
        at org.eclipse.jface.text.JFaceTextUtil.modelLineToWidgetLine(JFaceTextUtil.java:224)
        at org.eclipse.jface.internal.text.source.DiffPainter.paintLine(DiffPainter.java:220)
        at org.eclipse.jface.internal.text.source.DiffPainter.paint(DiffPainter.java:158)
        at org.eclipse.jface.text.source.LineNumberChangeRulerColumn.doPaint(LineNumberChangeRulerColumn.java:191)
        at org.eclipse.jface.text.source.LineNumberRulerColumn.doubleBufferPaint(LineNumberRulerColumn.java:703)
        at org.eclipse.jface.text.source.LineNumberRulerColumn.access$10(LineNumberRulerColumn.java:673)
        at org.eclipse.jface.text.source.LineNumberRulerColumn$5.paintControl(LineNumberRulerColumn.java:617)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:230)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1392)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
        at org.eclipse.swt.widgets.Control.gtk_expose_event(Control.java:3165)
        at org.eclipse.swt.widgets.Composite.gtk_expose_event(Composite.java:726)
        at org.eclipse.swt.widgets.Canvas.gtk_expose_event(Canvas.java:176)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2090)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:5467)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4569)
        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:8742)
        at org.eclipse.swt.widgets.Display.eventProc(Display.java:1243)
        at org.eclipse.swt.internal.gtk.OS._gdk_window_process_updates(Native Method)
        at org.eclipse.swt.internal.gtk.OS.gdk_window_process_updates(OS.java:5626)
        at org.eclipse.swt.widgets.ProgressBar.updateBar(ProgressBar.java:306)
        at org.eclipse.swt.widgets.ProgressBar.setMinimum(ProgressBar.java:235)
        at org.eclipse.jface.dialogs.ProgressIndicator.done(ProgressIndicator.java:108)
        at org.eclipse.jface.dialogs.ProgressIndicator.beginTask(ProgressIndicator.java:92)
        at org.eclipse.jface.action.StatusLine.beginTask(StatusLine.java:378)
        at org.eclipse.jface.action.StatusLineManager$1.beginTask(StatusLineManager.java:158)
        at org.eclipse.core.runtime.ProgressMonitorWrapper.beginTask(ProgressMonitorWrapper.java:47)
        at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.beginTask(EventLoopProgressMonitor.java:64)
        at org.eclipse.ui.internal.SaveableHelper$3.run(SaveableHelper.java:184)
        at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:276)
        at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
        at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
        at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1818)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
        at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1815)
        at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:284)
        at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:263)
        at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:206)
        at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:143)
        at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3769)
        at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3782)
        at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:53)
        at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
        at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
        at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
        at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
        at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
        at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
        at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
        at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
        at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:285)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:504)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:555)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:376)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:322)
        at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:84)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1554)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1391)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1416)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1401)
        at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1428)
        at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:829)
        at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3236)
        at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:758)
        at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2096)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:5467)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4569)
        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:8742)
        at org.eclipse.swt.widgets.Display.eventProc(Display.java:1243)
        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:2288)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3361)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
        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:354)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
    
     
  • Koen
    Koen
    2014-01-16

    An internal error occurred during: "Syntax Coloring".
    java.lang.ArrayIndexOutOfBoundsException
    
    java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:536)
        at java.lang.StringBuffer.append(StringBuffer.java:322)
        at org.eclipse.jface.text.GapTextStore.get(GapTextStore.java:164)
        at org.eclipse.jface.text.CopyOnWriteTextStore.get(CopyOnWriteTextStore.java:139)
        at org.eclipse.jface.text.AbstractDocument.get(AbstractDocument.java:1029)
        at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.text.ScionTokenScanner.setRange(ScionTokenScanner.java:322)
        at org.eclipse.jface.text.rules.DefaultDamagerRepairer.createPresentation(DefaultDamagerRepairer.java:172)
        at org.eclipse.jface.text.presentation.PresentationReconciler.createPresentation(PresentationReconciler.java:456)
        at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellPresentationReconciler.access$0(HaskellPresentationReconciler.java:1)
        at net.sf.eclipsefp.haskell.ui.internal.editors.haskell.HaskellPresentationReconciler$SyntaxColoringJob.run(HaskellPresentationReconciler.java:65)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
    
     
  • Koen
    Koen
    2014-01-16

    I just quit the ghci session in eclipse that is running the module I'm editing. It now appears to work a lot better. I typically have the module loaded in a ghci session because I'm building a parser with parsec and like to debug/test bottom-up with parseTest.

    It may be the fact that both ghci and scion need to access the changed file

     
  • JP Moresmau
    JP Moresmau
    2014-01-17

    I don't really think ghci would play into this. And we're not using scion anymore, but buildwrapper. I think they're synchronization issues inside Eclipse. The current code under Github synchronizes the document better, we had a scenario causing the last error you got and now it's gone...