如何使eclipse的自动格式忽略一段代码? [英] How can I make eclipse's autoformatter ignore a section of code?

查看:454
本文介绍了如何使eclipse的自动格式忽略一段代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记得有一种方法来标记eclipse中的一段代码(特殊注释或注释?),这使得autoformatter忽略该部分。或者我可能会drempt这个...



主要用于我的字符串包裹在几行,我不希望自动格式化重新排列这个。 >

解决方案

由于eclipse 3.5(或3.6)这是可能的:
- 转到项目属性 - Java代码样式 - 格式化 - 编辑...
- 选择标记为关/开标签的标签,
- 在源代码的评论中包含标签,如

  / * @formatter:on * / 


i remember there being a way of marking a section of code in eclipse (special comment or annotation?) which made the autoformatter ignore that section. Or I may have drempt this...

Used mainly when I have strings which wrap onto several lines and i don't want the autoformatter to rearrange this.

解决方案

Since eclipse 3.5 (or 3.6) this is possible: - Go to project properties -- Java Code Style -- Formatter -- Edit... - choose the tab marked "Off/On Tags", - include the tags in comments in your source code, like

/* @formatter:on */

这篇关于如何使eclipse的自动格式忽略一段代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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