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

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

[nongnu] elpa/typescript-mode b1d1948c15 123/222: Merge pull request #88


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode b1d1948c15 123/222: Merge pull request #88 from Ptival/fix-indentation-method-calls-keywords
Date: Sun, 6 Feb 2022 16:59:25 -0500 (EST)

branch: elpa/typescript-mode
commit b1d1948c150f78a7c133d9b4c10a648e58ad3b33
Merge: 30f8b8feb4 5b6d60a2b2
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: GitHub <noreply@github.com>

    Merge pull request #88 from Ptival/fix-indentation-method-calls-keywords
    
    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 9d2ef766bc..341e15d4ed 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2250,7 +2250,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]