asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

Refresh the preview when other files change

Open ahus1 opened this issue 3 years ago • 1 comments
trafficstars

After editing includes for a document, images or an .asciidoctorconfig file and when I then return to the original document, the preview still shows the old contents.

I then trigger a small change in the current document to refresh the preview.

It would be great if the preview could refresh when one of the following happens:

  1. Any file in the current project changes
  2. The user switches the focus to the main document

The first option would allow editing an include and watching the preview to refresh.

The second option would help with external referenced images or files outside of the current project.

So IMHO, the preview should refresh when either of the two happens (any file changed or focus switched).

ahus1 avatar Nov 06 '22 14:11 ahus1

Any file in the current project changes

I wonder if that would be costly performance-wise. We can use a FileSystemWatcher: https://code.visualstudio.com/api/references/vscode-api#FileSystemWatcher or add listeners on the workspace: https://code.visualstudio.com/api/references/vscode-api#workspace

The user switches the focus to the main document

That's a good idea.

ggrossetie avatar Nov 06 '22 17:11 ggrossetie