如何在Intellij中创建命名代码块? [英] How to create named code blocks in Intellij?

查看:189
本文介绍了如何在Intellij中创建命名代码块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当Intellij为UI表单生成代码时,您可以折叠代码块并将其命名为:UI Designer生成的代码。可以折叠代码选择,但其折叠表示显示为...。是否可以给它一个自定义名称?
它看起来类似于C#中折叠的#region代码块。

When Intellij generates code for UI forms you can collapse the code block and it is named: "UI Designer generated code". It is possible to collapse a code selection but its collapsed representation is displayed as "...". Is it possible to give it a custom name? It would look similar to a collapsed #region code block in C#.

推荐答案

他们现在已经实现了区域支持!

They have implemented region-support now!

来自 http:// youtrack。 jetbrains.com/issue/IDEA-80636

目前Intellij IDEA支持两种基本类型的自定义折叠评论:

Currently Intellij IDEA supports two basic types of custom folding comments:

类NetBeans:

//<editor-fold desc="...">
... code ...
//</editor-fold>

和VisualStudio一样:

And VisualStudio-like:

//region <...>
... code ...
//endregion

注意该行如果语言支持#字符,则可以将region ... endregion的注释符号从//更改为#。但默认情况下,自定义折叠注释使用与通常用于语言行注释相同的注释字符。
在许多情况下,您可以使用Ctrl + Alt + T(环绕声),而不是手动输入注释。
如果您发现某些内容无效,请提交单独的问题。

Note that line commenting symbols for "region...endregion" can be changed from "//" to "#" if the '#' character is supported by a language. But by default custom folding comments use the same comment characters as normally used for language line comments. Instead of typing the comments manually, in many cases you can use Ctrl+Alt+T (surround with). Please submit separate issues if you find that something doesn't work as expected.

这篇关于如何在Intellij中创建命名代码块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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