From c90a8dddea5c543b781138139202222d24ca9171 Mon Sep 17 00:00:00 2001 From: bananeweizen Date: Tue, 10 Jan 2006 21:07:55 +0000 Subject: [PATCH 1/1] request 1123108: keep strings on multiple lines during formatting --- .../phpdt/internal/formatter/CodeFormatter.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java index 09e3add..449375c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java @@ -523,8 +523,12 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // if the comment is between parenthesis, there is no blank line // preservation // (if it's a one-line comment, a blank line is added after it). - if (((pendingNewLines > 0 && (!isComment(token))) - || (newLinesInWhitespace > 0 && (openParenthesisCount <= 1 && isComment(token))) || (previousCompilableToken == TokenNameLBRACE && token == TokenNameRBRACE)) + if (( + (pendingNewLines > 0 && (!isComment(token))) + || (newLinesInWhitespace > 0 && (openParenthesisCount <= 1 && isComment(token))) + || (previousCompilableToken == TokenNameLBRACE && token == TokenNameRBRACE) + || (newLinesInWhitespace > 0 && previousCompilableToken == TokenNameDOT) + ) && token != Scanner.TokenNameWHITESPACE) { // Do not add newline & indent between an adjoining close brace and // close paren. Anonymous inner classes may use this form. @@ -799,6 +803,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } break; case TokenNameDOT: + space(); pendingSpace = false; break; case TokenNameSEMICOLON: @@ -1267,7 +1272,6 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameLPAREN: case TokenNameNOT: case TokenNameTWIDDLE: - case TokenNameDOT: case 0: // no token case TokenNameWHITESPACE: -- 1.7.1