summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/c-ts-mode-resources
diff options
context:
space:
mode:
authorTheodor Thornhill <theo@thornhill.no>2023-02-05 08:49:08 +0100
committerTheodor Thornhill <theo@thornhill.no>2023-02-06 07:43:37 +0100
commit5a6dfab1e4d5d89e5d5ff3bef73279926f067dbc (patch)
tree7e603133217c4cc9766564a07c9c3ee334af26c9 /test/lisp/progmodes/c-ts-mode-resources
parentc3262216abbb9ea04e1d3af25df1f9743efd1513 (diff)
downloademacs-5a6dfab1e4d5d89e5d5ff3bef73279926f067dbc.tar.gz
emacs-5a6dfab1e4d5d89e5d5ff3bef73279926f067dbc.tar.bz2
emacs-5a6dfab1e4d5d89e5d5ff3bef73279926f067dbc.zip
Use c-ts-common-statement-offset in java-ts-mode (bug#61142)
* lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Add new matchers to enable c-ts-common machinery. (java-ts-mode): Add regexps. * lisp/progmodes/c-ts-common.el (c-ts-common-statement-offset): Fix typo in documentation and use the new if statement helpers. (c-ts-common-if-statement-regexp): New defvar. (c-ts-common-nestable-if-statement-p): New defvar. (c-ts-common--fix-nestable-if-statement): New helper. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: Add test for complicated bracket matching indentation. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Add indent rules for bracketless statements.
Diffstat (limited to 'test/lisp/progmodes/c-ts-mode-resources')
-rw-r--r--test/lisp/progmodes/c-ts-mode-resources/indent.erts45
1 files changed, 45 insertions, 0 deletions
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 7dcc3b0fb3a..6f64e1e7953 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -244,3 +244,48 @@ int main() {
}
}
=-=-=
+
+Name: Complicated mixed bracket matching indentation (bug#61142)
+
+=-=
+void foo(
+ int foo) {
+ for (;;)
+ return 5;
+
+ 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)
+ for (
+ int i = 0;
+ i < 5;
+ i++)
+ if (true)
+ do
+ i = 5;
+ while (true);
+ else if (false)
+ {
+ return 6;
+ }
+ else
+ if (true
+ && false)
+ return 6;
+ }
+}
+=-=-=