1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-07 08:00:48 -08:00
emacs/test/lisp/progmodes
Jørgen Kvalsvik c65c5d0222
Improve c-ts-mode compound indents (bug#74507)
Properly indent the body of compound expressions, even when then
compound expression is not at the beginning of line and the
parent is not an if/for/while/etc., and matches the behavior of
c-mode.

This fixes a problem that is common with macros and in testing
frameworks. For example, you expect this to indent:

TEST_CASE(1) {
    assert (...);
}

If the compound statement is the function body itself, don't
apply this new rule and instead guide by the parent and first
sibling.

I'm sure there are subtle interactions that aren't handled
properly by checking for "function_definition" rather than
something more general, but it does fix the test case and the
check can be improved as more cases are found.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--parent-is-not-top-compound): New function.
(c-ts-mode--indent-styles): Use it.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New
compound statement test.
2024-12-01 17:53:21 -08:00
..
c-ts-mode-resources Improve c-ts-mode compound indents (bug#74507) 2024-12-01 17:53:21 -08:00
cperl-mode-resources ; Fix typos 2024-06-23 16:40:06 +02:00
csharp-mode-resources Fix last change 2024-04-25 18:59:25 +03:00
elisp-mode-resources
elixir-ts-mode-resources ; Fix typos 2024-01-28 17:11:51 +01:00
flymake-resources Send useless output in flymake-tests to /dev/null (bug#70716) 2024-08-28 19:47:40 +02:00
go-ts-mode-resources Add font-locking for variables in go-ts-mode range clauses (bug#71209) 2024-06-01 17:47:57 +03:00
heex-ts-mode-resources
java-ts-mode-resources java-ts-mode: Indentation for opening brace on a separate line 2024-02-17 22:35:16 +02:00
js-resources Add indentation rules for bracketless statements in js-ts-mode 2023-12-12 03:13:12 +02:00
lua-ts-mode-resources Improve comment indenting in 'lua-ts-mode' 2024-11-14 10:14:46 +02:00
project-resources
ruby-mode-resources Support the new option in ruby-ts-mode too 2024-09-02 21:57:35 +03:00
rust-ts-mode-resources Rust ts: fontify as type the possible suffix of number literals 2024-11-23 14:56:38 +02:00
sh-script-resources Make sh-script-tests.el more robust 2024-04-05 19:43:56 +02:00
typescript-ts-mode-resources Improve one test (bug#71998) 2024-07-21 14:55:06 +02:00
xref-resources
asm-mode-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
autoconf-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
bat-mode-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
bug-reference-tests.el Support text overlays for thingatpt provider helpers 2024-05-20 13:24:11 -07:00
c-ts-mode-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
cc-mode-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
compile-tests.el Make Compilation mode recognize non-legacy Kotlin/Gradle errors 2024-06-22 11:30:51 +03:00
cperl-mode-tests.el ; cperl-mode.el: Fix fontification of flip-flop (Bug#72296) 2024-07-25 22:00:10 +02:00
csharp-mode-tests.el Fix last change 2024-04-27 22:12:14 +03:00
eglot-tests.el Merge from savannah/emacs-30 2024-09-11 13:21:58 +08:00
elisp-mode-tests.el elisp-mode-tests.el: Add test for the added fix 2024-10-29 01:51:05 +02:00
elixir-ts-mode-tests.el ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
etags-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
executable-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
f90-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
flymake-tests.el ; Fix flymake tests with GCC 14. 2024-06-24 15:45:42 +02:00
gdb-mi-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
glasses-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
go-ts-mode-tests.el Add font-locking for variables in go-ts-mode range clauses (bug#71209) 2024-06-01 17:47:57 +03:00
grep-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
heex-ts-mode-tests.el ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
hideshow-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
java-ts-mode-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
js-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
lua-ts-mode-tests.el ; Quietly skip 'lua-ts-mode' tests (bug#70786) 2024-05-08 20:36:37 -07:00
octave-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
opascal-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
pascal-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
peg-tests.el (with-peg-rules): Fix references to rulesets (bug#74018) 2024-10-28 22:14:10 -04:00
perl-mode-tests.el Merge from savannah/emacs-29 2024-01-02 10:28:14 +08:00
project-tests.el project-tests: Add test assertion for bug#73801 2024-11-01 02:35:08 +02:00
ps-mode-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
python-tests.el Mark if-let and when-let obsolete 2024-10-24 16:50:07 +08:00
ruby-mode-tests.el Add new option ruby-bracketed-args-indent 2024-09-02 21:55:16 +03:00
ruby-ts-mode-tests.el Mark if-let and when-let obsolete 2024-10-24 16:50:07 +08:00
rust-ts-mode-tests.el Rust ts: fontify as type the possible suffix of number literals 2024-11-23 14:56:38 +02:00
scheme-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
sh-script-tests.el Make sh-script-tests.el more robust 2024-04-05 19:43:56 +02:00
sql-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
subword-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
tcl-tests.el ; Add 2024 to copyright years 2024-01-02 09:47:10 +08:00
typescript-ts-mode-tests.el Tag test in typescript-ts-mode-tests.el as unstable 2024-08-13 09:19:00 +02:00
which-func-tests.el ; Add 2024 to copyright years 2024-01-02 10:30:05 +08:00
xref-tests.el xref--group-name-for-display: Undo most of the latest change 2024-05-18 03:32:48 +03:00