问题描述
在 Visual Studio Code 中使用 TypeScript 时,类型的导入建议(由空格 + 句点触发)将使用双引号生成导入.
When working in TypeScript in Visual Studio Code, the import suggestion on a type (triggered by space + period) will generate an import using double quotes.
我们的 TypeScript linter 验证是否尽可能使用单引号.
Our TypeScript linter verifies that single quotes are used where possible.
正如你在下面看到的,建议有双引号 ("@angular/...")
As you can see below, the suggestion has double quotes ("@angular/...")
如何调整导入设置?
推荐答案
从 VSCode 1.10 开始,这(遗憾的是)还无法实现.但是对于很多用户来说似乎是个问题.VSCode 主题知道这个问题,你可以按照这个来了解它何时实施:https://github.com/Microsoft/TypeScript/issues/13270
As of VSCode 1.10, this is (sadly) not possible yet. But is an issue for a lof of the users as it seems. The VSCode theme is aware of this issue and you can follow this to know when it is implemented: https://github.com/Microsoft/TypeScript/issues/13270
2018 年 6 月更新
自 VSCode 1.24(2018 年 6 月)以来,有一个选项!
Since VSCode 1.24 (June 2018) there is an option for this!
"typescript.preferences.quoteStyle": "single"
有关更多信息,请参阅:
For more info see:
https://code.visualstudio.com/updates/v1_24#_preferences-for-auto-imports-and-generated-code
这篇关于Visual Studio Code - 调整导入报价设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!