quarto-dev / quarto-vscode

Quarto extension for VS Code
https://marketplace.visualstudio.com/items?itemName=quarto.quarto
MIT License
112 stars 11 forks source link

Allow user to toggle `--no-watch-inputs` flag when running Quarto Render #32

Closed ddanieltan closed 2 years ago

ddanieltan commented 2 years ago

The default behavior for Quarto Render runs /Applications/quarto/bin/quarto preview welcome.qmd --no-browser --no-watch-inputs. I find it strange that the default command includes the --no-watch-inputs flag and suggest adding the ability to toggle the flag off.

jjallaire commented 2 years ago

By passing --no-watch-inputs we give the user the choice between just saving and saving with a full render (extremely useful if rendering is time consuming). If you use the Cmd+Shift+K shortcut you will get auto-save + render (which is the same behavior as you'd have pressing save without --no-watch-inputs)

So that's how to emulate the behavior. All that said I agree it would be nice for this to be an explicit (ideally per-file) option so am leaving this issue open.

ddanieltan commented 2 years ago

Thanks for keeping this issue open! I saw a very similar issue raised here: https://github.com/quarto-dev/quarto-vscode/issues/6, and I think it's valuable to have future users be able to discover the existing conversation + the team's thoughts behind rendering on save.

fuhrmanator commented 2 years ago

It's even more confusing (to me) because (in Windows, inside a bash) there's a console message:

...

Watching files for changes
Browse at http://localhost:7619/

It implies it should see the changes when one saves. If I re-run the command without --no-watch-inputs the message is the same and changes are detected.

Knowing about ctrl-shiftk, it now makes more sense (but it's not intuitive to me).

fuhrmanator commented 2 years ago

Knowing about ctrl-shiftk, it now makes more sense (but it's not intuitive to me).

Oh, wow, I realize now that using this command in a reveal.js document causes the slide where your cursor is to show in the preview inside VSCode. Very cool! I'm loving Quarto more every day!

alexkyllo commented 2 years ago

This confused me too, the console message literally says "Watching files for changes" even though it isn't doing that.

I would really like to have two commands in the extension--say "Quarto: Render" (current behavior) and "Quarto: Render and Watch," would call quartopreviewwithout and with the--no-watch-inputs` option, respectively. Then I can decide if I want rendering on save or not.

Victor-Botelho commented 2 years ago

How can I use the render button in VSCode without passing the --no-watch-inputs flag?

jjallaire commented 2 years ago

That option is really saying "don't watch the inputs b/c the editing environment will take care of that". Unfortunately in VS Code we didn't (until now) have a way to specify "Render on Save" as we do in RStudio. With the release of v1.36.0 of the extension there is now a Render on Save option, and you can also specify the same behavior per-document or per-project in YAML (for sharing configuration across editors). Here is the documentation:

https://quarto.org/docs/tools/vscode.html#render-on-save

Note also that even though we aren't "watching inputs" we are in fact "watching files for changes" (those files being configuration and CSS files that might require a refresh).