Bug 560391 - Source -> Format doesn't obey to the indentation size set in preferences
Summary: Source -> Format doesn't obey to the indentation size set in preferences
Status: NEW
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.16 (2019-12)   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: Future   Edit
Assignee: wst.xml CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2020-02-21 07:00 EST by Marco Brandizi CLA
Modified: 2023-06-08 00:53 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Brandizi CLA 2020-02-21 07:00:13 EST
In Preferences/XML/XML Files/Editor, I have "Indent with tabs" on and "Indentation size" set to 2. However, when I do Source/Format on an opened XML file (either a specific format like pom.xml, or a generic test.xml), it formats in a completely different way: 2 tabs for every indentation, each tab rendered as 2 spaces.

Is there another option for that? Is it a bug? The problem seems to have been around for a while [1].

[1]: https://stackoverflow.com/questions/7960612/adt-15-0-xml-indentation-formatting-broken
Comment 1 Lars Vogel CLA 2020-02-21 10:26:13 EST
I suggest to give wild web developer a try (available via Eclipse marketplace).
Comment 2 Nitin Dahyabhai CLA 2020-02-21 12:14:18 EST
As mentioned in that SO's answer, ADT implemented a different formatter for its file types. I must be confused, because the Text Editors preference page controls how many columns a tab character occupies, and otherwise it sounds like the formatter is doingg exactly what you told it to: indent using 2 tab characters.
Comment 3 Marco Brandizi CLA 2020-02-23 16:43:43 EST
Thanks for your answers.

It's not doing what I expect and what other editors (eg, Java) actually do: If I say "indent with tabs" and "tab size=2", I expect that one indentation level is rendered with a single tab character and showing two character positions.

Sorry with the confusion about the Android Development PlugIn: the SO post mentions it, however I see the same behaviour without using anything related to Android (I mostly develop for the server side and I know almost nothing about Android). To me, the XML editor is a pretty basic feature of the Eclipse IDE, even if it's tecnically a plug-in.