Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Automatic re-indentation after tab/space switch #3335

Closed
albertxing opened this Issue Apr 4, 2013 · 6 comments

Comments

Projects
None yet
4 participants
Contributor

albertxing commented Apr 4, 2013

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.

Member

peterflynn commented Apr 4, 2013

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

Contributor

albertxing commented Apr 4, 2013

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

Member

njx commented Apr 8, 2013

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

@njx njx closed this Apr 8, 2013

Contributor

albertxing commented Apr 8, 2013

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

Contributor

redmunds commented Apr 8, 2013

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

Contributor

albertxing commented Apr 8, 2013

@redmunds Thanks, exactly what I needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment