简体   繁体   中英

VS code is deleting spaces after tab key and space key (Can't indent)

I don't know why, but vs code isn't allowing me to indent. It's deleting any whitespace whenever I press the tab or the space key in the HTML file. I thought it was because of Prettier, but after uninstalling it still does it. I also took off trim auto whitespace.

(settings.json)

在此处输入图像描述

To fix the issue

Pressing ctrl+M causes the ⇥ Tab key to move focus instead of inserting a ⇥ Tab character. Turn it off by pressing the shortcut again.

To disable the shortcut

Open "Keyboard Shortcuts" with ctrl+K, then ctrl+S. Or go to File > Preferences > Keyboard Shortcuts. Search for toggle tab key moves focus. Right Click, Remove Keybinding.

If you check you VSCode on Settings; then at the Search bar type whitespace and you'll be able to see all the options.

VSCode Settings: https://i.stack.imgur.com/lQemt.jpg

Factory resetting vs code & manually deleting extensions files was what fixed the issue.

Below is a link to factory reset vs code and deleting the extensions.

https://stackoverflow.com/a/36109176/13393443

I was about going through factory reset and deleting my extension when I bumped into the cause of the problem - ucheck "Trim Trailing WhiteSpace" for both user and workspace. It was like miracle for me. NOTE: I have an extension that saves my work as I type. Search for "whiteSpace" in setting and proceed to uncheck the button. Make sure to uncheck that box for user and workspace too

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM