proper reset of published decorations: initial value is Nil, afterwards it is a list of canonical length and order;
authorwenzelm
Sun, 05 Mar 2017 19:27:39 +0100
changeset 65120 db6cc23fcf33
parent 65119 a7bedf94e71c
child 65121 12c6774a8f65
proper reset of published decorations: initial value is Nil, afterwards it is a list of canonical length and order;
src/Tools/VSCode/src/document_model.scala
src/Tools/VSCode/src/vscode_rendering.scala
--- a/src/Tools/VSCode/src/document_model.scala	Sun Mar 05 18:59:39 2017 +0100
+++ b/src/Tools/VSCode/src/document_model.scala	Sun Mar 05 19:27:39 2017 +0100
@@ -125,13 +125,15 @@
     (Option[List[Text.Info[Command.Results]]], Option[List[Document_Model.Decoration]], Document_Model) =
   {
     val diagnostics = rendering.diagnostics
-    val decorations = if (node_visible) rendering.decorations else Nil
+    val decorations =
+      if (node_visible) rendering.decorations
+      else { for (deco <- published_decorations) yield Document_Model.Decoration(deco.typ, Nil) }
 
     val changed_diagnostics =
       if (diagnostics == published_diagnostics) None else Some(diagnostics)
     val changed_decorations =
       if (decorations == published_decorations) None
-      else if (decorations.length != published_decorations.length) Some(decorations)
+      else if (published_decorations.isEmpty) Some(decorations)
       else Some(for { (a, b) <- decorations zip published_decorations if a != b } yield a)
 
     (changed_diagnostics, changed_decorations,
--- a/src/Tools/VSCode/src/vscode_rendering.scala	Sun Mar 05 18:59:39 2017 +0100
+++ b/src/Tools/VSCode/src/vscode_rendering.scala	Sun Mar 05 19:27:39 2017 +0100
@@ -128,7 +128,7 @@
     Document_Model.Decoration("hover_message", content)
   }
 
-  def decorations: List[Document_Model.Decoration] =
+  def decorations: List[Document_Model.Decoration] = // list of canonical length and order
     hover_message ::
     VSCode_Rendering.color_decorations("background_", Rendering.Color.background,
       background(model.content.text_range, Set.empty)) :::