Word-wrapping comments in Netbeans

主宰稳场 提交于 2020-01-02 01:46:28

问题


/*
 *
 * This is a long comment. I broke it into lines, but that made it impossible to edit without screwing up the formatting. Is there a way to make Netbeans add line breaks automatically?
 *
 */

Reads: This is a long comment. I broke it into lines, but that made it impossible to edit without screwing up the formatting. Is there a way to make Netbeans add line breaks automatically?


回答1:


As for today, the current NetBeans (7.3) word-wraps comments with some nice available extra options when formatting. NB: Unfortunately, this is currently only available for the Java language.

You can launch the formatter with the context menu→Format, or if you did not change the standard shortcuts, Alt+Shift+F should do.

To access the corresponding configuration: ToolsOptionsEditorFormatting; Language: Java; Category: Comments





回答2:


Your IDE won't format the comment for you. You will have to do it by hand. Yes, that means you have to re-format it once you add new words to it.




回答3:


If you press Enter to insert a new line, NetBeans will simply extend the docblock formatting - it won't break anything. There's also a useful option in the Preferences to display a line in the right margin, so you know when to break a line. It's in:

Tools > Options > Editor > Formatting > Right Margin

Is this what you're looking for?




回答4:


Go to tools->options->editor->formatting find line wrap and choose one the wrapping style you desire,there are two options : afterword and anywhere. and then click OK! :D

nb : I suggest you to choose afterword



来源:https://stackoverflow.com/questions/7121082/word-wrapping-comments-in-netbeans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!