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

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

[nongnu] elpa/typescript-mode 536e4da380 087/222: Fix bug with hanling a


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 536e4da380 087/222: Fix bug with hanling array shorthand in return value types.
Date: Sun, 6 Feb 2022 16:59:20 -0500 (EST)

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

    Fix bug with hanling array shorthand in return value types.
---
 test-files/indentation-reference-document.ts | 18 ++++++++++++++++++
 typescript-mode.el                           |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/test-files/indentation-reference-document.ts 
b/test-files/indentation-reference-document.ts
index 12c7d843d0..ff05f05e21 100644
--- a/test-files/indentation-reference-document.ts
+++ b/test-files/indentation-reference-document.ts
@@ -299,6 +299,24 @@ function bif2(a: number,
     return 1;
 }
 
+// Array shorthand.
+function bif3(a: number,
+              b: number): number[] {
+    return [1];
+}
+
+// Array shorthand in union.
+function bif4(a: number,
+              b: number): number[] | number {
+    return [1];
+}
+
+// Array shorthand in union, with spaces.
+function bif5(a: number,
+              b: number): number[   ] | number {
+    return [1];
+}
+
 // Comment where the return type would appear.
 function gogo(a: number,
               b: number) /* foo */ {
diff --git a/typescript-mode.el b/typescript-mode.el
index 947d410929..b7d480d33e 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2107,6 +2107,8 @@ moved on success."
                               (eq before ?.)
                               ;; Typeguard (eg. foo is SomeClass)
                               (looking-back "is" (- (point) 2))
+                              ;; Array shorthand
+                              (eq before ?\])
                               ;; This is also dealing with dotted names. This 
may come
                               ;; into play if a jump back moves over an entire 
dotted
                               ;; name at once.



reply via email to

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