VS代码中的缩进 [英] Indentation in VS Code
问题描述
我是Emacs的长期用户.我一直在尝试VS Code,到目前为止,我还是喜欢它.
I'm a long time Emacs user. I've been trying out VS Code and i like it so far.
我喜欢Emacs的一件事是,当我按下Tab键时,它总是正确地缩进代码.我已经看过了,但是我似乎无法在VS Code中得到这种表现.我尝试在设置中查找并搜索扩展名,但是没有运气.
One thing i love about Emacs is that it always indents the code correctly when i press tab. I've looked but i can't seem to get that behavior in VS Code. I've tried looking in the settings and searching for an extension but have had no luck.
有人可以帮我吗?我可以/必须安装扩展程序才能使其执行我想要的工作吗?
Can anyone help me on this please? Is there an extension i can/have to install to get it to do what i want?
我主要使用PHP,HTML,CSS和Javascript进行编码.
I code mostly in PHP, HTML, CSS and Javascript.
谢谢.
推荐答案
几件事:
要格式化(使漂亮"的)给定文件中的所有代码,可以在Windows上使用 Shift + Alt + F .有关更多信息,请参见此答案.
To format (make "pretty") all the code in a given file you can use Shift + Alt + F on Windows. See this answer for more information.
要调整选项卡大小的用户设置或将选项卡插入空格等,您可以编辑settings.json
( Ctrl + Shift + P ,然后输入用户设置").然后,您可以手动添加/
To adjust the user settings for tab size or to insert tabs as spaces, etc. you can edit settings.json
(Ctrl + Shift + P then type "user settings"). You can then manually add/edit:
// number of spaces for a tab
"editor.tabSize": 2,
// insert spaces when pressing tab
"editor.insertSpaces": true
我相信这两个设置均会被"editor.detectIndentation"
覆盖,因此您可能也必须注意一下.
I believe both of these settings are overriden by "editor.detectIndentation"
so you may have to look at that too.
这篇关于VS代码中的缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!