vanduc1102
vanduc1102

Reputation: 6245

Spring tool suite - Eclipse - Code format does not work

I am using STS ( Spring Tool Suite ) - Version 3.9.5 ( Eclipse 4.8.0)

I imported Google Java Code Style

enter image description here

A part of Google Java Code Style is working like: replace tab to space ( 2 spaces)

But when I hit format code ( Source --> Format ) it is still using default Eclipse code format.

Example this case:

enter image description here

Nothing changes at all when i try to format the code.

I setup maven fmt-maven-plugin. So I need to run mvn fmt:format to correct my code enter image description here

I think the code should be correct when I hit Source --> Format.

Do I miss some options somewhere?

Upvotes: 0

Views: 8567

Answers (2)

oxes125
oxes125

Reputation: 21

I had the same issue

Just take the plugin (google-java-format-eclipse-plugin_1.6.0)

and paste it into the folder in C:..\springtoolsuit-4.11.0.RELEASE\dropins

and close and open spring tool suit

enter image description here

Upvotes: 1

Abul Bashar Sobuj
Abul Bashar Sobuj

Reputation: 39

To format code you can try these :

  1. Select all code : Clt + A
  2. Format : Clt + Shift + F

Upvotes: 4

Related Questions