Pankesh Patel
Pankesh Patel

Reputation: 1302

Generated java code formatting

I am generating Java Code from my Domain specific Language (DSL). My Language is using String Template files for generating Java Code from DSL.

My problem is that String Template files generate un-formatted Java code in Eclipse. Whenever I generated code, I have to press cntr + Shift + F to format each generated Java file.

Is there any way of generating formatted code ? I am using Eclipse IDE.

Upvotes: 0

Views: 900

Answers (2)

Nicola Musatti
Nicola Musatti

Reputation: 18228

You have to take care of indentation in your StringTemplate templates. I tend to write templates for fragments of code such as a function definitions, function calls or even argument declarations that have to be expanded over a collection of variable elements, and combined them programmatically as arguments to a single souce file template.

Upvotes: 1

Kowser
Kowser

Reputation: 8261

At least you can select the project/the package of your interest and use the Ctrl+Shift+F shortcut to format all of them immediately. This is much better compare to formatting each and every files.

Upvotes: 2

Related Questions