Wanna Coffee
Wanna Coffee

Reputation: 2798

How to enable auto format code in eclipse?

I have tried to format xhtml code in eclipse IDE - Juno using the shortcut by two ways. which are

  1. Ctrl +Shift+F

    I did't get any solution from this.

  2. menu -->Source -->Format

    I am not able to find Format under Source also, instead it showing only three options. see clear image in below.

    enter image description here

what is the problem with my Eclipse IDE? What i have to change in settings?

Upvotes: 3

Views: 4079

Answers (1)

Konstantin Yovkov
Konstantin Yovkov

Reputation: 62854

Possibly you need to associate the .xhtml file type to an Editor.

  1. Open Window -> Preferences -> General -> Editors -> File Associations.
  2. Find .xhtml.
  3. Associate the Web Editor to the .xhtml file type.

Then try to re-format again with Ctrl + Shift + F.

Upvotes: 2

Related Questions