You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current positron.runtime.executeCode function resolves when the code is sent to the runtime. However, in both the Positron R and Positron Notebook Controller extensions we construct a promise that resolves when the code is handled by the runtime (by waiting for the status idle message), or rejects after a timeout.
The latter seems much more useful for language packs and other extensions so possibly worth streamlining.
Proposal:
Update positron.runtime.executeCode to:
Resolve when the session receives a status idle message.
Reject after a configurable timeout.
Accept a callback: (message) => void that is called on each received runtime message with the same parent ID as the execution ID.
The text was updated successfully, but these errors were encountered:
This functionality was frequently requested by the team developing the R extension, though we never got around to implementing it. I bet other extension authors would also find it very beneficial.
I think it would also be important for the promise to reject if the code causes an error to occur, as an important use case (for R) was running some code on the user's behalf and knowing both (a) whether it finished, and (b) whether it ran successfully. There are also other rejection cases, such as the runtime exited/being shut down/restarted/interrupted during execution.
We could probably leave it up to the caller to wrap the promise in a timeout if needed.
The current
positron.runtime.executeCode
function resolves when the code is sent to the runtime. However, in both the Positron R and Positron Notebook Controller extensions we construct a promise that resolves when the code is handled by the runtime (by waiting for the status idle message), or rejects after a timeout.The latter seems much more useful for language packs and other extensions so possibly worth streamlining.
Proposal:
Update
positron.runtime.executeCode
to:callback: (message) => void
that is called on each received runtime message with the same parent ID as the execution ID.The text was updated successfully, but these errors were encountered: