Summary: | Formatter doesn't like some comment | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | jean-louis willems <jean-louis.willems> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | minor | ||
Priority: | P3 | ||
Version: | 2.0 | ||
Target Milestone: | 3.0 M4 | ||
Hardware: | PC | ||
OS: | Windows 98 | ||
Whiteboard: |
Description
jean-louis willems
2002-08-09 11:45:42 EDT
The cause of the problem is the bad value in 'pendingNewLineAfterParen' in the format method when previous compilable token is a ELSE-token (C1) and when the lastToken is any comment (C2) A solution is to modify pendingNewLineAfterParen when LBRACE token is the current token (C3) and when C1 and C2. In the source of eclipse 2.0.1, 'pendingNewLineAfterParen' is updated by lines 423-425. pendingNewlineAfterParen = pendingNewlineAfterParen || (previousCompilableToken == TokenNameRPAREN && token == TokenNameLBRACE); I propose to modify to pendingNewlineAfterParen = pendingNewlineAfterParen || (C1 && C3 && C2) || (previousCompilableToken == TokenNameRPAREN && token == TokenNameLBRACE); where C1 : previousCompilableToken == TokenNameelse C2 : previousToken == TokenNameCOMMENT_BLOCK || previousToken == TokenNameCOMMENT_JAVADOC || previousToken == TokenNameCOMMENT_LINE Any other way to write C2 ? C3 : token == TokenNameLBRACE Finally, my proposal is... pendingNewlineAfterParen = pendingNewlineAfterParen // --- BEGIN PROPOSAL ADDED LINES ------------------------------------ || (previousCompilableToken == TokenNameelse && token == TokenNameLBRACE && (previousToken == TokenNameCOMMENT_BLOCK || previousToken == TokenNameCOMMENT_JAVADOC || previousToken == TokenNameCOMMENT_LINE)) // --- END PROPOSAL ADDED LINES -------------------------------------- || (previousCompilableToken == TokenNameRPAREN && token == TokenNameLBRACE); Thanks for the proposal. Right now we are revisiting the whole implementation of the code formatter. So for now we don't plan to apply bug fixes in the current implementation. We need to clear 2.1 bug reports that won't be addressed before 2.1. The new implementation is still in the works. Therefore we cannot include it for 2.1. Not enough testing and we need to polish the preferences. This will be address for 2.2 as stated in the JDT/Core plan. Resurrecting for 3.0 Reopen for 3.0 consideration. This is improved with the new formatter. Fixed and released in HEAD. Verified. |