TypeScript 自动导入中的 WebStorm/PhpStorm 双引号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39779272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WebStorm/PhpStorm double quotes in TypeScript auto import
提问by Estus Flask
I'm using TypeScript style with single quotes, double quotes are used exclusively in HTML templates.
我使用带单引号的 TypeScript 样式,双引号专门用于 HTML 模板。
WebStorm/PhpStorm auto import adds import
statements with double quotes and ruins the style. I guess this applies to all JetBrains products.
WebStorm/PhpStorm 自动导入添加了import
带双引号的语句并破坏了样式。我想这适用于所有 JetBrains 产品。
How can this behaviour be fixed?
如何修复这种行为?
回答by LazyOne
This behaviour is controlled by the following option:
此行为由以下选项控制:
Settings/Preferences
Editor | Code Style | TypeScript
"Punctuation" tab | Generated code -> Quote marks
Settings/Preferences
Editor | Code Style | TypeScript
"Punctuation" tab | Generated code -> Quote marks
As of 2017.1 version it's on new Punctuation
tab and options are named a bit differently:
从 2017.1 版本开始,它位于新Punctuation
选项卡上,选项的名称略有不同:
回答by Leo
Also if you would like to add automatic space between curly braces when adding imports like so
此外,如果您想在像这样添加导入时在花括号之间添加自动空格
import { MyComponent } from './my.component';
import { MyComponent } from './my.component';
you may check in tab Spaces | Whithin | ES6 import/export braces
你可以签入标签 Spaces | Whithin | ES6 import/export braces
回答by Kamil Witkowski
回答by Yoraco Gonzales
Punctuation Tab did it. I also removed the semicolon at the end but now TSLint is missing it
标点标签做到了。我还删除了最后的分号,但现在 TSLint 缺少它
回答by VinPro
回答by Yasir Shabbir Choudhary
1st Things need to check in your Tslint file
第一件事需要检查你的 Tslint 文件
"quotemark": [
true,
"Double"
],
It's should be Double rather than Single because it's Failed TSLint Passed on Project Build.
它应该是 Double 而不是 Single,因为它在项目构建时失败了 TSLint 传递。
Now go to your Setting | Editor | TypeScript | Punctuation
现在去你的设置 | 编辑 | 打字稿 | 标点
Select Single from the dropdown and Apply/Ok it.
从下拉列表中选择 Single 并应用/确定它。
Now Congrats your IntellijIDEA are applied Double Quotes on AutoImport.