-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigate Soft Tabs As If They Are Hard Tabs #2798
Comments
The mere existence of TabSanity and the fact that it has been downloaded 1596 times is a testament that I'm not alone in these frustrations. |
@jedmao does TabSanity work in vscode? Or are you saying they should add it? Because this behavior is killing me slowly. Is there a work around for this? I care about 1, 2, 3 the most. |
@jamesmenera, TabSanity does not work in vscode. I'm proposing it be baked into the editor itself. There is no workaround, currently. |
@jamesmenera it looks like |
This extension might help somewhat |
Thanks @egamma. @jamesmenera I'm working on TabSanity for vscode right now and I'm definitely making some good progress. I will keep everyone updated on this thread. |
@jamesmenera I've published an alpha version of TabSanity here. There are definitely some kinks to work out, but as long as you don't go crazy with multiple cursors and such you should be fine. |
Without any add-ons, full-fat Visual Studio's block indentation (with tabs as spaces) solves most of the problems because, if you are indented and add a new line, a single back-space is all that is required to jump out one indentation level. As it stands, VS Code handles this poorly - if you use soft tabs and need to get out by one indentation level, you have to press backspace n times where n is your tab width! |
@egamma: Thanks for suggesting that extension - it's properly brilliant! I hope the VS Code devs are reading this thread because I would love to see that behaviour as a first-class option or even the default behaviour of the backspace key when soft-tabs are enabled. |
@stephenmartindale, it's not just backspace, but arrow-key navigation as well. The TabSanity plugin resolves both, but there are some kinks with multiple cursors I haven't yet had the time to sort out. |
I'm trying to make the move from Atom and the "Atomic Soft Tabs" feature is what I am missing a lot. Atom defines this as "Skip over tab-length runs of leading whitespace when moving the cursor.". It's the first setting visible in Atom's settings: I have been trying TabSanity in VSCode and haven't found issues with it yet. I do work a lot with multiple cursors though, I'm hoping it hangs in there. |
Over 2 years later and nothing? I love everything about VSCode except the fact that this still isn't a thing yet. Please give us the option to navigate soft tabs as hard tabs without needing an extension |
There is a good example of how PHPStorm handles it, https://blog.jetbrains.com/phpstorm/2014/09/smart-backspace-in-phpstorm-8/ VSCode really lacks feature like this. |
@vedmant Are you sure VS Code doesn't have this? The author of Backspace++ discontinued work on his extension because the feature was already in. I'm talking about simply navigating the spaces as if they were tabs which requires this extension |
And I'm not really actively developing TabSanity either. It's way more complicated than it originally seemed, especially where multiple cursors are concerned. |
@jedmao hey thanks for the great work you've done so far. Yeah there's a few difficulties when using tabsanity that I wish weren't there. I really really just wish VS Code would add this natively. It's literally the one thing it's missing for me |
@aniforprez I checked VS configuration, didn't find anything related to this feature. |
@vedmant I cannot find a setting for it myself but after disabling all the extensions, VS Code behaves as expected when erasing multiple spaces using backspace that are the configured tab length. The Delete button will only delete a single space regardless. But navigating those tab-configured spaces is a chore which Tabsanity solves once it's enabled |
@aniforprez I'm talking about a bit different functionality, when backspace deletes whole line when it's currently on the right indent, or it goes to right indent when it has more whitespace before cursor, check animation here https://blog.jetbrains.com/phpstorm/2014/09/smart-backspace-in-phpstorm-8/ |
OH I'm so sorry I completely misunderstood because I didn't pay close attention to the animation. Yeah currently VS Code does not have such a feature and it does look pretty useful if you don't need to delete individual tabs. I do wonder though if it wouldn't get confusing in languages like Python where indentation is everything and if you want to move the scope of a line whether this would conflict with such an operation. |
@aniforprez It's very useful feature, I so used to it in PHPStorm, that it's now a pain to work without it in VScode. It will not have any issues with Python, if you need to go one indent left just press Tab + Shift. And also this feature can be optional. |
This would be a good to have feature. I use a lot of soft tabs. |
Yeah, now try it with multiple cursors! |
They work fine as far as I can tell. I'll upload a video tomorrow. |
Video showing multiple cursors and weird mixed tab files. There is one bug with the mouse handling (that I know of). Hopefully someone from Microsoft can help with that. |
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
insertSpaces
setting istrue
(or leading spaces precede tab characters on a line).tabSize
).Examples of how spaces are treated as tabs
tabSize
spaces, instead of just one.tabSize
is4
and the cursor is on position6
(between tabs) and the left arrow key is pressed, the cursor jumps2
spaces instead of4
, landing gracefully on a tab stop.tabSize
is4
and the cursor is on position4
, but the first non-whitespace character is on position6
, then the space on position5
is assumed to be alignment; thus, a right arrow key press would land on position5
.tabSize
spaces in one batch, so that a single undo operation restores all of the spaces that were deleted.Exposing an editor setting
navigateSoftTabsAsHard
should be exposed for those who wish to opt in or out of this feature. The default value is debatable.The text was updated successfully, but these errors were encountered: