FirstTimeInForever / intellij-pdf-viewer

Plugin for viewing PDF documents in IntelliJ-based IDEs.
https://github.com/FirstTimeInForever/intellij-pdf-viewer
MIT License
79 stars 19 forks source link

Auto reload not working when using latexmk -pvc #106

Open Vozf opened 3 months ago

Vozf commented 3 months ago

I have the pdf compiled with latexmk and the extension doesn't reflect the changes instantly, I need to alt tab to see the changes while the default ubuntu viewer works perfectly

Vozf commented 3 months ago

Screencast from 02-06-24 20:51:32.webm Here's the video. The change of focus to ubuntu pdf reader is exactly alt tab. Until I alt tab no changes will be displayed in intelij

PHPirates commented 3 months ago

Thanks for the video. It looks like you are compiling from the terminal tool window. Why are you not using run configurations?

I tested by opening a log file, and after compiling from the terminal the editor only shows the updated file after changing focus, so this is intellij behavior and has nothing to do with the pdf viewer.

Vozf commented 3 months ago

I'm compiling from terminal because latexmk with files watch recompiles the pdf way faster than compiling from scratch every time like texify does. If that's not fixable by you I guess you may close the issue. Thanks for the investigation

PHPirates commented 3 months ago

That makes sense, I just tested and also when I provide the -pvc flags in the run configuration the pdf does not refresh. Thanks for pointing that out, I will have a look to see if it is possible to work around this behaviour on TeXiFy's side.

andrew-selvia commented 3 weeks ago

I also face this limitation, though my context is slightly different. I leverage my build tool's ability to automatically watch files for changes in order to recompile my document. The PDF does not automatically update when this occurs, unfortunately.

Workarounds include:

Out of curiosity, is there any command I could run to force the PDF viewer to refresh? If so, I could simply add it as a step in my build. 🤔

PHPirates commented 2 weeks ago

Depends, what build tool are you using?

andrew-selvia commented 2 weeks ago

sbt

PHPirates commented 2 weeks ago

Hm, that is more difficult indeed as I don't know of any way we could provide an api to force a refresh. Maybe we can implement a file watch in this plugin so that it works regardless of using TeXiFy or not.

andrew-selvia commented 2 weeks ago

Making the PDF reload automatically on changes regardless of origin (i.e., TeXiFy, build tool, etc.) would certainly be best. Thank you for considering! 😅