posit-dev / positron

Positron, a next-generation data science IDE
Other
2.26k stars 68 forks source link

Shiny apps do not communicate with console #3988

Open JosiahParry opened 1 month ago

JosiahParry commented 1 month ago

Positron Version:

Positron Version: 2024.07.0 (Universal) build 21 Code - OSS Version: 1.90.0 Commit: 82b335e27545e804b7fd806db00477a6eb49951d Date: 2024-07-09T04:32:26.804Z Electron: 29.4.0 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Darwin arm64 23.4.0

Steps to reproduce the issue:

  1. Run any shiny app that communicates with the console
  2. notice that nothing is being executed
  3. Cancel the shiny app
  4. notice that the console is still interrupting interrupt again
  5. notice everything that was printed was finally printed to the console

Screen Recording 2024-07-11 at 21 18 37

What did you expect to happen?

console messages show as they appear

Were there any error messages in the output or Developer Tools console?

juliasilge commented 1 month ago

I think I would recommend either:

Either one of these will use the Positron Viewer pane.

Can you try one of those out? Or is there a specific reason you are running the Shiny code in the console this way?

JosiahParry commented 1 month ago

Maybe the shiny extension can be helpful here. But I'd like to be a little vanilla with the experience if possible.

Running shiny::runApp() and pointing to the directory which contains the app.R file that I am editing feels somewhat circuitous. In all of the demo applications I've built and ran they've all had the shiny::shinyApp() line at the end

See the example at https://shiny.posit.co/r/getstarted/shiny-basics/lesson1/index.html#cb5

juliasilge commented 1 month ago

It's true that the treatment for running this code interactively line-by-line in the console is somewhat different in RStudio than in Positron so we will take a look.

As a workaround for now, I would recommend using the Shiny extension when developing Shiny apps and using the "Run Shiny App" command, perhaps via the UI and the "Play" button on your app file.