branch: elpa/typescript-mode
commit 447cfbc078c5752ef6874c4779121bca81c44890
Author: Jostein Kjønigsen <[email protected]>
Commit: Jostein Kjønigsen <[email protected]>
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