quarto-dev / quarto

Quarto open-source scientific and technical publishing system
https://quarto.org
GNU Affero General Public License v3.0
315 stars 26 forks source link

Preview of output for html format restarts on save #359

Open mpf opened 8 months ago

mpf commented 8 months ago

The Quarto: Preview command, executed from vscode's command palette, correctly starts and waits for saved changes:

Preparing to preview

Watching files for changes
Browse at http://localhost:7258/test
GET: /test/index.html

But on save, that process is killed (closing the preview), and the preview command is newly executed, which opens a new preview window with a different port. This is inconvenient.

This doesn't occur for all qmd files.

Is this behaviour normal when a file contains particular content? Or is it a bug? If it's the latter, I'd like to help, but would need guidance on what kind of debugging information I might provide.

dragonstyle commented 8 months ago

Typically, the preview command will re-use existing instances when it can. It could restart in cases like encountering an error, but that isn't typically expected. Is there a particular document that is causing this?

mpf commented 8 months ago

I'm finding it difficult to reliably reproduce the issue. Does VSCode generate logs that I can view next time this happens, so that I can send something more informative to this thread?

Adam-Antios commented 8 months ago

I have the same issue for a revealjs presentation right after I upgraded my Quarto to 1.4.549. I use Quarto through VS Code using the extension and the backend is WSL Ubuntu 20.04.

Adam-Antios commented 7 months ago

I found the root of the problem. I had put those lines

format:
    revealjs: 
        theme: [simple, custom.scss]
        width: 1900
        height: 1080

in the _quarto.yml instead of the qmd file and it caused the quarto extension of VS Code to restart the preview each time.

mpf commented 7 months ago

Thanks for the update, @Adam-Antios . Does this mean that we’re not meant to specify format options within _quarto.yml? It seems a useful way to avoid duplicating format options in every separate qmd file.

Adam-Antios commented 7 months ago

That is what I was aiming for as well! I really don't know what that means. I was thinking it might be a bug of the VS Code Quarto extension, at least in my case.

mpf commented 7 months ago

I've also observed that, on the occasions where the preview doesn't restart, it often jumps to, say, the beginning of the document or some other section unrelated to the current cursor position.

I've given up on quarto preview from within vscode, and now run quarto preview manually in a terminal using a stand-along browser. This works reliably.