X-Git-Url: http://git.phpeclipse.com 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 c65a883..d209db0 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 @@ -18,6 +18,8 @@ import java.util.Hashtable; import java.util.Locale; import java.util.Map; +//import javax.swing.text.html.Option; + import net.sourceforge.phpdt.core.ICodeFormatter; import net.sourceforge.phpdt.core.compiler.CharOperation; import net.sourceforge.phpdt.core.compiler.ITerminalSymbols; @@ -781,7 +783,9 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { && previousToken != TokenNameRBRACE && previousToken != TokenNamesuper) { // && previousToken != TokenNamethis) { - space(); + if (!options.compactArrays) { + space(); + } } // If in a for/if/while statement, increase the parenthesis // count @@ -796,8 +800,10 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (previousCompilableToken == TokenNamearray) { arrayDeclarationCount++; arrayDeclarationParenthesis[arrayDeclarationCount] = openParenthesis[openParenthesisCount - 1]; - indentationLevel++; - pendingNewLines = 1; + if (!options.compactArrays) { + indentationLevel++; + pendingNewLines = 1; + } } // S } break; @@ -806,14 +812,21 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (arrayDeclarationCount > 0) { if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount - 1]) { if (previousCompilableToken != TokenNameLPAREN) { - newLine(1); + if (!options.compactArrays) { + newLine(1); + } } else if (previousToken == TokenNameCOMMENT_LINE || previousToken == TokenNameCOMMENT_BLOCK || previousToken == TokenNameCOMMENT_PHPDOC) { // prevent to combine comment line and statement line (#1475484) - newLine(1); + if (!options.compactArrays) { + newLine(1); + } + } + if (!options.compactArrays) { + indentationLevel--; + } - indentationLevel--; currentLineIndentationLevel = indentationLevel; pendingNewLines = 0; arrayDeclarationCount--; @@ -920,12 +933,16 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { if (arrayDeclarationCount > 0) { if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount - 1]) { // there is no left parenthesis to close in current array declaration (#1475484) - pendingNewLines = 1; + if (!options.compactArrays) { + pendingNewLines = 1; + } } } break; case TokenNameDOT: - space(); + if (!options.compactStringConcatenation) { + space(); + } pendingSpace = false; break; case TokenNameSEMICOLON: @@ -1447,6 +1464,8 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { case TokenNameDOLLAR: case Scanner.TokenNameCOMMENT_LINE: return false; + case TokenNameDOT: + return !options.compactStringConcatenation; default: return true; }