add comments to rendering, e.g. to collect them from build database;
authorFabian Huch <huch@in.tum.de>
Fri, 23 Aug 2024 15:30:09 +0200
changeset 80949 97924a26a5c3
parent 80948 572970d15ab0
child 80967 980cc422526e
add comments to rendering, e.g. to collect them from build database;
src/Pure/PIDE/rendering.scala
--- a/src/Pure/PIDE/rendering.scala	Thu Sep 26 14:44:37 2024 +0100
+++ b/src/Pure/PIDE/rendering.scala	Fri Aug 23 15:30:09 2024 +0200
@@ -237,6 +237,10 @@
   val warning_elements = Markup.Elements(Markup.WARNING, Markup.LEGACY)
   val error_elements = Markup.Elements(Markup.ERROR)
 
+  val comment_elements =
+    Markup.Elements(Markup.ML_COMMENT, Markup.COMMENT, Markup.COMMENT1, Markup.COMMENT2,
+      Markup.COMMENT3)
+
   val entity_elements = Markup.Elements(Markup.ENTITY)
 
   val antiquoted_elements = Markup.Elements(Markup.ANTIQUOTED)
@@ -710,6 +714,12 @@
     snapshot.select(range, Rendering.error_elements, _ => Some(_)).map(_.info)
 
 
+  /* comments */
+
+  def comments(range: Text.Range): List[Text.Markup] =
+    snapshot.select(range, Rendering.comment_elements, _ => Some(_)).map(_.info)
+
+
   /* command status overview */
 
   def overview_color(range: Text.Range): Option[Rendering.Color.Value] = {