-
Notifications
You must be signed in to change notification settings - Fork 13
Add a big red stop button for Positron's Viewer pane #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
wch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, but I think it would be better if we could get this to work in VS Code as well as Positron, so that Shiny users who use VS Code (or other forks) can also have a stop button. I realize this implementation uses some Positron-specific features, but I'll look into getting this to work in non-Positron as well.
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const previewSourceType = (pst as any).PreviewSourceType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The as isn't necessary here.
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | |
| const previewSourceType = (pst as any).PreviewSourceType; | |
| const previewSourceType = pst.PreviewSourceType; |
|
|
||
| /** | ||
| * Positron only: Get the preferred runtime for a language from Positron's API. | ||
| * Used to find R interpreter path in Positron. Returns undefined in VS Code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just as a heads up, this also applies to the Python interpreter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've updated this on main.



This PR addresses:
This PR changes the preview behavior to keep track of the source terminal when in Positron, to instrument the new red stop button:
The red stop button should appear quite soon after you click the "play" button for either an R or Python Shiny app (it is not IMMEDIATE and I am wondering if we should try to hurry that up on the Positron side with an optimistic assumption that the app will start) and stay visible while the app is running.
Just FYI, we have this functionality built in to Positron for other app types we support, like Streamlit and Dash and such. We need this change here to support the button for Shiny. Unfortunately, we don't have a lot of good options for testing here in the extension (no Positron test runner for extensions yet), but we can extend the Playwright tests we have in Positron once this change is in a released version of the extension. We do currently test this button for a Streamlit app and similar.
This does not effect any behavior when in VS Code.