highlight: add infoboxes with messages
authorJean Privat <jean@pryen.org>
Wed, 8 Apr 2015 05:22:11 +0000 (12:22 +0700)
committerJean Privat <jean@pryen.org>
Wed, 8 Apr 2015 16:10:49 +0000 (23:10 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/highlight.nit

index 2017ae7..d48f0f4 100644 (file)
@@ -71,6 +71,17 @@ class HighlightVisitor
                                end
                        end
                end
+               var messages = anode.location.messages
+               if messages != null then
+                       tag.css("border-bottom", "solid 2px red")
+                       if infobox == null then
+                               infobox = new HInfoBox(hv, "Messages")
+                       end
+                       var c = infobox.new_dropdown("{messages.length} message(s)", "")
+                       for m in messages do
+                               c.open("li").append(m.text)
+                       end
+               end
                if infobox != null then
                        tag.attach_infobox(infobox)
                end
@@ -645,6 +656,7 @@ redef class AStdClassdef
        end
        redef fun decorate_tag(v, res, token)
        do
+               if not token isa TClassid then return null
                res.add_class("nc_def")
 
                var md = mclassdef