emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/typescript-mode 5b6d60a2b2 118/222: Fix indentation after


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 5b6d60a2b2 118/222: Fix indentation after keyword-lookalike methods.
Date: Sun, 6 Feb 2022 16:59:24 -0500 (EST)

branch: elpa/typescript-mode
commit 5b6d60a2b2c9d8a9eba11ce9e453c7791bdf0770
Author: Valentin Robert <valentin.robert.42@gmail.com>
Commit: Valentin Robert <valentin.robert.42@gmail.com>

    Fix indentation after keyword-lookalike methods.
---
 test-files/indentation-reference-document.ts | 25 +++++++++++++++++++++++++
 typescript-mode.el                           |  5 ++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/test-files/indentation-reference-document.ts 
b/test-files/indentation-reference-document.ts
index 9d490ac6ae..4418152bc4 100644
--- a/test-files/indentation-reference-document.ts
+++ b/test-files/indentation-reference-document.ts
@@ -627,3 +627,28 @@ function blipblop(): void {
 
 container.each(x => x)
 something() // No reason for this to be indented! (cf. issue #83)
+
+// Method calls that look like braceless keywords should not indent!
+function test() {
+    return (
+        f.catch()
+    )
+    return (
+        f.do()
+    )
+    return (
+        f.each()
+    )
+    return (
+        f.else()
+    )
+    return (
+        f.if()
+    )
+    return (
+        f.finally()
+    )
+    return (
+        f.then()
+    )
+}
diff --git a/typescript-mode.el b/typescript-mode.el
index 1718419df5..5e01ae820b 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2210,7 +2210,10 @@ nil."
                    (when (= (char-before) ?\)) (backward-list))
                    (skip-syntax-backward " ")
                    (skip-syntax-backward "w_")
-                   (looking-at typescript--possibly-braceless-keyword-re))
+                   (and
+                    (looking-at typescript--possibly-braceless-keyword-re)
+                    ;; If preceded by period, it's a method call.
+                    (not (= (char-before) ?.))))
                  (not (typescript--end-of-do-while-loop-p))))
       (save-excursion
         (goto-char (match-beginning 0))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]