Add RuntimeCodeExecutionMode to runtime.executeCode() in the API
Hi guys,
Could you please consider making positron.runtime.executeCode() in the API behave like the inner positron.runtime.execute(). It would be super helpful for extension developers like me to have the option to pass positron.RuntimeCodeExecutionMode.* and positron.RuntimeErrorBehavior.* to positron.runtime.executeCode().
This change could be really beneficial, especially when a user wants to run some code in the same R environment without displaying the output, just like how it's currently set up in Positron with the styler package:
https://github.com/posit-dev/positron/blob/15700417b7c58f0b20fef95fc100ddf2b8ac973d/extensions/positron-r/src/formatting.ts#L82-L86
Thanks for considering this!
System details:
Positron and OS details:
Positron Version: 2024.09.0 (user setup) build 103 Code - OSS Version: 1.93.0 Commit: 8274fe26a1582fa0dd0096d6631b500f591416c4 Date: 2024-09-30T02:52:11.236Z Electron: 30.4.0 Chromium: 124.0.6367.243 Node.js: 20.15.1 V8: 12.4.254.20-electron.0 OS: Windows_NT x64 10.0.19045
Interpreter details:
> sessionInfo()
R version 4.4.1 Patched (2024-08-05 r86984 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 10 x64 (build 19045)
Thanks for flagging this! We appreciate your help improving Positron. I'll flag this for further triage.
This particular issue is going to be challenging for QA verification, given that we don't really have a way to exercise the Positron API. We could build out an extension specifically for testing out changes like this, and that may be worth doing in the long run but it's a pretty heavy lift and should be tracked separately.
For the short term, let's wait until this change is in a new publicly available build (probably early next week) and then see if @atsyplenkov is willing to try it out in their extension.
@atsyplenkov I want to highlight that we did get RuntimeCodeExecutionMode all piped through so you should be able to run some code in the same R environment without displaying the output, but it turns out our kernels currently ignore RuntimeErrorBehavior so that is not supported today.
Ah actually, the 2025.01.0-39 release for today does have the new RuntimeCodeExecutionMode argument available in the Positron API!
@atsyplenkov if you get a chance, we would so appreciate you trying out your extension with this new release and letting us know if you run into any problems!
Awesome, thanks! I will test it soon and will let you know.
@juliasilge I have quickly tested the RuntimeCodeExecutionMode.Silent in my extension and it works as expected! Thank you for that. I will explore the new API features in detail later this week and will let you know.
I guess you can close this issue for now.
Thank you so much for your original request and for using Positron's features in your extension! We would love to hear about any problems you have developing against our IDE moving forward.