【问题标题】:Is there a way to unwrap an already wrapped code in Intellij / Eclipse?有没有办法在 Intellij / Eclipse 中解开已经包装的代码?
【发布时间】:2018-08-16 10:07:43
【问题描述】:

我有基于 120 个字符的换行格式的代码。我将设置更改为在 IntelliJ CE 中将其包装为 200 个字符。运行重新格式化不会按照 200 个字符的限制重新包装代码。我必须手动将分割线移动到单行。

现有代码示例:

final MyOwnFactoryClass myOwnFactoryClass = new 
MyOwnFactoryClass(myStringVar1 , myStringVar2, 
myStringVar3);

我希望它看起来如何

final MyOwnFactoryClass myOwnFactoryClass = new MyOwnFactoryClass(myStringVar1 , myStringVar2, myStringVar3);

在 IntelliJ 或 Eclipse 中是否有更简单的方法来执行此操作?

对于那些想知道我为什么需要它的人,我有新的代码需要通读,并且以第一种格式阅读和解释非常困难。没有公司没有代码标准,所以我不会违反任何东西。

对插件或设置的更改会有用吗?

【问题讨论】:

    标签: eclipse intellij-idea code-formatting


    【解决方案1】:

    我只是通过实验找到了一种方法:)。 Intellij --> File --> Settings (Preferences for MacOS) --> Code Style --> Java --> Wrapping and Braces --> check all the align when multiline option in for all blocks you want like for() , if(), while() 等 --> 应用 --> 运行代码格式。它应该做必要的! :)

    【讨论】:

      猜你喜欢
      • 2021-01-21
      • 1970-01-01
      • 1970-01-01
      • 2010-09-17
      • 1970-01-01
      • 2010-12-16
      • 2020-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多