From: Theodor Thornhill Date: Sat, 28 Jan 2023 18:51:08 +0000 (+0100) Subject: Fix java class member without access modifier (bug#61115) X-Git-Tag: emacs-29.0.90~572 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2bd0b9475384adfb4dd2cc794bbe1d8621546717;p=emacs.git Fix java class member without access modifier (bug#61115) This ``` public class T { @Autowired String a; } ``` Should be indented as: ``` public class T { @Autowired String a; } ```` * lisp/progmodes/java-ts-mode.el (java-ts-mode--indent-rules): Add new rule to match edge case of field_declaration indentation. --- diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 8737472e514..fc264f448af 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -89,6 +89,7 @@ ((query "(method_declaration (block (_) @indent))") parent-bol java-ts-mode-indent-offset) ((parent-is "local_variable_declaration") parent-bol java-ts-mode-indent-offset) ((parent-is "expression_statement") parent-bol java-ts-mode-indent-offset) + ((match "type_identifier" "field_declaration") parent-bol 0) ((parent-is "field_declaration") parent-bol java-ts-mode-indent-offset) ((parent-is "return_statement") parent-bol java-ts-mode-indent-offset) ((parent-is "variable_declarator") parent-bol java-ts-mode-indent-offset)