Visual studio code 在VS代码中更漂亮-双引号内的双引号格式
我在VS代码中使用了扩展Prettier。我希望代码中有双引号。“jsxSingleQuote”和“singleQuote”设置为false 当我在这行代码上运行format时Visual studio code 在VS代码中更漂亮-双引号内的双引号格式,visual-studio-code,prettier,Visual Studio Code,Prettier,我在VS代码中使用了扩展Prettier。我希望代码中有双引号。“jsxSingleQuote”和“singleQuote”设置为false 当我在这行代码上运行format时 var hello = "\"hello\""; 更漂亮的格式: var hello = '"hello"'; 我想保留双引号和代码行不应该被格式化 以下是设置: { "arrowParens": "always"
var hello = "\"hello\"";
更漂亮的格式:
var hello = '"hello"';
我想保留双引号和代码行不应该被格式化
以下是设置:
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "..../app.js",
"parser": "babel"
}
这是我们的初衷。发件人:
- 如果引号的数量超过了其他引号,则为 较少使用的将用于格式化字符串-例如:“我是双重的 “引用”导致“我被双重引用”,而“这个”示例是 单引号“导致”此“示例”为“单引号”
- 如果引号的数量超过了其他引号,则为 较少使用的将用于格式化字符串-例如:“我是双重的 “引用”导致“我被双重引用”,而“这个”示例是 单引号“导致”此“示例”为“单引号”
.prettierrc
,即与package.json同级,属性singleQuote
设置为true,如下所示:
{
"singleQuote": true
}
尝试在根级别创建文件
.prettierrc
,即与package.json同级,属性singleQuote
设置为true,如下所示:
{
"singleQuote": true
}
你在技术上是正确的,但问题是“如何让它以另一种方式发生”,而不是“为什么会这样”。你在技术上是正确的,但问题是“如何让它以另一种方式发生”,而不是“为什么会这样”。