From bdc9d8c144ff00faaced6505d16dfdff5e208b07 Mon Sep 17 00:00:00 2001 From: bananeweizen Date: Fri, 6 Jan 2006 10:08:32 +0000 Subject: [PATCH] don't insert a line break when formatting an empty array declaration --- .../phpdt/internal/formatter/CodeFormatter.java | 10 +++++++++- 1 files changed, 9 insertions(+), 1 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 281ee1a..09e3add 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 @@ -511,6 +511,12 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { pendingSpace = false; } } + // don't linebreak empty array declarations + if (token == TokenNameRPAREN && arrayDeclarationCount > 0) { + if (previousCompilableToken == TokenNameLPAREN) { + pendingNewLines = 0; + } + } // Add pending new lines to the formatted source string. // Note: pending new lines are not added if the current token // is a single line comment or whitespace. @@ -690,7 +696,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // check for closing array declaration if (arrayDeclarationCount>0) { if (arrayDeclarationParenthesis[arrayDeclarationCount]==openParenthesis[openParenthesisCount]) { - newLine(1); + if (previousCompilableToken != TokenNameLPAREN) { + newLine(1); + } indentationLevel--; currentLineIndentationLevel = indentationLevel; pendingNewLines = 0; -- 1.7.1