-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Closed
Labels
editor-commandsEditor text manipulation commandsEditor text manipulation commandsfeature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-testplan
Milestone
Description
If implemented properly, the user should not even realize they are working with spaces for indentation, which is one of the greatest pains of a person who prefers tabs for indentation working on a file that has spaces for indentation.
Spaces should be treated as if they were tabs under the following conditions
- The text editor's
insertSpacessetting istrue(or leading spaces precede tab characters on a line). - The cursor is within the range of leading indentation.
- We can't possibly guess where indentation ends and alignment begins, so this includes all leading whitespace (both spaces and tab characters, assuming each tab character is the width of
tabSize).
- We can't possibly guess where indentation ends and alignment begins, so this includes all leading whitespace (both spaces and tab characters, assuming each tab character is the width of
- The user attempts to do any of the following:
- Arrow-key navigation.
- Backspace.
- Delete.
- Mouse selections (more difficult to implement, I'm sure).
Examples of how spaces are treated as tabs
- If the cursor is at the beginning of the line and the right arrow key is pressed, the cursor jumps
tabSizespaces, instead of just one. - If
tabSizeis4and the cursor is on position6(between tabs) and the left arrow key is pressed, the cursor jumps2spaces instead of4, landing gracefully on a tab stop. - If
tabSizeis4and the cursor is on position4, but the first non-whitespace character is on position6, then the space on position5is assumed to be alignment; thus, a right arrow key press would land on position5. - The backspace and delete keys should eliminate up to
tabSizespaces in one batch, so that a single undo operation restores all of the spaces that were deleted. - Ideally, mouse selections would also be restricted to tab stops, so you can't individually select the spaces between a single indent.
Exposing an editor setting
- Perhaps an editor setting called
navigateSoftTabsAsHardshould be exposed for those who wish to opt in or out of this feature. The default value is debatable.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
editor-commandsEditor text manipulation commandsEditor text manipulation commandsfeature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-testplan