[英]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.我不知道为什么,但是 vs 代码不允许我缩进。 It's deleting any whitespace whenever I press the tab or the space key in the HTML file.
每当我在 HTML 文件中按制表符或空格键时,它都会删除任何空格。 I thought it was because of Prettier, but after uninstalling it still does it.
我以为是 Prettier 的原因,但卸载后还是这样。 I also took off trim auto whitespace.
我还取消了修剪自动空格。
(settings.json) (设置.json)
To fix the issue解决问题
Pressing ctrl+M causes the ⇥ Tab key to move focus instead of inserting a ⇥ Tab character.按 ctrl+M 会使 ⇥ Tab 键移动焦点,而不是插入 ⇥ Tab 字符。 Turn it off by pressing the shortcut again.
再次按快捷方式将其关闭。
To disable the shortcut禁用快捷方式
Open "Keyboard Shortcuts" with ctrl+K, then ctrl+S.使用 ctrl+K 打开“键盘快捷键”,然后 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;如果您在设置中检查 VSCode; 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 VSCode 设置: https ://i.stack.imgur.com/lQemt.jpg
Factory resetting vs code & manually deleting extensions files was what fixed the issue.出厂重置 vs 代码和手动删除扩展文件是解决问题的方法。
Below is a link to factory reset vs code and deleting the extensions.以下是恢复出厂设置与代码和删除扩展的链接。
https://stackoverflow.com/a/36109176/13393443 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.当我遇到问题的原因时,我正要进行出厂重置并删除我的扩展程序 -为用户和工作区检查“Trim Trailing WhiteSpace”。 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.
在设置中搜索“whiteSpace”并继续取消选中该按钮。 Make sure to uncheck that box for user and workspace too
确保也取消选中用户和工作区的复选框
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.