我可以配置 IntelliJ Idea 来识别自定义代码折叠区域指定吗?

发布于 2025-01-03 22:59:45 字数 402 浏览 2 评论 0原文

我非常喜欢 c# #region...#endregion 工具(有些人说这是一个坏习惯,但我们不讨论这个)。当我编写其他语言时,我非常想念它。将其“添加”到其他语言的明显方法是使用编辑器可以理解的特殊格式的注释。我已经成功设置 Kate 来支持 Java/Scala 代码的 //#region...//#endregion,类似的功能并不是实现的问题NetBeans (这里是如何实现的)。我可以使用 IntelliJ Idea 11 执行此操作吗?

I like c# #region...#endregion facility a lot (some people say that's a bad habit but let's not discuss that). I miss it a lot when coding other languages. The obvious way to "add" it to other languages is to use special-formed comments the editor would understand. I've managed to set up Kate to support //#region...//#endregion for Java/Scala code, alike feature is not a problem to achieve with NetBeans (here is how). Can I do this with IntelliJ Idea 11?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北笙凉宸 2025-01-10 22:59:45

功能计划在 IDEA 11.1 中实现,将于 2012 年第一季度末发布:

IntelliJ IDEA 11.1 将支持使用 NetBeans 和
Visual Studio 风格的注释。

This feature is planned for IDEA 11.1 that will be released in late Q1, 2012:

IntelliJ IDEA 11.1 will support custom folding using NetBeans and
Visual Studio style comments.

你另情深 2025-01-10 22:59:45

同时此功能在 IntelliJ IDEA 中实现并描述如下:
http://www.jetbrains.com/idea /webhelp/folding-custom-regions-with-line-comments.html

您可以使用两种样式定义代码区域:

VisualStudio 样式

#region Description 
Your code goes here... 
#endregion 

NetBeans 样式

// <editor-fold desc="Description"> 
Your code goes here... 
// </editor-fold> 

但它是建议不要混淆一个文件中的两种样式。 IntelliJ IDEA 将识别遇到的第一个折叠注释,并将其假定为为代码选择的样式。

Meanwhile this feature is implemented in IntelliJ IDEA and described here:
http://www.jetbrains.com/idea/webhelp/folding-custom-regions-with-line-comments.html

You can define code regions using two styles:

VisualStudio style

#region Description 
Your code goes here... 
#endregion 

NetBeans style

// <editor-fold desc="Description"> 
Your code goes here... 
// </editor-fold> 

But it is recommended to not mix up the two styles in one file. IntelliJ IDEA will recognize the first folding comment encountered, and will assume this as a style chosen for the code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文