Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Automatic braces completion
Automatic braces completion [message #734955] Mon, 10 October 2011 14:18 Go to next message
Romain  Aïssat is currently offline Romain AïssatFriend
Messages: 16
Registered: June 2011
Junior Member
Hi,

I'm writing a dsl using Xtext 2.0 and have a problem, as title says, with braces completion.

Here's an example, suppose I have the following grammar, allowing to write intervals :

Model:
	declarations += Declaration;
	
Declaration :
	name = ID 'in' range = Interval ';';
	
Interval :
	leftBracket = Bracket low = INT ',' up = INT rightBracket = Bracket;
	
enum Bracket :
	leftClose = '[' | leftOpen = ']';


And suppose I write the following code in the generated editor :

x in [1,2[;


The problem is that if I hit 'enter' at the end of this line, the editor will automatically close the second bracket like this :

x in [1,2[;
    |  
]


(where '|' represents the cursor position)

and this of course is a non-sense in this context.

Does someone have a hint to help desactivate this behaviour, don't really know where to search for...?

Thanks in advance!
Re: Automatic braces completion [message #734978 is a reply to message #734955] Mon, 10 October 2011 14:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you may have to customize org.eclipse.xtext.ui.editor.autoedit.DefaultAutoEditStrategyProvider

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Automatic braces completion [message #735229 is a reply to message #734978] Tue, 11 October 2011 09:52 Go to previous message
Romain  Aïssat is currently offline Romain AïssatFriend
Messages: 16
Registered: June 2011
Junior Member
Thanks Christian, I'll be looking at this.
Previous Topic:Synchronization issues in the Outline view
Next Topic:popup menu contribution to outline (Xtext 2.0 M5)
Goto Forum:
  


Current Time: Fri Apr 26 12:50:55 GMT 2024

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

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

Back to the top