Community
Participate
Working Groups
I'd like to see some kind of distinction between a Javadoc comment. /** * Construct a new <code>Foo</code> Object. */ and a non-javadoc comment in the formatter preferences. /* typical code comment. */ // more of the same. non-javadoc code comments can contain preformatted text and whatnot, but wrapping them with HTML <pre> or <code> would be pointless as it's not processed by the javadoc program (or ant task, or maven goal). A simple checkbox "ignore non-javadoc comments" would be sufficient. Idea: non-javadoc comment formatting could be limited to the max line width wrapping, while leaving new lines and spacing etc intact. (But I would guess that this would make things complicated.)
We should reconsider the bundling of comment formatting.
*** Bug 55809 has been marked as a duplicate of this bug. ***
I'd like to chime in. I have some code that must remain commented out except during specific testing: /* Uncomment this code, as well as the call from init() to enable a socket- based command listener for testing */ /* private void listenForCommands() { ServerSocket s = null; PrintStream out; s = new ServerSocket(888); System.out.println("Command listener is on port + getLocalPort()); while (true) and so on... */ After I format, I get: /* * private void listenForCommands() { ServerSocket s = null; PrintStream out; * s = new ServerSocket(888); System.out.println("Command listener is * on port " + s.getLocalPort()); while (true) { Socket socket = s.accept(); * out = new PrintStream(socket.getOutputStream()); out * .println("MessageDispatcher command listener awaits your bidding..."); So then I tried the approach of toggling the comment: /* Uncomment this code, as well as the call from init() to enable a socket- based command listener for testing */ // // private void listenForCommands() // { // ServerSocket s = null; // PrintStream out; // s = new ServerSocket(888); // System.out.println("Command listener is on port " + s.getLocalPort()); // while (true) // and so on But then if I format the source, I get: /* * Uncomment this code, as well as the call from init() to enable a * socket-based command listener for testing */ // // private void listenForCommands() // { // ServerSocket s = null; // PrintStream out; // s = new ServerSocket(888); // System.out.println("Command listener is on port " + s.getLocalPort()); // while (true) and all the leading white space/indention is collapsed. So yes, I'd second a way to handle this sort of thing.
Resetting priority to P3. Will be reassessed for the next release.
Ownership changed.
I also like to see this feature addressed. The comment formatter is such a nice feature. But I's like to use it on for JavaDoc comments only. All other comments should not be formated.
I too would like this addressed. It has been floating around Bugzilla in one form or another since 2003 and keeps getting rediscovered with each version by new users who find even new twists on how treating non-javadoc comments as if they were javadoc is messing them up. (compiler directives and template settings being the big ones) Block (/* */) and Line (//) comments almost never conform to the markup restrictions and formatting schemes that javadoc implies and uses. They should be their own options or preferably not be javadoc formatted at all. A possible mid-term fix would be giving us a command line switch to just disable the formatting of non-Javadoc (/** */ comments in a session. List of related issues in Bugzilla (ignoring ones marked dup): 49412 2003-12-30 [formatting] Offer comment formatting options per comment type 75516 2004-10-02 [formatting] Proposed comments formatting changes 75460 2004-10-01 [formatting] Java code snippet formatting only applied to Javadoc 102784 2005-07-05 Distinction between Javadoc and comment formatting
*** Bug 154473 has been marked as a duplicate of this bug. ***
This BUG is still present in Eclipse 3.2 and is very annoying because it practically makes the code formatter unusable for me - "destroying" my non-javadoc comments. Please address this issue ASAP.
*** Bug 102784 has been marked as a duplicate of this bug. ***
*** Bug 167834 has been marked as a duplicate of this bug. ***
I'd just like to second the previous comment. I would like to format multiple Java files at once, but because each of my files has a block comment at the top (our copyright notice) I cannot do it (the block comment is messed up by the formatter). Note: This happens EVEN IF COMMENT FORMATTING IS DISABLED! A fix would be much appreciated! Thank you!
Just to retain a requirement detail from Bug #102784, which has been marked as duplicate of this bug: When this feature will be provided and COMMENT formatting can then be switched off independently from Javadoc formatting, the COMMENTS shall then really NOT BE TOUCHED AT ALL, even not with regard to indentation or other beautyfying. This is even true for such obvious things like inserting blanks in a comment like '/*comment*/' (--> '/* comment */') because we use simple comments for our code generator tags (like '/*>*/' and other similar ones) and such tags shall NOT BE TOUCHED by a formatter.
Not adjusting the indentation can result in really weird formatting. What should happen if the initial indentation of the block comment is wrong?
(In reply to comment #12) > A fix would be much appreciated! Thank you! A patch would also be much appreciated :-).
(In reply to comment #14) > Not adjusting the indentation can result in really weird formatting. > What should happen if the initial indentation of the block comment is wrong? > What means wrong? Because there are no common rules how block comments may be aligned with surrounding code, right or wrong very much depends on the intention of the developer who wrote the comment, doesn't it? Otherwise more sophisticated options for the formatting of block comments may be required. So I would see two possibilities: Either just have an option to say "Don't format block comments" and then really don't format them at all (even no indentation), or introducing some more sophisticated options like "format block comment indentation yes/no" and so on. What is most important to us, is NOT to fill in or leave out blanks for reasons of beautyfying. So, for example, "/*comment*/" shall NOT be re-formatted to "/* comment */".
Is there an outlook, in which version this case will be finally adressed? We (as well as other users) are continuously struggling with this problem and it has a history now since February 2004 (!).
Since 3.3M5, it is possible to make the distinction between javadoc, block and single line comments. So this might be a dup of the bug fixed for 3.3M5. Did someone try the 3.3M5 build with regards to this issue?
(In reply to comment #18) Thank you for the quick response. We've not yet installed and tried 3.3M5. We'll definitely have an immediate look at this (highly appreciated) new feature, when we move to 3.3. B.t.w. - when is 3.3 official release to be expected? I've briefly searched on the eclipse site for roadmap information, but did not find it (so far). Is there a page where road map information is provided?
*** This bug has been marked as a duplicate of bug 49412 ***
>Is there a page where road map information is provided? http://wiki.eclipse.org/index.php/Europa_Simultaneous_Release#Milestones_and_Release_Candidates
Set target as 3.3 M6 to verify this bug... Please put back it to 3.3 M5 after the verification, thanks
Set target to 3.3M5.