Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Automatic re-indentation after tab/space switch #3335

Closed
albertxing opened this Issue · 6 comments

4 participants

Albert Xing Peter Flynn Narciso Jaramillo Randy Edmunds
Albert Xing

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.

There is currently an extension https://github.com/shumpei/brackets-autoindent-extension however the reindent must be manually initiated after tab/space switch.

This feature is already partly implemented for the spacing/tab width (when you switch the indentation amount); the reindentation occurs after changes made to this value.

Peter Flynn
Owner

@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.

Albert Xing

@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?

Narciso Jaramillo
Owner
njx commented

@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.

Narciso Jaramillo njx closed this
Albert Xing

@njx True, that's what I've come to realize as well.

Randy Edmunds
Collaborator

FYI, there's already an extension for converting between tabs and spaces: https://github.com/davidderaedt/tabtospace-extension

Albert Xing

@redmunds Thanks, exactly what I needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.