src/Tools/VSCode/src/preview.scala
changeset 66103 8ff7fd4ee919
parent 66089 def95e0bc529
parent 66102 3e2145cf3077
child 66104 5aab14a64a03
child 66109 e034a563ed7d
--- a/src/Tools/VSCode/src/preview.scala	Thu Jun 15 17:22:23 2017 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*  Title:      Tools/VSCode/src/preview.scala
-    Author:     Makarius
-
-HTML document preview.
-*/
-
-package isabelle.vscode
-
-
-import isabelle._
-
-import java.io.{File => JFile}
-
-
-class Preview(resources: VSCode_Resources)
-{
-  private val pending = Synchronized(Map.empty[JFile, Int])
-
-  def request(file: JFile, column: Int): Unit =
-    pending.change(map => map + (file -> column))
-
-  def flush(channel: Channel): Boolean =
-  {
-    pending.change_result(map =>
-    {
-      val map1 =
-        (map /: map.iterator)({ case (m, (file, column)) =>
-          resources.get_model(file) match {
-            case Some(model) =>
-              val snapshot = model.snapshot()
-              if (snapshot.is_outdated) m
-              else {
-                val (label, content) = make_preview(model, snapshot)
-                channel.write(Protocol.Preview_Response(file, column, label, content))
-                m - file
-              }
-            case None => m - file
-          }
-        })
-      (map1.nonEmpty, map1)
-    })
-  }
-
-  def make_preview(model: Document_Model, snapshot: Document.Snapshot): (String, String) =
-  {
-    val label = "Preview " + quote(model.node_name.toString)
-    val content =
-      HTML.output_document(
-        List(HTML.style(HTML.fonts_css()), HTML.style_file(Url.print_file(HTML.isabelle_css.file))),
-        List(
-          HTML.chapter("Theory " + quote(model.node_name.theory_base_name)),
-          HTML.source(Present.theory_document(snapshot))),
-        css = "")
-    (label, content)
-  }
-}