intellij中的软包装 [英] Soft wraps in intellij

查看:84
本文介绍了intellij中的软包装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我启用了所有在Intellij(2017.3)中可以找到的自动换行设置:

外观|常规同意该列表:

我点击了套用"-实际上通常可以 用于立即查看效果-并且还可以在 Settings 对话框上单击 OK .但是无济于事/没有区别/仍然没有包装.我已经尝试了几次.

对于很长的代码行,这有点挑战.有想法吗?

解决方案

您选择了正确的选项(文件|设置|编辑器|常规|在编辑器中使用包装纸).

如文档中所述:

如果选中此复选框,则将自动换行(或自动换行)用于编辑.在此情况下,通常不会显示水平滚动条选项已启用.但是,在某些情况下,当一条线不能软包装",水平滚动条仍会出现(例如,如果一行由比可见范围宽的单个字符串组成区域.

除上述异常外,应用参数时,它将在编辑器中换行

  • 如果它们不适合编辑器视图,
  • 或者它们的长度大于右边距(列)参数指定的值.

在编辑器中,边距显示为垂直灰线.可以指定为 File |.设置|编辑器代码样式|右边距(列).

I have enabled all the soft wrap settings that could be found in Intellij (2017.3):

The Appearance|General agrees with that list:

I had hit "apply" - which typically actually does work for immediately viewing the effects - and also OK on the Settings dialog.. but to no avail / no difference / still no wrapping. I have tried several times.

This is a bit challenging with very long code lines. Thoughts?

解决方案

You've picked the right option (File | Settings | Editor | General | Use soft wraps in editor).

[Edit: As of IntelliJ v. 2019.1.3, possibly earlier, the options are now: (File | Settings | Editor | General | Soft-wrap files), with a list of filename extensions that should be soft-wrapped by default.

]

As it said in documentation:

If this checkbox is selected, soft wraps (or word wraps) are used in the editor. The horizontal scroll bar is not normally shown when this option is enabled. However, in certain cases, when a line cannot be "soft-wrapped", the horizontal scroll bar still appears (for example, if a line consists of a single string that is wider than the visible area.)

With the exception described above, when the parameter applied it will wrap the lines in editor

  • if they cannot fit on the editor view,
  • or if their length bigger than value specified by the Right margin (columns) parameter.

In editor the margin displayed as a vertical gray line. It can be specified as File | Settings | Editor | Code Style | Right margin (columns).

这篇关于intellij中的软包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆