File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 36
36
(require 'subr-x )
37
37
(require 'wid-edit )
38
38
(require 'compile )
39
+ (require 'rx )
39
40
40
41
;;;### autoload
41
42
(defgroup swift-mode:repl nil
@@ -1057,6 +1058,25 @@ If FILE doesn't exist in the project, return nil."
1057
1058
swift-mode:compilation-swift-files)))
1058
1059
(and path (list path)))))
1059
1060
1061
+ (defun swift-mode:resolve-and-highlight-swift-test-file ()
1062
+ " Call `swift-mode:resolve-swift-test-file' on match and highlight if needed.
1063
+
1064
+ When a function is specified as the `file' component of
1065
+ `compilation-error-regexp-alist-alist' , `compile' does not highlight the
1066
+ matching filename. So we have to highlight it here."
1067
+ (save-match-data
1068
+ (let ((start (match-beginning 2 ))
1069
+ (end (match-end 2 ))
1070
+ (result (funcall swift-mode:resolve-swift-test-file-function
1071
+ (match-string 2 ))))
1072
+ (when result
1073
+ (put-text-property
1074
+ start
1075
+ end
1076
+ 'font-lock-face
1077
+ compilation-error-face))
1078
+ result)))
1079
+
1060
1080
(defun swift-mode:setup-swift-testing ()
1061
1081
" Setup `compilation-process-setup-function' for Swift Testing.
1062
1082
@@ -1083,10 +1103,7 @@ Also add an entry to `compilation-error-regexp-alist-alist'."
1083
1103
(group (+ digit))))
1084
1104
" : " )
1085
1105
; ; filename
1086
- ,(lambda ()
1087
- (save-match-data
1088
- (funcall swift-mode:resolve-swift-test-file-function
1089
- (match-string 2 ))))
1106
+ ,#'swift-mode:resolve-and-highlight-swift-test-file
1090
1107
; ; line
1091
1108
3
1092
1109
; ; column
You can’t perform that action at this time.
0 commit comments