diff --git a/.eclipse/org.eclipse.jdt.core.prefs b/.eclipse/org.eclipse.jdt.core.prefs index 605fc315..1d379438 100644 --- a/.eclipse/org.eclipse.jdt.core.prefs +++ b/.eclipse/org.eclipse.jdt.core.prefs @@ -136,6 +136,7 @@ org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 diff --git a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs index 704e4de5..aa1ecd3c 100644 --- a/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs +++ b/spring-javaformat-eclipse/io.spring.javaformat.eclipse/src/io/spring/javaformat/eclipse/projectsettings/org.eclipse.jdt.core.prefs @@ -133,6 +133,7 @@ org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=false org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/multi-line-statement-indentation.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/multi-line-statement-indentation.txt new file mode 100644 index 00000000..7c63370c --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/expected/multi-line-statement-indentation.txt @@ -0,0 +1,21 @@ +package simple; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class Simple { + + public String someMethod() throws MalformedURLException, IOException { + String settingsXml = new String(Files.readAllBytes(Paths.get("src", "intTest", "projects", "settings.xml")), + StandardCharsets.UTF_8) + .replace("@localCentralUrl@", + new File("build/int-test-maven-repository").toURI().toURL().toString()) + .replace("@localRepositoryPath@", new File("build/local-maven-repository").getAbsolutePath()); + return settingsXml; + } + +} \ No newline at end of file diff --git a/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/multi-line-statement-indentation.txt b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/multi-line-statement-indentation.txt new file mode 100644 index 00000000..7c63370c --- /dev/null +++ b/spring-javaformat/spring-javaformat-formatter-tests/src/test/resources/source/multi-line-statement-indentation.txt @@ -0,0 +1,21 @@ +package simple; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +public class Simple { + + public String someMethod() throws MalformedURLException, IOException { + String settingsXml = new String(Files.readAllBytes(Paths.get("src", "intTest", "projects", "settings.xml")), + StandardCharsets.UTF_8) + .replace("@localCentralUrl@", + new File("build/int-test-maven-repository").toURI().toURL().toString()) + .replace("@localRepositoryPath@", new File("build/local-maven-repository").getAbsolutePath()); + return settingsXml; + } + +} \ No newline at end of file diff --git a/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs b/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs index 8f5c0661..584377eb 100644 --- a/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs +++ b/spring-javaformat/spring-javaformat-formatter/src/main/resources/io/spring/javaformat/formatter/eclipse/formatter.prefs @@ -41,6 +41,7 @@ core.formatter.alignment_for_throws_clause_in_method_declaration=16 core.formatter.alignment_for_type_arguments=0 core.formatter.alignment_for_type_parameters=0 core.formatter.alignment_for_union_type_in_multicatch=16 +core.formatter.align_selector_in_method_invocation_on_expression_first_line=false core.formatter.blank_lines_after_imports=1 core.formatter.blank_lines_after_package=1 core.formatter.blank_lines_before_field=0