Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Automatically indent while typing
Automatically indent while typing [message #1440700] Wed, 08 October 2014 18:36 Go to next message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 181
Registered: July 2009
Senior Member
In my Xtext DSL editor I want to provide the following: Whenever I type a line that contains the keyword "connections," I want the editor to automatically increase the indentation of the next line. I got his working for parentheses, etc using the autoedit stuff in Xtext, but I couldn't figure out how to tie the indentation to a keyword. Is there an example available somewhere?

I've looked at DefaultAutoEditStrategyProvider and related classes, but without better documentation it is rather difficult to figure out what's supported and how to do use it.
Re: Automatically indent while typing [message #1441244 is a reply to message #1440700] Thu, 09 October 2014 12:49 Go to previous message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 181
Registered: July 2009
Senior Member
OK, so I figured out how to make it work. In my AutoEditStrategyProvider's configure method I added
acceptor.accept(compoundMultiLineTerminals.newInstanceFor("connections", ";"), IDocument.DEFAULT_CONTENT_TYPE);

This works, but I am stumped as to why. In particular, depending on the string that I pass as the second parameter to newInstanceFor it (a) works as expected, (b) indents but also inserts the second string, or (c) does not indent the next line.
Previous Topic:Dynamically switch separator in csv file when certain rule is encountered
Next Topic:Strange difference between ModelInferrer and ModelGenerator
Goto Forum:
  


Current Time: Thu Apr 25 01:21:49 GMT 2024

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

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

Back to the top