Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XText Formatter: organize elements
XText Formatter: organize elements [message #1748617] Fri, 25 November 2016 10:28 Go to next message
Andrey Petrenko is currently offline Andrey PetrenkoFriend
Messages: 8
Registered: March 2016
Junior Member
Is there a way to organize elements during formatting?

For example if I have imports

import A.A
import B.C
import A.B
import B.B

after formatting I want to get to following result

import A.A
import A.B

import B.B
import B.C
Re: XText Formatter: organize elements [message #1748829 is a reply to message #1748617] Tue, 29 November 2016 07:57 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

Formatting should only adjust whitespace and not change the semantic model. What you are asking for looks more like an "organize import" clean up.

So, yes, you can do that but not with the formatter. You could for instance change the model and then use the serializer to write it back.

Have a look at the OrganizeImportsHandler here: https://github.com/eclipse/xtext-eclipse/blob/master/org.eclipse.xtext.xbase.ui/src/org/eclipse/xtext/xbase/ui/imports/OrganizeImportsHandler.java#L33
Previous Topic:EMFModelInferrer
Next Topic:Addictional Optional Argument Recognition
Goto Forum:
  


Current Time: Thu Mar 28 20:05:03 GMT 2024

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

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

Back to the top