-
Notifications
You must be signed in to change notification settings - Fork 7
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
How do you auto reload pdf after compiling? #355
Comments
Did you get the LilyPond PDF Preview extension for vscode? |
No, I didn't, because I think it's included in VSLilyPond, see here and here |
But were you using it? |
This is strange, on my Mac with 11.6 Big Sur, VSLilyPond 1.60 I can’t reproduce this issue |
Do the other features work like clicking notes to go from pdf to code and from code to pdf? |
I forgot that was something from the command pallet (Ctrl + Shift + P): If I open the vscode Output panel and select
|
@Apostolique @lhl2617 Hi, according to the info I provided above, do you guys know what's happening on my vscode or vslilypond ? |
I'm not sure but since it doesn't work you can find any PDF reader that has auto reload for now. I use SumatraPDF but that's for Windows. I'm sure you can find a similar one for mac. |
Yep, the build-in App "Preview.app" on Mac can do this, but I have to press |
I'm unable to repro your bug, can you try opening a dev console in VSCode (https://stackoverflow.com/questions/30765782/what-is-the-use-of-the-developer-tools-in-vs-code) and see if anything is wrong there? |
|
I seem to be having the same issue. It had worked for me on Big Sur before. After a completely clean install of VS Code and VSLilypond, the auto-refresh of the PDF preview window (which really uses the LilyPond PDF Preview that comes with VSLilyPond) does not work anymore. |
Interestingly, I found a situation that results in the PDF within VSCode to refresh:
|
I made a test in your condition, it turns out that the we should switch to another app then switch back to vscode after saving the code, only by doing this, the PDF inside vscode(opened by LilyPond PDF Preview) can reload. This has nothing to do with the macOS app "Preview.app". |
I've just tried it with "not Preview.app". Does not work. So far I have only gotten it to work by clicking on Preview.app with the same file. |
I have the same problem, and I am using Linux. Whenever I save, I can see the logs in the Output panel and the PDF is being generated. However, the PDF Preview is not refreshing the output. |
I'm having the same problem. macOS v12.4 Monterey Switching to Preview.app and back updates the PDF both in Preview.app and in LilyPond PDF Viewer. Switching to an app other than Preview.app doesn't seem to trigger the reload. I also tried opening the PDF (after saving/compiling) with QuickLook (pressing Space bar on macOS in the Finder). QuickLook showed me the updated PDF, but neither Preview.app nor LilyPond PDF Viewer updated (until focusing Preview.app, of course). |
Update: I found that LilyPond PDF Viewer will automatically update if it's let sit long enough. In my experience, it's usually less than a minute, but not consistent. I can not consistently replicate this. |
Hi @lhl2617 ..thanks for this fantastic plugin ! Locally debugging the PDF Preview Extension, I found that (on Linux) compiling with lilypond will generate a new PDF file (with the same name). this._watcher.onDidCreate((e) => {
if (e.toString() === this.resource.toString()) {
this.reload()
}
}) here So this yields the somewhat weird question, if all OS's lilypond command treat PDF compilation the same or different (?) If you want I can create a PR and try to cover all events |
hi folks, I have this bug. I also don't have ready ability to hack on the plugin itself. so to work around this, I open my console, select "terminal", and on my Fedora linux machine (things may have to be different on OSX) I run this while loop to refresh the pdf each time it gets recreated, which seems to wake up the pdf viewer: while [ 1 ]; do sleep 1; find . -name "*.pdf" -mmin -0.02 -exec sh -c "echo 'detected changes on {}'; touch {}; sleep 1 " \; ; done; That will run every second, and it will: 1. run a find for .pdf files that were modified less than .02 minutes ago 2. do a touch 3. the sleep another second per "touch", so that it doesn't keep touching the file over and over again. I organize that into a script (noting I just tried lilypond for the first time about an hour ago) |
Thank you for offering the solution, I did this on my Mac and it worked! |
First of all thank you @lhl2617 for making this possible in the first place! This is my first time venturing in Lilypond territory and I figured it'd be good fit for me given my familiarity with VSCode and TeX. And since I've set this up, I can't even think of going back to GUI based sheet editors. I realize this is an old issue but I wanted to share a fix that worked for me regarding the auto-reload of the .pdf file. Note that I'm doing this on a MacOS Sonoma 14.5 machine. Shouldn't be too different though on other systems. @clojj and @leiyi-0612 comments were immensely helpful for fixing this 🙏. (I'm pretty much repeating @leiyi-0612 instructions step by step)
this._register(watcher.onDidCreate((e) => {
if (e.toString() === this.resource.toString()) {
this.reload()
}
}));
Extra thoughts: Not an expert on this but my guess as to why |
I was able to compile the
test.ly
by pressingcommand+s
on my Mac and it generate atest.pdf
file, I open this pdf file in a split window on vscode.As you known, we need to repeat this procedure: write code→save(compile)→preview, but I can't do this, every time I save(compile) the
test.ly
file, thetest.pdf
file not auto reloading, I have to close it and reopen to see the change.How can I solve this problem?
vslilypond
vscode
macOS
The text was updated successfully, but these errors were encountered: