[TxMt] Why multi-line commenting for Java bundle?

Trevor Harmon trevor at vocaro.com
Fri Aug 1 21:23:02 UTC 2008


Hi all,

Normally, when you execute the Comment Line command, it inserts a  
single-line comment (e.g., // in C). That's true for Python, Ruby, C/C+ 
+, Objective-C, shell scripts, you name it... but not Java. For some  
reason the Java bundle inserts multi-line comments (/* ... */). This  
leads to problems when trying to uncomment lines. For example:

1. Select N lines
2. Hit Command+/ to comment the lines
3. Cancel the selection
4. Go back and select the same N lines
5. Hit Command+/ to uncomment the lines

This works in all the other modes, but in Java, it's impossible. The  
problem is step 4. Instead of selecting just the same N lines, you  
have to extend the selection to N+1 lines, but only far enough to  
select the first two characters in the N+1 line (to capture the  
trailing "*/"). And if you really want some fun, try uncommenting only  
some of the lines. Again, works perfectly in every mode but Java.

So, basically, the Comment Line command seems only half-baked for the  
Java bundle. I realize I could probably fix this myself by hacking  
around in the Bundle Editor, but shouldn't the bundle be using single- 
line comments by default? Even if there's some benefit of multi-line  
comments that I'm missing, you'd think the Java bundle would still use  
single-line comments for the sake of consistency. Why's the Java  
bundle such an oddball?

Trevor




More information about the textmate mailing list