Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Formatting keywords
Formatting keywords [message #1786338] Tue, 01 May 2018 15:57 Go to next message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 135
Registered: July 2009
Senior Member
Given a case insensitive language, is it possible to use the formatter to render all keywords in upper case letters, e.g., convert keyword Package to PACKAGE?

Thanks!
Re: Formatting keywords [message #1786339 is a reply to message #1786338] Tue, 01 May 2018 16:18 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12230
Registered: July 2009
Senior Member
Hi,

i am not aware of any native support for that but you can always create custom replacers for any regions you want e.g.

def dispatch void format(Greeting g, extension IFormattableDocument document) {
		document.addReplacer(new AbstractTextReplacer(document, g.regionFor.keyword("Hello")) {

			override createReplacements(ITextReplacerContext context) {
				context.addReplacement(region.replaceWith(region.text.toUpperCase))
				return context
			}

		})
	}



Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Formatting keywords [message #1786388 is a reply to message #1786339] Wed, 02 May 2018 14:48 Go to previous message
Lutz Wrage is currently offline Lutz WrageFriend
Messages: 135
Registered: July 2009
Senior Member
Thanks, that works.
Previous Topic:need enum with some value
Next Topic:Debugging DSL based on Xbase
Goto Forum:
  


Current Time: Thu Sep 20 16:22:35 GMT 2018

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

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

Back to the top