diff options
| author | Theodor Thornhill | 2022-12-17 23:11:57 +0100 |
|---|---|---|
| committer | Yuan Fu | 2022-12-17 15:35:48 -0800 |
| commit | 9fcf764dd73449fb469a7c7eb29aec3c06cdf067 (patch) | |
| tree | e4be882d682562397e6ec5ff2bfd12d9bcb29aaf | |
| parent | 69f2c71135f8bc89cf4d816fd5f4c2b0a0e30469 (diff) | |
| download | emacs-9fcf764dd73449fb469a7c7eb29aec3c06cdf067.tar.gz emacs-9fcf764dd73449fb469a7c7eb29aec3c06cdf067.zip | |
Indentation fixes for jsx/tsx (bug#60169)
* lisp/progmodes/js.el (js--treesit-indent-rules): Simplify the rules.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Simplify the rules.
| -rw-r--r-- | lisp/progmodes/js.el | 11 | ||||
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 10 |
2 files changed, 10 insertions, 11 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index a776ff91f9b..8c1ee495c2d 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -3451,14 +3451,13 @@ This function is intended for use in `after-change-functions'." | |||
| 3451 | ((parent-is "statement_block") parent-bol js-indent-level) | 3451 | ((parent-is "statement_block") parent-bol js-indent-level) |
| 3452 | 3452 | ||
| 3453 | ;; JSX | 3453 | ;; JSX |
| 3454 | ((parent-is "jsx_opening_element") parent js-indent-level) | 3454 | ((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset) |
| 3455 | ((match "<" "jsx_fragment") parent 0) | 3455 | ((node-is "jsx_element") parent typescript-ts-mode-indent-offset) |
| 3456 | ((parent-is "jsx_fragment") parent js-indent-level) | 3456 | ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset) |
| 3457 | ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) | ||
| 3457 | ((node-is "jsx_closing_element") parent 0) | 3458 | ((node-is "jsx_closing_element") parent 0) |
| 3458 | ((node-is "jsx_text") parent js-indent-level) | ||
| 3459 | ((parent-is "jsx_element") parent js-indent-level) | ||
| 3460 | ((node-is "/") parent 0) | 3459 | ((node-is "/") parent 0) |
| 3461 | ((parent-is "jsx_self_closing_element") parent js-indent-level))))) | 3460 | ((node-is ">") parent 0))))) |
| 3462 | 3461 | ||
| 3463 | (defvar js--treesit-keywords | 3462 | (defvar js--treesit-keywords |
| 3464 | '("as" "async" "await" "break" "case" "catch" "class" "const" "continue" | 3463 | '("as" "async" "await" "break" "case" "catch" "class" "const" "continue" |
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index e7bd65c5e2f..890d0a81348 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -95,13 +95,13 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 95 | ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) | 95 | ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset) |
| 96 | 96 | ||
| 97 | ,@(when (eq language 'tsx) | 97 | ,@(when (eq language 'tsx) |
| 98 | `(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset) | 98 | `(((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset) |
| 99 | ((match "<" "jsx_fragment") parent 0) | 99 | ((node-is "jsx_element") parent typescript-ts-mode-indent-offset) |
| 100 | ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset) | 100 | ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset) |
| 101 | ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset) | ||
| 101 | ((node-is "jsx_closing_element") parent 0) | 102 | ((node-is "jsx_closing_element") parent 0) |
| 102 | ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset) | ||
| 103 | ((node-is "/") parent 0) | 103 | ((node-is "/") parent 0) |
| 104 | ((parent-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset))) | 104 | ((node-is ">") parent 0))) |
| 105 | (no-node parent-bol 0)))) | 105 | (no-node parent-bol 0)))) |
| 106 | 106 | ||
| 107 | (defvar typescript-ts-mode--keywords | 107 | (defvar typescript-ts-mode--keywords |