src/Pure/PIDE/document.scala
changeset 68836 cf52379c0776
parent 68728 c07f6fa02c59
child 68857 b888de4fe58c
--- a/src/Pure/PIDE/document.scala	Tue Aug 28 15:25:28 2018 +0200
+++ b/src/Pure/PIDE/document.scala	Tue Aug 28 21:08:05 2018 +0200
@@ -560,6 +560,8 @@
 
     def command_results(range: Text.Range): Command.Results
     def command_results(command: Command): Command.Results
+
+    def command_id_map: Map[Document_ID.Generic, Command]
   }
 
 
@@ -860,6 +862,17 @@
         removing_versions = false)
     }
 
+    def command_id_map(version: Version, commands: Iterable[Command])
+      : Map[Document_ID.Generic, Command] =
+    {
+      require(is_assigned(version))
+      val assignment = the_assignment(version).check_finished
+      (for {
+        command <- commands.iterator
+        id <- (command.id :: assignment.command_execs.getOrElse(command.id, Nil)).iterator
+      } yield (id -> command)).toMap
+    }
+
     def command_state_eval(version: Version, command: Command): Option[Command.State] =
     {
       require(is_assigned(version))
@@ -1148,6 +1161,12 @@
           state.command_results(version, command)
 
 
+        /* command ids: static and dynamic */
+
+        def command_id_map: Map[Document_ID.Generic, Command] =
+          state.command_id_map(version, version.nodes(node_name).commands)
+
+
         /* output */
 
         override def toString: String =