WebStorm、空代码块和大括号
WebStorm, empty code blocks, and curly braces
每次我 "Reformat Code",WebStorm 都会在任何空花括号之间放置一个换行符。例如,如果我有这个代码:
export class Example {}
然后我重新格式化代码(Command + Option + L
on mac),我最终得到:
export class Example {
}
如何阻止我的编辑器插入新行? WebStorm 版本为 2016.2
根据WebStorm在线帮助:
下
Braces Placement Options
将 Braces placement style
设置为 Next line if wrapped
使用这些设置似乎可以工作 -- IDE 不会将此类代码分成多行,但会保持原样。
Settings/Preferences | Editor | Code Style | TypeScript --> Wrapping and Braces
Keep when reformatting | Simple block in one line
-- 勾选
Braces placement | In class declaration
-- "End of line"
PhpStorm 2016.3 的屏幕截图...但在 2016.2 中应该是相同的。
实际上是Simple methods in one line
选项
每次我 "Reformat Code",WebStorm 都会在任何空花括号之间放置一个换行符。例如,如果我有这个代码:
export class Example {}
然后我重新格式化代码(Command + Option + L
on mac),我最终得到:
export class Example {
}
如何阻止我的编辑器插入新行? WebStorm 版本为 2016.2
根据WebStorm在线帮助:
下
Braces Placement Options
将 Braces placement style
设置为 Next line if wrapped
使用这些设置似乎可以工作 -- IDE 不会将此类代码分成多行,但会保持原样。
Settings/Preferences | Editor | Code Style | TypeScript --> Wrapping and Braces
Keep when reformatting | Simple block in one line
-- 勾选Braces placement | In class declaration
-- "End of line"
PhpStorm 2016.3 的屏幕截图...但在 2016.2 中应该是相同的。
实际上是Simple methods in one line
选项