Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/8.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
Javascript VsCode未使用单引号格式化TS/JS文件_Javascript_Typescript_Visual Studio Code_Prettier - Fatal编程技术网

Javascript VsCode未使用单引号格式化TS/JS文件

Javascript VsCode未使用单引号格式化TS/JS文件,javascript,typescript,visual-studio-code,prettier,Javascript,Typescript,Visual Studio Code,Prettier,对VS代码进行最新更新后,在windows中按Ctrl+Shift+F时,它将自动运行 将所有代码格式化为双引号而不是单引号,尽管我将其设置为仅使用单引号 这是我的设置文件: { "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "typescript.updateImportsOnFileMove.enabled": "always", "[javascript]": { "edit

对VS代码进行最新更新后,在windows中按Ctrl+Shift+F时,它将自动运行 将所有代码格式化为双引号而不是单引号,尽管我将其设置为仅使用单引号

这是我的设置文件:

{
"[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"atlascode.jira.workingSite": {
    "baseUrlSuffix": "atlassian.net"
},
"yaml.schemas": {
    "file:///c%3A/Users/kevin/.vscode/extensions/atlassian.atlascode-2.1.5/resources/schemas/pipelines-schema.json": "bitbucket-pipelines.yml"
},
"window.zoomLevel": -1,
"[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"git.autofetch": true,
"javascript.preferences.quoteStyle": "single",
"typescript.preferences.quoteStyle": "single",
"prettier.jsxSingleQuote": true,
"prettier.singleQuote": true
}

还有其他人在处理这件事吗


谢谢

从您的设置文件中,您似乎正在使用prettier进行代码格式化。 在最新更新中,prettier将读取配置从公共设置文件更改为prettier设置的专用文件。您可以通过他们提供的许多选项来配置prettier

示例(JSON):

创建
.prettierrc
文件,用JSON或YAML编写,扩展名可选:.JSON/.YAML/.yml(无扩展名优先)

.prettierrc

{
  "singleQuote": true
}

然后在
settings.json
(vscode设置文件)中提供
.prettierrc
文件的绝对路径

settings.json

...
"prettier.configPath": "./.prettierrc"
...

希望这有帮助

从您的设置文件中,您似乎正在使用prettier进行代码格式化。 在最新更新中,prettier将读取配置从公共设置文件更改为prettier设置的专用文件。您可以通过他们提供的许多选项来配置prettier

示例(JSON):

创建
.prettierrc
文件,用JSON或YAML编写,扩展名可选:.JSON/.YAML/.yml(无扩展名优先)

.prettierrc

{
  "singleQuote": true
}

然后在
settings.json
(vscode设置文件)中提供
.prettierrc
文件的绝对路径

settings.json

...
"prettier.configPath": "./.prettierrc"
...

希望这有帮助

您使用的是prettier吗?是的,正如您从代码段中看到的,我已经检查了prettier中的设置以使用单引号。您是否使用prettier?我是,正如您从代码段中看到的,我已经检查了prettier中的设置以使用单引号