Sublime Forum

Indent using spaces + backspace not working as expected

#1

I have used 4 spaces and tab characters my whole life, until I was “forced” to code with 2 spaces and space characters in a project. Now I love it!

I set up this particular project with project settings to overwrite my own defaults ONLY for this project. Cool. Worked great. Backspace did delete 2 spaces, like it would with tab characters. Cool.

Now, … and I don’t know what happened, this is no longer the case. When I press backspace, it only deletes one space character, although my settings, both defaults and project specific, should make it delete “a whole tab”, but don’t.

I have the following settings:
“tab_size”: 2,
“translate_tabs_to_spaces”: true,
“use_tab_stops”: true,

Any idea why I only delete one char on backspace?

0 Likes

#2

Does it happen in any file or only specific ones? What does the status bar show regarding the tab settings of the current file?

1 Like

#3

Good catch; it appears to be okay in vue files. All 3 sections (template, script, style) works as expected.

normal *.js files and *.jsx files seem to be a problem. *.ts also don’t work.

The tab settings show the following, both in files where it works and where it doesn’t.

0 Likes

#4

@FichteFoll – still couldn’t solve the issue; any idea on how to fix this for *.js, *.jsx and *.ts files? Thanks!

0 Likes

#5

You may have syntax-specific settings interfering, which take precedence over project-specific settings. That, or the files you open have 4-tab indentation already and ST detecst that for you.

Which packages do you have installed for jsx and ts support and do you use Babel for js files? What name for the syntax is being shown in the status bar?

0 Likes

#6

I ran into this issue as well. Backspace was removing a single space for JS but not other types of files. It turns out that the Typescript package sets “use_tab_stops” to false in the default package settings for some reason. I just uninstalled the package since it causes more trouble than its worth (the Typescript package also breaks a lot of Sublime’s default functionality for JS files), but if you want to keep it, you can just override it in the package settings.

P.S. I also had to close all my JS tabs and reopen them before it started working. For some reason, restarting Sublime is not sufficient to ensure the setting changes take effect.

1 Like

#7

Oh boi, you’re a freaking life saver. What on earth is going on behind the scenes?!

I immediately removed the package and was disappointed that it didn’t work, although I instinctively restarted ST3; and then I read the rest of your reply (well, that’s just how things are in the internet, right? :D) – Thanks for the special tip at the end.

After closing all JS tabs (why ever…) it’s now working for me again!
Bye bye typescript (… well … until Vue V3 hits the deck, I guess?)

Thank you so much!

0 Likes