scholarsmate commented on code in PR #1014:
URL: https://github.com/apache/daffodil-vscode/pull/1014#discussion_r1583130659


##########
debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala:
##########
@@ -1364,33 +1399,40 @@ object Parse {
       dispatcher.unsafeRunSync {
         events.offer(Some(Event.Fini)) *>
           events.offer(None) *> // no more events after this
-          state.offer(None) *> // no more states == the parse is terminated
-          infoset.offer(None) *>
           Logger[IO].debug("Debugger fini event: completed parse")
       }
 
     override def startElement(pstate: PState, processor: Parser): Unit =
       dispatcher.unsafeRunSync {
         // Generating the infoset requires a PState, not a StateForDebugger, 
so we can't generate it later from the Event.StartElement (which contains the 
StateForDebugger).
-        lazy val setInfoset = {
+        lazy val infoset = {
           var node = pstate.infoset
           while (node.diParent != null) node = node.diParent
           node match {
-            case d: DIDocument if d.contents.size == 0 => IO.unit
-            case _                                     => 
infoset.offer(Some(infosetToString(node)))
+            case d: DIDocument if d.contents.size == 0 => None
+            case _ =>
+              Some(
+                InfosetEvent(
+                  infosetToString(node),
+                  infosetFormat match {
+                    case "xml"  => "text/xml"
+                    case "json" => "application/json"
+                  }
+                )
+              )
           }
         }
 
         logger.debug("pre-control await") *>
           // may block until external control says to unblock, for stepping 
behavior
           control.await
             .ifM(
-              events.offer(Some(new Event.StartElement(pstate, isStepping = 
true))) *> setInfoset,
-              events.offer(Some(new Event.StartElement(pstate, isStepping = 
false)))
+              events.offer(Some(new Event.StartElement(pstate, infoset))),
+              events.offer(Some(new Event.StartElement(pstate, None))) // we 
only emit infoset when stepping
             ) *>
           logger.debug("post-control await") *>
           logger.debug("pre-checkBreakpoints") *>
-          // TODO: there's a race between the readers of `events` and `state`, 
so somebody could react to a hit breakpoint before the event data was committed
+          // TODO: infoset should have been sent prior to a breakpoint hit

Review Comment:
   Is this still a TODO?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to