* test/lisp/progmodes/java-ts-mode-resources/indent.erts: Use default
indent offset, and tweak the indentation examples.
Code:
(lambda ()
(setq indent-tabs-mode nil)
- (setq java-ts-mode-indent-offset 2)
+ (setq java-ts-mode-indent-offset 4)
(java-ts-mode)
(indent-region (point-min) (point-max)))
=-=
public class Basic {
- public void basic() {
- return;
- }
+ public void basic() {
+ return;
+ }
}
=-=-=
=-=
public class EmptyLine {
- public void emptyLine() {
- |
- }
+ public void emptyLine() {
+ |
+ }
}
=-=-=
=-=
if (x) {
- for (var foo : foos) {
- |
- }
+ for (var foo : foos) {
+ |
+ }
} else if (y) {
- for (int i = 0; x < foos.size(); i++) {
- return;
- }
+ for (int i = 0; x < foos.size(); i++) {
+ return;
+ }
} else {
- return;
+ return;
}
=-=-=
=-=
public class T {
- @Autowired
- String a;
+ @Autowired
+ String a;
+}
+=-=-=
+
+Name: Array initializer
+
+=-=
+public class Java {
+ void foo() {
+ return new String[]{
+ "foo", // These
+ "bar"
+ }
+ }
+}
+=-=-=
+
+Name: Advanced bracket matching indentation (bug#61142)
+
+=-=
+public class Java {
+
+ public Java(
+ String foo) {
+ this.foo = foo;
+ }
+
+ void foo(
+ String foo) {
+
+ for (var f : rs)
+ return new String[]{
+ "foo",
+ "bar"
+ };
+ if (a == 0
+ && b == 1
+ && foo) {
+ return 0;
+ } else if (a == 1) {
+ return 1;
+ } else if (true)
+ return 5;
+ else {
+ if (a == 0
+ && b == 1
+ && foo)
+ while (true)
+ for (
+ ;;)
+ if (true)
+ return 5;
+ else if (false) {
+ return 6;
+ } else
+ if (true
+ && false)
+ return 6;
+ }
+ }
}
=-=-=