java IntelliJ 禁用自动行拆分
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31581159/
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
IntelliJ disable automatic line splitting
提问by Czarek
Recently I updated to the newest version of IntelliJ IDEA 14.1.4 Ultimate. Since this update it automatically splits lines for me which is very annoying because I'd like to do that by myself manually.
最近我更新到最新版本的 IntelliJ IDEA 14.1.4 Ultimate。由于此更新它会自动为我拆分行,这非常烦人,因为我想自己手动执行此操作。
Example: I might be typing something like this:
示例:我可能正在输入以下内容:
throw new IllegalArgumentException("You can only provide one vararg/optional parameter to the end of this method!");
And while typing intellij automatically continues on a new line:
并且在输入 intellij 时自动继续换行:
throw new IllegalArgumentException("You can only provide one vararg/optional parameter to the end of this" +
" method!");
Now this might seem fine, but is really annoying when intelli decides to do it when you are writing a decimal double for example as it creates errors like this:
现在这可能看起来不错,但是当您编写十进制双精度时,intelli 决定这样做时真的很烦人,因为它会产生如下错误:
How can I disable this feature/modify this behaviour?
如何禁用此功能/修改此行为?
采纳答案by m4mbax
You can edit the Code Style Settings at:
您可以在以下位置编辑代码样式设置:
File > Settings > Editor > Code Style > Java > Wrapping and Braces
There are different options, for your problem set Right margin columnto 300 or something like this or just uncheck Ensure right margin it not exceeded. You can also experiment with them.
有不同的选项,对于你的问题,将Right margin column设置为 300 或类似的东西,或者只是取消选中确保右边距不超过。您也可以尝试使用它们。
Press Ctrl + Alt + L
to format afterwards. Unfortunately once IntelliJ has wrapped the lines I am not sure if it unwraps them on its own, maybe you have to fix this.
Ctrl + Alt + L
之后按进行格式化。不幸的是,一旦 IntelliJ 包装了这些行,我不确定它是否会自行解开它们,也许您必须解决这个问题。
Please consider when changing line length etc. that sometimes line length is needed due to Code Conventions, Checkstyle and those... :)
在更改行长等时,请考虑有时由于代码约定、Checkstyle 和那些而需要行长... :)
回答by Toufiqul
Go to Intellij Settings and follow the instructions on these two pictures:
转到 Intellij 设置并按照这两张图片上的说明进行操作:
回答by sweetfa
回答by John
for phpstorm 2016.2.1
用于 phpstorm 2016.2.1
go to editor->code style->right margin(columns)
change default 200
to 400+
That's it!
去editor->code style->right margin(columns)
改变默认200
为400+
就是这样!