]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix java class member without access modifier (bug#61115)
authorTheodor Thornhill <theo@thornhill.no>
Sat, 28 Jan 2023 18:51:08 +0000 (19:51 +0100)
committerTheodor Thornhill <theo@thornhill.no>
Sat, 28 Jan 2023 18:51:08 +0000 (19:51 +0100)
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.

lisp/progmodes/java-ts-mode.el

index 8737472e5142f63f7c5692ff40d74f52e308b09e..fc264f448afba90b395a10db001eb9a654a5a79d 100644 (file)
@@ -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)