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

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

[nongnu] elpa/typescript-mode 447cfbc078 030/222: Improve compilation-mo


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 447cfbc078 030/222: Improve compilation-mode support.
Date: Sun, 6 Feb 2022 16:59:03 -0500 (EST)

branch: elpa/typescript-mode
commit 447cfbc078c5752ef6874c4779121bca81c44890
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>

    Improve compilation-mode support.
    
    Now also support output from tslint.
---
 typescript-mode.el | 41 +++++++++++++++++++++++++++++++++--------
 1 file changed, 33 insertions(+), 8 deletions(-)

diff --git a/typescript-mode.el b/typescript-mode.el
index 52ec3dc2ca..ce3ba209ca 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -1987,14 +1987,39 @@ the broken-down class name of the item to insert."
 ;; handle compiler-errors like the following when doing M-x 
compile<ret>tsc<ret>
 ;; greeter.ts(24,9): error TS2362: The left-hand side of an arithmetic 
operation must be of type 'any', 'number' or an enum type.
 ;; greeter.ts(30,12): error TS2339: Property 'indexOf' does not exist on type 
'number'.
-(add-to-list 'compilation-error-regexp-alist 'typescript-mode)
-(add-to-list 'compilation-error-regexp-alist-alist
-             (list 'typescript-mode
-                   (concat
-                    "^[[:blank:]]*"
-                    "\\([^(\r\n)]+\\)(\\([0-9]+\\),\\([0-9]+\\)):[[:blank:]]+"
-                    "error [[:alnum:]]+: [^\r\n]+$")
-                   1 2 3 1))
+(defconst typescript-tsc-error-regexp
+  (concat
+   "^[[:blank:]]*"
+   "\\([^(\r\n)]+\\)(\\([0-9]+\\),\\([0-9]+\\)):[[:blank:]]+"
+   "error [[:alnum:]]+: [^\r\n]+$")
+  "Regexp to match errors generated by tsc.")
+
+;; Should handle output like:
+;; src/modules/authenticator.ts[1, 83]: ' should be "
+;; src/modules/authenticator.ts[2, 26]: ' should be "
+(defconst typescript-tslint-warning-regexp
+  (concat
+   "^[[:blank:]]*"
+   "\\([^(\r\n)]+\\)" ;; filename
+   "\\["
+   "\\([[:digit:]]+\\)" ; line
+   ", "
+   "\\([[:digit:]]+\\)" ; column
+   "\\]: "
+   "\\(.*\\)$"    ;; type of warnings
+   )
+  "Regexp to match warnings generated by tslint.")
+
+(dolist
+    (regexp
+     `((typescript-tsc
+        ,typescript-tsc-error-regexp
+        1 2 3 2))
+     `((typescript-tslint
+        ,typescript-tslint-warning-regexp
+        1 2 3 1)))
+  (add-to-list 'compilation-error-regexp-alist-alist regexp)
+  (add-to-list 'compilation-error-regexp-alist (car regexp)))
 
 ;;; Main Function
 



reply via email to

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