Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 在VS代码中更漂亮-双引号内的双引号格式_Visual Studio Code_Prettier - Fatal编程技术网

Visual studio code 在VS代码中更漂亮-双引号内的双引号格式

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"

我在VS代码中使用了扩展Prettier。我希望代码中有双引号。“jsxSingleQuote”和“singleQuote”设置为false

当我在这行代码上运行format时

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
}

你在技术上是正确的,但问题是“如何让它以另一种方式发生”,而不是“为什么会这样”。你在技术上是正确的,但问题是“如何让它以另一种方式发生”,而不是“为什么会这样”。