lsp: unified PIDE/decorations and dynamic output decorations format;
authorThomas Lindae <thomas.lindae@in.tum.de>
Wed, 15 May 2024 16:54:39 +0200
changeset 81039 9c5a4ba4ced6
parent 81038 07ed4ce5c6c9
child 81040 d3e0d68c50d8
lsp: unified PIDE/decorations and dynamic output decorations format;
src/Tools/VSCode/src/dynamic_output.scala
src/Tools/VSCode/src/lsp.scala
--- a/src/Tools/VSCode/src/dynamic_output.scala	Wed May 15 00:11:34 2024 +0200
+++ b/src/Tools/VSCode/src/dynamic_output.scala	Wed May 15 16:54:39 2024 +0200
@@ -71,6 +71,7 @@
               case None => None
               case Some(i) => Some((document.range(e._1), "text_" ++ Rendering.text_color(i).toString))
             })
+            .groupMap(_._2)(e => LSP.Decoration_Options(e._1, List())).toList
 
           channel.write(LSP.Dynamic_Output(output, Some(decorations)))
         }
--- a/src/Tools/VSCode/src/lsp.scala	Wed May 15 00:11:34 2024 +0200
+++ b/src/Tools/VSCode/src/lsp.scala	Wed May 15 16:54:39 2024 +0200
@@ -520,14 +520,14 @@
   /* dynamic output */
 
   object Dynamic_Output {
-    def apply(content: String, decorations: Option[List[(Line.Range, String)]] = None): JSON.T =
+    def apply(content: String, decorations: Option[List[(String, List[Decoration_Options])]] = None): JSON.T =
       Notification("PIDE/dynamic_output",
         JSON.Object("content" -> content) ++
         JSON.optional(
           "decorations" -> decorations.map(decorations =>
             decorations.map(decoration => JSON.Object(
-              "range" -> Range.compact(decoration._1),
-              "type" -> decoration._2)
+              "type" -> decoration._1,
+              "content" -> decoration._2.map(_.json))
             ))
         ))
   }