Add declaration_list to c-ts-common-indent-type-regexp-alist

* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Consider a
"declaration_list" a block. (Bug#61635)
* test/lisp/progmodes/c-ts-mode-resources/indent.erts (Code): Add a
test case.
This commit is contained in:
Daniel Martín 2023-02-19 22:57:54 +01:00 committed by Theodor Thornhill
parent 19480aa30e
commit d7010d64b2
2 changed files with 18 additions and 1 deletions

View file

@ -814,7 +814,8 @@ the semicolon. This function skips the semicolon."
`((block . ,(rx (or "compound_statement"
"field_declaration_list"
"enumerator_list"
"initializer_list")))
"initializer_list"
"declaration_list")))
(if . "if_statement")
(else . ("if_statement" . "alternative"))
(do . "do_statement")

View file

@ -369,3 +369,19 @@ int main()
};
}
=-=-=
Code:
(lambda ()
(c++-ts-mode)
(setq-local indent-tabs-mode nil)
(setq-local c-ts-mode-indent-offset 2)
(indent-region (point-min) (point-max)))
Name: Declaration List (Namespace) (Bug#61635)
=-=
namespace test {
class Name {
};
}
=-=-=