Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Glitch in xtext generated code editor while typing "enter"(When typing "enter" on some parser conditions (?) the editor breaks the text just visually)
Glitch in xtext generated code editor while typing "enter" [message #1736128] Sun, 26 June 2016 20:57 Go to next message
Javier Fernandes is currently offline Javier FernandesFriend
Messages: 6
Registered: July 2009
Junior Member
Hi guys !

Have you seen this before ?
Find attached a video capture of my screen.

Basically the editor generated for my language sometimes breaks the text. But it is just like a "visual" bug, because for example if you select all the text (CTRL+A) then you can see that the text gets fixed. Is like the editor was not synchronized with the text on the file, and it was somehow wronly formating the code.

Or if you start to move the cursor down/up passing through the lines that now look horrible, you can see the "real content" and it is fine.

This was happened with 2.9.1.
So I have now updated my dsl to xtext 2.10 as well as all eclipse dependencies to neon, but it is still happening (I've captured this movie with this version).

This issue was reported to my project a while ago, but it was difficult to reproduce.

Now with 2.10 it was like more consistent, as you can see in the movie.
It happens when you hit enter:
- AFTER }
- BEFORE {

Any help or clue on how to debug this would be appreciated !

Thanks !

PS: this happens on win, mac and linux all the same

Regards
Re: Glitch in xtext generated code editor while typing "enter" [message #1737875 is a reply to message #1736128] Wed, 13 July 2016 16:55 Go to previous message
Javier Fernandes is currently offline Javier FernandesFriend
Messages: 6
Registered: July 2009
Junior Member
Autoreplying just in case some one else faces this issue in the future Smile

I finally was able to find the issue and fix it.
It didn't had much to do with XText but with our own code.
Along with the editor we provide a GEF view for a diagram based on the same document as the current editor.
So this view implements IDocumentListener

And on documentChanged() it was layout the elements again. Let say not a really long task, but, something that took some miliseconds.

override documentChanged(DocumentEvent event) {
refresh
}

This seems that somehow affected the editor, because it was running on the same thread.

I changed it to use eclipse's UIJob launching this task in another thread asynchronously, and now it works great.

something like this:

override documentChanged(DocumentEvent event) {
refreshJob.schedule()
}

Where:

val refreshJob = new UIJob("Updating diagram view") {
override def runInUIThread(IProgressMonitor monitor) {
diagram = createDiagramModel
initializeGraphicalViewer
Status.OK_STATUS
}
}

Previous Topic:Problem: Access restriction
Next Topic:Serialization error: contains non-transient values but has no corresponding assignment in rule
Goto Forum:
  


Current Time: Fri Apr 26 21:04:10 GMT 2024

Powered by FUDForum. Page generated in 0.02423 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top