Visual Studio Code - 调整导入引用设置 [英] Visual Studio Code - Adjust import quotation setting

查看:50
本文介绍了Visual Studio Code - 调整导入引用设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 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 - 调整导入引用设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆