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

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

[nongnu] elpa/typescript-mode 30391a518a 079/222: Fix indentation issue


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 30391a518a 079/222: Fix indentation issue with conditional operators.
Date: Sun, 6 Feb 2022 16:59:19 -0500 (EST)

branch: elpa/typescript-mode
commit 30391a518a1d41d5c534a30850a50b0974132aec
Author: Louis-Dominique Dubeau <ldd@lddubeau.com>
Commit: Louis-Dominique Dubeau <ldd@lddubeau.com>

    Fix indentation issue with conditional operators.
    
    Prior to this change if the conditional operator had an object
    in the true branch, indentation would fail.
---
 test-files/indentation-reference-document.ts | 4 ++++
 typescript-mode.el                           | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/test-files/indentation-reference-document.ts 
b/test-files/indentation-reference-document.ts
index 2fdf6ef337..16522752b0 100644
--- a/test-files/indentation-reference-document.ts
+++ b/test-files/indentation-reference-document.ts
@@ -161,6 +161,10 @@ namespace ts.server {
             2 :
             3;
 
+        const e2 = b ?
+            { a: 1 } :
+            3;
+
         const f = window
             .document;
 
diff --git a/typescript-mode.el b/typescript-mode.el
index a7f5970d2f..9d16f697d7 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -1906,8 +1906,10 @@ See `font-lock-keywords'.")
     (and (looking-at typescript--indent-operator-re)
          (or (not (looking-at ":"))
              (save-excursion
-               (and (typescript--re-search-backward "[?:{]\\|\\_<case\\_>" nil 
t)
-                    (looking-at "?"))))
+               (backward-sexp)
+               (and
+                (typescript--re-search-backward "[?:{]\\|\\_<case\\_>" nil t)
+                (looking-at "?"))))
          ;; Do not identify forward slashes appearing in a "list" as
          ;; an operator. The lists are: arrays, or lists of
          ;; arguments. In this context, they must be part of regular



reply via email to

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