@@ -19,23 +19,27 @@ enum MessageFilter:
19
19
case Deprecated => message.isInstanceOf [Diagnostic .DeprecationWarning ]
20
20
case Feature => message.isInstanceOf [Diagnostic .FeatureWarning ]
21
21
case Unchecked => message.isInstanceOf [Diagnostic .UncheckedWarning ]
22
+ case MessageID (errorId) => message.msg.errorId == errorId
22
23
case MessagePattern (pattern) =>
23
24
val noHighlight = message.msg.message.replaceAll(" \\ e\\ [[\\ d;]*[^\\ d;]" ," " )
24
25
pattern.findFirstIn(noHighlight).nonEmpty
25
- case MessageID (errorId) => message.msg.errorId == errorId
26
26
case SourcePattern (pattern) =>
27
27
val source = message.position.orElse(NoSourcePosition ).source()
28
28
val path = source.jfile()
29
29
.map(_.toPath.toAbsolutePath.toUri.normalize().getRawPath)
30
30
.orElse(source.path())
31
31
pattern.findFirstIn(path).nonEmpty
32
-
32
+ case Origin (pattern) =>
33
+ message match
34
+ case message : Diagnostic .DeprecationWarning => pattern.findFirstIn(message.origin).nonEmpty
35
+ case _ => false
33
36
case None => false
34
37
35
38
case Any , Deprecated , Feature , Unchecked , None
36
39
case MessagePattern (pattern : Regex )
37
40
case MessageID (errorId : ErrorMessageID )
38
41
case SourcePattern (pattern : Regex )
42
+ case Origin (pattern : Regex )
39
43
40
44
enum Action :
41
45
case Error , Warning , Verbose , Info , Silent
@@ -96,6 +100,7 @@ object WConf:
96
100
case _ => Left (s " unknown category: $conf" )
97
101
98
102
case " src" => regex(conf).map(SourcePattern .apply)
103
+ case " origin" => regex(conf).map(Origin .apply)
99
104
100
105
case _ => Left (s " unknown filter: $filter" )
101
106
case _ => Left (s " unknown filter: $s" )
0 commit comments