diff --git a/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java b/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java index 27e30bdb..44bd3bd8 100644 --- a/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java +++ b/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java @@ -186,7 +186,7 @@ private boolean requireWhitespaceBefore(final Token token) { && (this.tokenIs(token, "<<", "^<<"))) && !this.tokenIs(token, ".", ",", ")", "}", "]") && !this.tokenIs(this.lastToken, "(", "{", "[") - && !this.tokenIs(this.lastTextToken, "_proc"); // Except for _proc. + && !this.tokenIs(this.lastTextToken, "_proc", "_loopbody"); // Except for _proc/_loopbody. } private boolean requireNoWhitespaceBefore(final Token token) { @@ -194,7 +194,7 @@ private boolean requireNoWhitespaceBefore(final Token token) { this.lastTextToken != null ? this.lastTextToken.getOriginalValue().toLowerCase() : null; return !this.tokenIs(token, GenericTokenType.COMMENT) && (this.tokenIs(token, ")", "}", "]", ",") - || this.tokenIs(this.lastTextToken, "@", "(", "{", "[", "_proc") + || this.tokenIs(this.lastTextToken, "@", "(", "{", "[", "_proc", "_loopbody") || this.nodeIsSlot() || this.currentNode.is(MagikGrammar.ARGUMENTS) || this.currentNode.is(MagikGrammar.PARAMETERS) diff --git a/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java b/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java index 56c0c759..32eaee05 100644 --- a/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java +++ b/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java @@ -266,6 +266,13 @@ void testProcDefinitionParameters(final String code) { assertThat(edits).isEmpty(); } + @Test + void testLoopbdoyDefinitionParameters() { + final String code = "_loopbody(x, y, z)"; + final List edits = this.getEdits(code); + assertThat(edits).isEmpty(); + } + // endregion // region: Indenting.