* bug#60074: 30.0.50; [PATCH] Add more indent rules to js/ts-modes
@ 2022-12-14 20:31 Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 22:40 ` Yuan Fu
0 siblings, 1 reply; 2+ messages in thread
From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-14 20:31 UTC (permalink / raw)
To: 60074; +Cc: casouri
[-- Attachment #1: Type: text/plain, Size: 56 bytes --]
Hi Yuan!
Can you install this for me?
Thanks,
Theo
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-indent-rules-to-js-typescript-tsx-ts-mode.patch --]
[-- Type: text/x-diff, Size: 2579 bytes --]
From fa139fbfd150f051a2ff17ce263d83a4432c8b28 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <theo@thornhill.no>
Date: Wed, 14 Dec 2022 21:23:33 +0100
Subject: [PATCH] Add indent rules to js/typescript/tsx-ts-mode
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): Add in binary_expression and
jsx_fragment.
* lisp/progmodes/js.el (js--treesit-indent-rules): Add the same rules.
---
lisp/progmodes/js.el | 3 +++
lisp/progmodes/typescript-ts-mode.el | 3 +++
2 files changed, 6 insertions(+)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 02990813ef..8ec14cf7ad 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3445,12 +3445,15 @@ js--treesit-indent-rules
((parent-is "pair") parent-bol js-indent-level)
((parent-is "arrow_function") parent-bol js-indent-level)
((parent-is "parenthesized_expression") parent-bol js-indent-level)
+ ((parent-is "binary_expression") parent-bol js-indent-level)
((parent-is "class_body") parent-bol js-indent-level)
((parent-is ,switch-case) parent-bol js-indent-level)
((parent-is "statement_block") parent-bol js-indent-level)
;; JSX
((parent-is "jsx_opening_element") parent js-indent-level)
+ ((match "<" "jsx_fragment") parent 0)
+ ((parent-is "jsx_fragment") parent js-indent-level)
((node-is "jsx_closing_element") parent 0)
((node-is "jsx_text") parent js-indent-level)
((parent-is "jsx_element") parent js-indent-level)
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index b8a921e9c2..e7bd65c5e2 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -92,9 +92,12 @@ typescript-ts-mode--indent-rules
((parent-is "class_body") parent-bol typescript-ts-mode-indent-offset)
((parent-is "arrow_function") parent-bol typescript-ts-mode-indent-offset)
((parent-is "parenthesized_expression") parent-bol typescript-ts-mode-indent-offset)
+ ((parent-is "binary_expression") parent-bol typescript-ts-mode-indent-offset)
,@(when (eq language 'tsx)
`(((parent-is "jsx_opening_element") parent typescript-ts-mode-indent-offset)
+ ((match "<" "jsx_fragment") parent 0)
+ ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
((node-is "jsx_closing_element") parent 0)
((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)
((node-is "/") parent 0)
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#60074: 30.0.50; [PATCH] Add more indent rules to js/ts-modes
2022-12-14 20:31 bug#60074: 30.0.50; [PATCH] Add more indent rules to js/ts-modes Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-14 22:40 ` Yuan Fu
0 siblings, 0 replies; 2+ messages in thread
From: Yuan Fu @ 2022-12-14 22:40 UTC (permalink / raw)
To: Theodor Thornhill; +Cc: 60074-done
Theodor Thornhill <theo@thornhill.no> writes:
> Hi Yuan!
>
> Can you install this for me?
>
> Thanks,
>
> Theo
Absolutely, I applied the patch, thanks!
Yuan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-14 22:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-14 20:31 bug#60074: 30.0.50; [PATCH] Add more indent rules to js/ts-modes Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 22:40 ` Yuan Fu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.