Skip to main content



      Home
Home » Modeling » TMF (Xtext) » XText Formatter: organize elements
XText Formatter: organize elements [message #1748617] Fri, 25 November 2016 05:28 Go to next message
Eclipse UserFriend
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 02:57 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 20:49:05 EDT 2025

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

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

Back to the top