diff options
| author | Eli Zaretskii | 2025-05-31 08:29:50 -0400 |
|---|---|---|
| committer | Eli Zaretskii | 2025-05-31 08:29:50 -0400 |
| commit | b3a8633dbad04fbd381ab2c8ea8b4c2b953c809f (patch) | |
| tree | 0bc3134354511782876d093cd04bf824eae32904 | |
| parent | 6f8cee03316e166e4204ba49fbb9964a075968ca (diff) | |
| parent | 1d2ae31b8bcca5f00c3c707cc7af3a347749c332 (diff) | |
| download | emacs-b3a8633dbad04fbd381ab2c8ea8b4c2b953c809f.tar.gz emacs-b3a8633dbad04fbd381ab2c8ea8b4c2b953c809f.zip | |
Merge from origin/emacs-30
1d2ae31b8bc typescript-ts-mode: Improve function body indentation (bu...
421ecbcf6b4 ; * CONTRIBUTE: Explain the line-width preferences.
| -rw-r--r-- | CONTRIBUTE | 4 | ||||
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 4 | ||||
| -rw-r--r-- | test/lisp/progmodes/typescript-ts-mode-resources/indent.erts | 25 |
3 files changed, 30 insertions, 3 deletions
diff --git a/CONTRIBUTE b/CONTRIBUTE index eda300f01bc..be10dbda8b3 100644 --- a/CONTRIBUTE +++ b/CONTRIBUTE | |||
| @@ -234,7 +234,9 @@ formatting them: | |||
| 234 | - Lines in ChangeLog entries should preferably be not longer than 63 | 234 | - Lines in ChangeLog entries should preferably be not longer than 63 |
| 235 | characters, and must not exceed 78 characters, unless they consist | 235 | characters, and must not exceed 78 characters, unless they consist |
| 236 | of a single word of at most 140 characters; this 78/140 limit is | 236 | of a single word of at most 140 characters; this 78/140 limit is |
| 237 | enforced by a commit hook. | 237 | enforced by a commit hook. (The 63-character preference is to |
| 238 | avoid too-long lines in the ChangeLog file generated from Git logs, | ||
| 239 | where each entry line is indented by a TAB.) | ||
| 238 | 240 | ||
| 239 | - If only a single file is changed, the summary line can be the normal | 241 | - If only a single file is changed, the summary line can be the normal |
| 240 | first line of a ChangeLog entry (starting with the asterisk). Then | 242 | first line of a ChangeLog entry (starting with the asterisk). Then |
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 24953f629de..6f807c254bd 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -155,7 +155,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 155 | (typescript-ts-mode--check-dialect language) | 155 | (typescript-ts-mode--check-dialect language) |
| 156 | `((,language | 156 | `((,language |
| 157 | ((parent-is "program") column-0 0) | 157 | ((parent-is "program") column-0 0) |
| 158 | ((node-is "}") parent-bol 0) | 158 | ((node-is "}") standalone-parent 0) |
| 159 | ((node-is ")") parent-bol 0) | 159 | ((node-is ")") parent-bol 0) |
| 160 | ((node-is "]") parent-bol 0) | 160 | ((node-is "]") parent-bol 0) |
| 161 | ((node-is ">") parent-bol 0) | 161 | ((node-is ">") parent-bol 0) |
| @@ -165,7 +165,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 165 | ((parent-is "ternary_expression") standalone-parent typescript-ts-mode-indent-offset) | 165 | ((parent-is "ternary_expression") standalone-parent typescript-ts-mode-indent-offset) |
| 166 | ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset) | 166 | ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset) |
| 167 | ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset) | 167 | ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset) |
| 168 | ((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset) | 168 | ((parent-is "statement_block") standalone-parent typescript-ts-mode-indent-offset) |
| 169 | ((or (node-is "case") | 169 | ((or (node-is "case") |
| 170 | (node-is "default")) | 170 | (node-is "default")) |
| 171 | parent-bol typescript-ts-mode-indent-offset) | 171 | parent-bol typescript-ts-mode-indent-offset) |
diff --git a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts index e8b1d57f132..210bfcabd41 100644 --- a/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/typescript-ts-mode-resources/indent.erts | |||
| @@ -182,3 +182,28 @@ interface Foo { | |||
| 182 | bar?: boolean; | 182 | bar?: boolean; |
| 183 | } | 183 | } |
| 184 | =-=-= | 184 | =-=-= |
| 185 | |||
| 186 | Code: | ||
| 187 | (lambda () | ||
| 188 | (setq tsx-ts-mode-indent-offset 2) | ||
| 189 | (tsx-ts-mode) | ||
| 190 | (setq indent-tabs-mode nil) | ||
| 191 | (indent-region (line-beginning-position 7) (point-max))) | ||
| 192 | |||
| 193 | Name: Function body with params misindented (bug#78121) | ||
| 194 | |||
| 195 | =-= | ||
| 196 | const f1 = (a1: string, | ||
| 197 | a2: number) => { | ||
| 198 | const f2 = (a1: string, | ||
| 199 | a2: number) => { | ||
| 200 | const f3 = (a1: string, | ||
| 201 | a2: number) => | ||
| 202 | { | ||
| 203 | return; | ||
| 204 | } | ||
| 205 | return; | ||
| 206 | } | ||
| 207 | return; | ||
| 208 | } | ||
| 209 | =-=-= | ||