简体   繁体   English

如何在IntelliJ IDEA中为TypeScript自定义分号帮助

[英]How to customize semicolon help for TypeScript in IntelliJ IDEA

I would like to know if it's possible to customize the way IntelliJ highlights the line endings in TypeScript files where a semicolon is 'missing'. 我想知道是否可以自定义IntelliJ突出显示分号“缺失”的TypeScript文件中的行结尾的方式。 It appears to highlight that space everywhere where the next line is another statement. 它似乎突出了下一行是另一个声明的地方。 From what I understand, as long as the next statement does not start with [ or (, and our team does not put newlines in stupid places like directly after return, continue etc, there is no pain. 根据我的理解,只要下一个陈述不是以[或(并且我们的团队没有在愚蠢的地方放置新线路,例如直接返回,继续等)开始,就没有痛苦。

I'm talking about the highlight that looks like 我在谈论看起来像的亮点 这个 .

There are two ways to control this. 有两种方法可以控制它。

  • Put the cursor on the place where Intellij highlights the missing semicolon. 将光标放在Intellij突出显示缺少的分号的位置。 Click the "lightbulb" icon that should then pop up (or Alt-Enter keyboard shortcut for me), you'll see "Terminate statement". 单击应该弹出的“灯泡”图标(或者按Alt键输入键盘快捷键),您将看到“终止语句”。 Click the right arrow on keyboard which will open that menu item, click on "Disable inspection" 单击键盘上的右箭头将打开该菜单项,单击“禁用检查”

  • Open Intellij Preferences. 打开Intellij首选项。 Search for "unterminated statement". 搜索“未终止的声明”。 You'll find it under Editor->Inspections -> Javascript->Code style issues->Unterminated statement. 您可以在Editor-> Inspections - > Javascript-> Code style issues-> Unterminated statement下找到它。 Uncheck its checkbox. 取消选中其复选框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM