diff options
| author | Theodor Thornhill | 2023-02-05 08:49:08 +0100 |
|---|---|---|
| committer | Theodor Thornhill | 2023-02-06 07:43:37 +0100 |
| commit | 5a6dfab1e4d5d89e5d5ff3bef73279926f067dbc (patch) | |
| tree | 7e603133217c4cc9766564a07c9c3ee334af26c9 /test | |
| parent | c3262216abbb9ea04e1d3af25df1f9743efd1513 (diff) | |
| download | emacs-5a6dfab1e4d5d89e5d5ff3bef73279926f067dbc.tar.gz 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')
| -rw-r--r-- | test/lisp/progmodes/c-ts-mode-resources/indent.erts | 45 |
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() { | |||
| 244 | } | 244 | } |
| 245 | } | 245 | } |
| 246 | =-=-= | 246 | =-=-= |
| 247 | |||
| 248 | Name: Complicated mixed bracket matching indentation (bug#61142) | ||
| 249 | |||
| 250 | =-= | ||
| 251 | void foo( | ||
| 252 | int foo) { | ||
| 253 | for (;;) | ||
| 254 | return 5; | ||
| 255 | |||
| 256 | if (a == 0 | ||
| 257 | && b == 1 | ||
| 258 | && foo) | ||
| 259 | { | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | else if (a == 1) | ||
| 263 | { | ||
| 264 | return 1; | ||
| 265 | } | ||
| 266 | else if (true) | ||
| 267 | return 5; | ||
| 268 | else | ||
| 269 | { | ||
| 270 | if (a == 0 | ||
| 271 | && b == 1 | ||
| 272 | && foo) | ||
| 273 | for ( | ||
| 274 | int i = 0; | ||
| 275 | i < 5; | ||
| 276 | i++) | ||
| 277 | if (true) | ||
| 278 | do | ||
| 279 | i = 5; | ||
| 280 | while (true); | ||
| 281 | else if (false) | ||
| 282 | { | ||
| 283 | return 6; | ||
| 284 | } | ||
| 285 | else | ||
| 286 | if (true | ||
| 287 | && false) | ||
| 288 | return 6; | ||
| 289 | } | ||
| 290 | } | ||
| 291 | =-=-= | ||