Sublime Forum

"Reindent" does not work correctly if you have 4 space indentation and have inconsistent line indentation to begin with

#1

“Reindent” does not work correctly if you have 4 space indentation and have inconsistent lines…

If you have an inconsistant xml text like this with 3 spaces that don’t align with the 4 space rule set (’+’ representing spaces):

<root>
+++<level1>
+++</level1>
</root>

… then the position of “level1” will toggle between position 1 and 3 when using “Reindent”, instead of settling on position 4 which would be expected.

Seems like strange behaviour to me.
Even though i understand ST3 has a simple formatting algorithm as a starting point (without extra plugins), it should align with a single 4-space-step (4 spaces configured in settings) indentation.

Am I misunderstanding something?

(And yes, I know that there is an “Indent XML” plugin, but I would like to know how basic indentation is intended to work)

0 Likes

#2

Found this: https://github.com/sublimehq/sublime_text/issues/2027

Why has this not been addressed in 3 years?

Is there a workaround?

0 Likes

#3

I found a work around:

  1. Select all text: Ctrl+A
  2. “Unindent” until all lines are flush to the left edge: Shift+Tab
  3. “Reindent”: Ctrl+[
0 Likes

#4

The indentation is a bit weird on ST3, I’ve just learnt to live with it, and come up with work-a-rounds. Well done ! Sorry I can’t offer anything more useful !

Lozminda

0 Likes