Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Auto edit strategy with ID's
Auto edit strategy with ID's [message #1074022] Fri, 26 July 2013 00:20 Go to next message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Member
I need to implement an auto edit strategy which should have ID's in its context. My DSL has something like this:

'function' name=ID ':'
FunctionBody
'end'


So, I need to check when the user typed "function", followed by an ID and a colon, and only then auto complete the "end" keyword. Is it possible?

I looked into the DefaultAutoEditStrategyProvider, but it only seemed capable of autoediting predetermined tokens. Also, SingleLineTerminalsStrategy and MultiLineTerminalsEditStrategy seemed to ignore strategies triggered by a keyword. Is there a way around?
Re: Auto edit strategy with ID's [message #1074128 is a reply to message #1074022] Fri, 26 July 2013 07:06 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

the provider is just for registering the strategies to be used. You can add any IAutoEditStrategy (have a look at their implementations).

However, I would use a simpler approach:

1. provide a template for a function.
2. the auto edit strategy inserts end already when "function" is typed. This may even be achieved using the multilineTerminals in the provider (not tested).

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Auto edit strategy with ID's [message #1074428 is a reply to message #1074128] Fri, 26 July 2013 18:59 Go to previous message
Erick Fonseca is currently offline Erick FonsecaFriend
Messages: 68
Registered: December 2011
Member
Thank you for your suggestion, I'm trying templates now. They're probably better for my case.
As for inserting function/end with the multilineTerminals, it is not possible. It ignores auto edit rules containing keywords, I'm not sure why.
Previous Topic:xtext unusably slow for editing and building certain kinds of grammars
Next Topic:validation order
Goto Forum:
  


Current Time: Thu Mar 28 12:56:12 GMT 2024

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

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

Back to the top