假设我输入以下代码并对其进行格式化.
Let's say I type in the following code and format it.
if (condition) { /* Hello! */ }
如果这是 C# 代码,格式如下:
If this is C# code, it is formatted like this:
if (condition)
{
// Hello!
}
如果是 JavaScript,VSCode 的格式是这样的:
If it is JavaScript, VSCode formats it like this:
if (condition) {
// Hello!
}
那么我怎样才能为所有语言使用第一种格式样式(新行上的花括号)?我找不到设置或类似的东西.有什么建议吗?
So how can I use the first formatting style (curly braces on new lines) for all languages? I can't find a setting or something similar. Suggestions?
按照以下步骤使 Visual Studio Code 格式在 Java Script 的新行上打开花括号> 和 键入脚本.
Follow the steps below to make Visual Studio Code format opening curly braces on a new line for Java Script and Type Script.
在 Visual Studio 代码 (v1.20.0)
在用户设置"(在右侧窗格中)中添加以下行
Add the following lines in 'User Settings' (in the right side pane)
"javascript.format.placeOpenBraceOnNewLineForControlBlocks": true,
"javascript.format.placeOpenBraceOnNewLineForFunctions": true,
"typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
保存用户设置"即可完成!
这篇关于如何设置 VSCode 以将花括号放在新行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
Browserify,Babel 6,Gulp - 传播运算符上的意外令牌Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 传播运算符上的意外令牌)
是否可以将标志传递给 Gulp 以使其以不同的方式Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以将标志传递给 Gulp 以使其以不同的方式运行任务
为什么我们需要在全局和本地安装 gulp?Why do we need to install gulp globally and locally?(为什么我们需要在全局和本地安装 gulp?)
如何一个接一个地依次运行 Gulp 任务How to run Gulp tasks sequentially one after the other(如何一个接一个地依次运行 Gulp 任务)
打开 Javascript 文件时 Visual Studio 2015 崩溃Visual Studio 2015 crashes when opening Javascript files(打开 Javascript 文件时 Visual Studio 2015 崩溃)
检测 FLASH 插件崩溃Detect FLASH plugin crashes(检测 FLASH 插件崩溃)