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

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

[nongnu] elpa/typescript-mode cebfe5952b 114/222: Rename the regexp matc


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode cebfe5952b 114/222: Rename the regexp matching pretty error messages.
Date: Sun, 6 Feb 2022 16:59:23 -0500 (EST)

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

    Rename the regexp matching pretty error messages.
    
    This commit renames the complation regexp for pretty error
    messages. (Discussed [here][1].) It also adds a comment distinguishing
    plain and pretty error messages and giving some historical background.
    
    [1]: https://github.com/ananthakumaran/typescript.el/issues/77
---
 typescript-mode-tests.el |  4 +---
 typescript-mode.el       | 25 ++++++++++++++++++++-----
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/typescript-mode-tests.el b/typescript-mode-tests.el
index 2b77423017..4cf37fd01e 100644
--- a/typescript-mode-tests.el
+++ b/typescript-mode-tests.el
@@ -625,14 +625,12 @@ const b = 'not terminated bbb")))
 (ert-deftest recognizes-tsc-errors ()
 
   (dolist (test-case
-           ;; typescript 2.6 and earlier
            `(("test.ts(2,7): error TS2322: Type '2' is not assignable to type 
'string'."
               ,typescript-tsc-error-regexp
               "test.ts")
 
-             ;; typescript 2.7 and later
              ("test.ts:2:7 - error TS2322: Type '2' is not assignable to type 
'string'."
-              ,typescript-tsc27-error-regexp
+              ,typescript-tsc-pretty-error-regexp
               "test.ts")
              ))
     (let* ((text (car test-case))
diff --git a/typescript-mode.el b/typescript-mode.el
index c5a1bc28da..757ac94712 100644
--- a/typescript-mode.el
+++ b/typescript-mode.el
@@ -2525,7 +2525,21 @@ the broken-down class name of the item to insert."
 
 ;;; compilation-mode support
 
-;; handle compiler-errors like the following when doing M-x 
compile<ret>tsc<ret>
+;; tsc supports formatting errors in two general ways: plain and
+;; pretty. ("Plain" is our term for "not pretty".) In tsc versions
+;; prior to 2.7, the plain and pretty formats both used the same
+;; format for references into files. `typescript-tsc-error-regexp`
+;; covers both plain and pretty for those versions.
+;;
+;; Version 2.7 changed the pretty format so as to format source code
+;; references differently. This required the introduction of
+;; `typescript-tsc-pretty-error-regexp`. The format of plain error
+;; messages did not change. So from that version onwards,
+;; `typescript-tsc-error-regexp` covers plain error messages and
+;; `typescript-tsc-pretty-error-regexp` covers pretty error messages.
+
+;; handle plain 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'.
 (defconst typescript-tsc-error-regexp
@@ -2535,14 +2549,15 @@ the broken-down class name of the item to insert."
    "error [[:alnum:]]+: [^\r\n]+$")
   "Regexp to match errors generated by tsc.")
 
-;; handle compiler-errors like the following when doing M-x 
compile<ret>tsc<ret>
+;; handle pretty compiler-errors like the following when doing M-x 
compile<ret>tsc<ret>
 ;; test.ts:2:7 - error TS2322: Type '2' is not assignable to type 'string'.
-(defconst typescript-tsc27-error-regexp
+(defconst typescript-tsc-pretty-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 "
@@ -2585,8 +2600,8 @@ the broken-down class name of the item to insert."
         ,typescript-tsc-error-regexp
         1 2 3 2)
 
-       (typescript-tsc27
-        ,typescript-tsc27-error-regexp
+       (typescript-tsc-pretty
+        ,typescript-tsc-pretty-error-regexp
         1 2 3 2)
 
        (typescript-tslint



reply via email to

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