[英]WebStorm formatter isn't good with TSLint
I am working with TypeScript in WebStorm for quiet a while, and recently I added TSLint to my setup in order to write better code. 我正在使用WebStorm中的TypeScript安静一段时间,最近我将TSLint添加到我的设置中以编写更好的代码。 I successfully integrated it into the IDE (WebStorm 2016) but I have a bad experience with the IDE formatter combining the TSLint formatting rules.
我成功地将它集成到了IDE(WebStorm 2016)中,但我对使用TSLint格式规则的IDE格式化程序的体验很糟糕。
For example I write: 例如我写道:
let bar: foo; // fine by tslint standarts
And then I press Ctrl + Alt + L to format everything automatically and I get: 然后我按Ctrl + Alt + L自动格式化所有内容,我得到:
let bar:foo; // without space between the variable ":"
// and its type the tslint complains
I haven't found any solution on the web and couldn't find a manual way to change this behaviour in the IDE. 我没有在网上找到任何解决方案,也找不到在IDE中更改此行为的手动方法。
Any help will be much appreciated ! 任何帮助都感激不尽 ! :)
:)
update: since the version 2016.3 the path is: Settings > Editor > Code Style > TypeScript 更新:从版本2016.3开始,路径为: 设置>编辑器>代码样式> TypeScript
Go to: Settings > Code Style > TypeScript 转到: 设置>代码样式> TypeScript
Go to the Spaces tab and scroll down to Other 转到Spaces选项卡并向下滚动到Other
The last 2 options should do the trick: 最后两个选项应该可以解决问题:
Before type reference colon ':' 在类型引用冒号':'之前
After type reference colon ':' 在类型引用后冒号':'
Check one or both, depending on what you want. 根据您的需要检查一个或两个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.