Automatic re-indentation after tab/space switch#3335

Labels

Milestone

Assignee

4 participants

Brackets currently does not automatically reindent the document after switching from tabs to spaces and vice versa. I feel that this is quite an important feature if tab/space switching is presented as an option.

@albertxing do other editors rewrite all the indentation in the file after switching settings? I was under the impression that this was a separate command in most editors (Sublime, for example).

At the least we would definitely be willing to add an explicit command to core. Currently that's being tracked by this user story: Convert Tabs & Spaces. I've added the Starter Feature label since it seems like there are several extensions that provide good examples of how to implement this.

@peterflynn True, just checked Sublime and it doesn't provide reindentation after the setting change from the menu item. However, if you initiate Indentation: Convert to Spaces from the command palette, it changes the indentation immediately. Perhaps this feature wouldn't be so important if Brackets included a built-in command-palette (yes, I'm aware of the extension and using it).

Personally I don't see any use in delaying the switch only to have to do it manually after switching the options. Any opinion on this?

@albertxing -- in Sublime's case, I think that command you're calling from the command palette is actually the explicit "convert existing indentation to spaces" function (not the "switch my indentation preference to spaces" command). In general, I don't think it would be expected behavior (based on other editors) to make it so that switching your indentation preference automatically rewrites your current file. However, the other direction might make sense--rewriting your current file to spaces (or tabs) should conceivably update your indentation preference for that file as well.

We'll capture these issues on the user story that @peterflynn mentioned above. Closing this bug.