Merge from origin/emacs-30

1d2ae31b8b typescript-ts-mode: Improve function body indentation (bu...
421ecbcf6b ; * CONTRIBUTE: Explain the line-width preferences.
This commit is contained in:
Eli Zaretskii 2025-05-31 08:29:50 -04:00
commit b3a8633dba
3 changed files with 30 additions and 3 deletions

View file

@ -234,7 +234,9 @@ formatting them:
- Lines in ChangeLog entries should preferably be not longer than 63 - Lines in ChangeLog entries should preferably be not longer than 63
characters, and must not exceed 78 characters, unless they consist characters, and must not exceed 78 characters, unless they consist
of a single word of at most 140 characters; this 78/140 limit is of a single word of at most 140 characters; this 78/140 limit is
enforced by a commit hook. enforced by a commit hook. (The 63-character preference is to
avoid too-long lines in the ChangeLog file generated from Git logs,
where each entry line is indented by a TAB.)
- If only a single file is changed, the summary line can be the normal - If only a single file is changed, the summary line can be the normal
first line of a ChangeLog entry (starting with the asterisk). Then first line of a ChangeLog entry (starting with the asterisk). Then

View file

@ -155,7 +155,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
(typescript-ts-mode--check-dialect language) (typescript-ts-mode--check-dialect language)
`((,language `((,language
((parent-is "program") column-0 0) ((parent-is "program") column-0 0)
((node-is "}") parent-bol 0) ((node-is "}") standalone-parent 0)
((node-is ")") parent-bol 0) ((node-is ")") parent-bol 0)
((node-is "]") parent-bol 0) ((node-is "]") parent-bol 0)
((node-is ">") parent-bol 0) ((node-is ">") parent-bol 0)
@ -165,7 +165,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
((parent-is "ternary_expression") standalone-parent typescript-ts-mode-indent-offset) ((parent-is "ternary_expression") standalone-parent typescript-ts-mode-indent-offset)
((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset) ((parent-is "member_expression") parent-bol typescript-ts-mode-indent-offset)
((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset) ((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset)
((parent-is "statement_block") parent-bol typescript-ts-mode-indent-offset) ((parent-is "statement_block") standalone-parent typescript-ts-mode-indent-offset)
((or (node-is "case") ((or (node-is "case")
(node-is "default")) (node-is "default"))
parent-bol typescript-ts-mode-indent-offset) parent-bol typescript-ts-mode-indent-offset)

View file

@ -182,3 +182,28 @@ interface Foo {
bar?: boolean; bar?: boolean;
} }
=-=-= =-=-=
Code:
(lambda ()
(setq tsx-ts-mode-indent-offset 2)
(tsx-ts-mode)
(setq indent-tabs-mode nil)
(indent-region (line-beginning-position 7) (point-max)))
Name: Function body with params misindented (bug#78121)
=-=
const f1 = (a1: string,
a2: number) => {
const f2 = (a1: string,
a2: number) => {
const f3 = (a1: string,
a2: number) =>
{
return;
}
return;
}
return;
}
=-=-=