nev*_*ves 6 formatting visual-studio-code vscode-settings
在Visual Studio Code中,保存文件后如何自动格式化源代码?
nev*_*ves 10
通过设置启用“保存时格式化”
"editor.formatOnSave": true
Run Code Online (Sandbox Code Playgroud)
您还可以仅针对一种特定语言进行设置:
"[python]": {
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.formatOnSave": true
},
Run Code Online (Sandbox Code Playgroud)
从1.6.1版开始,Vscode支持“ 保存时格式化 ”。它将自动使用相关的已安装格式化程序扩展名来格式化整个文档。
Ben*_*ert 10
以下是在保存设置中更改 VS Code 自动格式的步骤:
在 VS Code 中还有用于格式化的键盘快捷键。例如,格式化所选代码的默认值应为 [Ctrl]+K [Ctrl]+F(连续键入两个热键)。
以下是更改自动格式热键设置的步骤:
小智 9
转到/.vscode/settings.json文件并粘贴以下代码
{
"editor.formatOnSave": true,
}
Run Code Online (Sandbox Code Playgroud)
它将在保存时格式化您的代码。
| 归档时间: |
|
| 查看次数: |
3921 次 |
| 最近记录: |