Add missing indent rule for c-ts-mode

* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): New rule for case.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New test.
This commit is contained in:
Yuan Fu 2023-03-21 16:24:29 -07:00
parent 8b6a0de964
commit df669c5a11
No known key found for this signature in database
GPG key ID: 56E19BC57664A442
2 changed files with 32 additions and 0 deletions

View file

@ -434,6 +434,8 @@ MODE is either `c' or `cpp'."
((parent-is "while_statement") standalone-parent c-ts-mode-indent-offset)
((parent-is "do_statement") standalone-parent c-ts-mode-indent-offset)
((parent-is "case_statement") standalone-parent c-ts-mode-indent-offset)
,@(when (eq mode 'cpp)
`(((node-is "field_initializer_list") parent-bol ,(* c-ts-mode-indent-offset 2)))))))
`((gnu

View file

@ -188,6 +188,36 @@ int main()
}
=-=-=
Name: Switch-Case statement
=-=
int main() {
switch (a) {
case 1:
b = c;
return 10;
case 2:
{
a = b;
return 12
}
}
}
=-=
int main() {
switch (a) {
case 1:
b = c;
return 10;
case 2:
{
a = b;
return 12
}
}
}
=-=-=
Name: Multiline Block Comments 1 (bug#60270)
=-=