开发者

Displaying camel cased words as such with underscores in Eclipse

To me, reading long camel cased words can sometimes be a bit frustrating. For example:

aReallyLongCamelCasedMethodNameWhichIsTooSelfDescribing

Now, look at this version:

a_Really_Long_Camel_Cased_Method_Name_Which_Is_Too_Self_Describing

Which version is easier on your eyes? The second one is for mine.

开发者_StackOverflow中文版

While using Emacs, I stumbled upon a nice minor mode called glasses mode.

Since I'm working primarily with Java, I'm an Eclipse user and I wonder if there is some way to display camel cased words with underscores?

Note that I'm not asking for a way to actually convert camel cased words as described, I'm just looking for a mechanism that works like Emacs' glasses mode in Eclipse.

A regexp to actually do the conversion can be found by googling "Convert camelCase to underscores".


Have you considered using Emacs as your Java IDE? I really like Eclipse and the move sounds painful to me too. However, I bump into more and more people that are actually doing it. Just type "emacs ide java" into google.

It's definitely not a move for everyone, but if you know Emacs fairly well it might be a better option than trying to convert emacs features into Eclipse.


If you can't find any existing Eclipse plugins, then I would consider writing your own editor extension.


If you haven't laid down your mouse and gone into retirement yet, there are now 2 solutions to this:

  1. use emacs within Eclipse with the emacs+ plugin although I haven't established that you can use a .emacs init file to pre-program much of the cool emacs stuff emacs can do like your requirement
  2. convert camel-case to underscored separated using the AnyEdit plug-in and then hit CTRL+z to go back


try to keep your method names descriptive "and" short. If you have really such method names, i would think about it twice before i code it and maybe it is better to use refactoring "extract method" to tile the functionallity, which you can not describe shortly, into more than one method for a better design ;-) "increasing cohesion"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜