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
Is your feature request related to a problem? Please describe.
When using async code in monaco run, later lines are not added. For example the following snippets only show 1 and 3 because the output is built synchronously.
Describe the solution you'd like
I'd like the code output to be updated when the new log shows up.
Describe alternatives you've considered
Currently, I have successfully patched the ts-runner to return an element that mimics what <CodeRunner /> (from internals) outputs, but imperatively.
I am willing to make my patch a PR if the maintainers are interested. However I believe the best way to handle this would be to supports async generators as CodeRunnerOutputs. This way it would provide the functionality to all runners, and they won't have to manually do the little work (highlighting, etc) I am currently doing (since I am bypassing and replicating the usual rendering). I don't think it would be too hard to do, and am willing to give it a crack if the maintainers are interested (though expect delays).
The text was updated successfully, but these errors were encountered:
The code is runned in a async context currently. You can use the await keyword on top level. However, setTimeout isn't working because the program finished before the callback, then the results aren't shown.
It is possible to override setTimeout in the running context, so that the program will only be regarded finished after all timeouts got triggered.
It is probably a better approach then, because my solution currently has issues when exporting. But would it mean the program would only show the result once all setTimeout are done? I was currently thinking about overriding setTimeout in print mode and so have a fully different behavior in this case. But it starts to feel rather hacky.
Is your feature request related to a problem? Please describe.
When using async code in monaco run, later lines are not added. For example the following snippets only show 1 and 3 because the output is built synchronously.
Describe the solution you'd like
I'd like the code output to be updated when the new log shows up.
Describe alternatives you've considered
Currently, I have successfully patched the ts-runner to return an element that mimics what
<CodeRunner />
(frominternals
) outputs, but imperatively.I am willing to make my patch a PR if the maintainers are interested. However I believe the best way to handle this would be to supports async generators as
CodeRunnerOutputs
. This way it would provide the functionality to all runners, and they won't have to manually do the little work (highlighting, etc) I am currently doing (since I am bypassing and replicating the usual rendering). I don't think it would be too hard to do, and am willing to give it a crack if the maintainers are interested (though expect delays).The text was updated successfully, but these errors were encountered: