James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.42k stars 519 forks source link

PDF viewer not refreshed when it's modified directly. #4266

Closed martinwang2002 closed 1 month ago

martinwang2002 commented 1 month ago

Pre-checks*

Environment*

Please write exact version numbers instead of descriptors such as latest.

  • Operating System: Windows 10. ssh remote ubuntu 2204 5.15.0-88-generic
  • Visual Studio Code Version: 1.89.1
  • LaTeX Workshop Version: 9.20.1
  • TeX Distribution Version: texlive/texlive@sha256:e946b6090fbf56ad1cb8b5442f02a61d91ecd543ba5f0ce42e966da5f1845815

The Issue*

The PDF vieweris not refreshed when only the pdf file itself is modified, e.g. via copy and paste.

Reproduction Steps

  1. Prepare two pdfs 1.pdf and 2.pdf
  2. Open 1.pdf in the latex workshop viewer.
  3. Run mv 2.pdf 1.pdf and overwrite.
  4. 1.pdf is not refreshed.

Expected Behavior

What were you expecting to see? Include any relevant examples or documentation links.

  • The opened viewer on 1.pdf should auto refresh since the content changes

    Logs

    LaTeX Workshop Output*

    Please paste the whole log messages below, not parts of ones. The log should start with New log placeholder %WS1% registered.

    [03:34:25.898][Logger] New log placeholder %WS1% registered for /home/ubuntu/ubuntu.
    [03:34:25.898][Extension] Initializing LaTeX Workshop.
    [03:34:26.531][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_LATEX: "texlive/texlive:latest"
    [03:34:26.688][Server] Creating LaTeX Workshop http and websocket server.
    [03:34:27.520][Format][Bib] Bibtex format config: {"tab":"  ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]}
    [03:34:27.771][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":40069} .
    [03:34:29.204][Server] valdOrigin is http://127.0.0.1:40069
    [03:34:29.208][Extension] Extension root: /home/ubuntu/.vscode-server/extensions/james-yu.latex-workshop-9.20.1
    [03:34:29.208][Extension] $PATH: /home/ubuntu/.vscode-server/cli/servers/Stable-dc96b837cf6bb4af9cd736aa3af08cf8279f7685/server/bin/remote-cli:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    [03:34:29.208][Extension] $SHELL: /bin/bash
    [03:34:29.209][Extension] $LANG: en_US.UTF-8
    [03:34:29.209][Extension] $LC_ALL: undefined
    [03:34:29.210][Extension] process.platform: linux
    [03:34:29.210][Extension] process.arch: x64
    [03:34:29.210][Extension] vscode.env.appName: Visual Studio Code
    [03:34:29.210][Extension] vscode.env.remoteName: ssh-remote
    [03:34:29.210][Extension] vscode.env.uiKind: 1
    [03:34:29.224][Config] latex-workshop.latex.build.forceRecipeUsage: false .
    [03:34:29.250][Config] latex-workshop.latex.autoBuild.run: "onSave" .
    [03:34:29.256][Config] latex-workshop.latex.autoBuild.cleanAndRetry.enabled: false .
    [03:34:29.373][Config] latex-workshop.synctex.afterBuild.enabled: true .
    [03:34:29.498][Config] latex-workshop.docker.enabled: true .
    [03:34:29.499][Config] latex-workshop.docker.image.latex: "texlive/texlive:latest" .
    [03:34:29.599][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{"]
    [03:34:29.601][Root] Current workspace folders: ["file://%WS1%"]
    [03:34:29.610][Extension] LaTeX Workshop initialized.
    [03:34:29.621][Root] The active document cannot be used as the root file: vscode-notebook-cell://ssh-remote+aliyun%WS1%/model/zhusheng_20cm/zhusheng_20cm_factor_investigate.ipynb#W1sdnNjb2RlLXJlbW90ZQ==
    [03:34:29.622][Root] Current workspaceRootDir: file://%WS1% .
    [03:34:31.876][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40069/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZxaXpoZW5nJTJGcWl6aGVuZyUyRnJ1bnRpbWUlMkZwZGYlMkZiYWNrdGVzdF9yZXBvcnQucGRm .
    [03:34:31.917][Cacher][Watcher] Watched %WS1%/runtime/pdf/1.pdf with a new .pdf watcher on %WS1%/runtime/pdf .
    [03:34:31.918][Event] FILE_WATCHED: "%WS1%/runtime/pdf/1.pdf"
    [03:34:32.789][Root] Found files that might be root, choose the first one: %WS1%/main.tex,%WS1%/runtime/pdf/main.tex .
    [03:34:32.790][Root] Root file changed: from %WS1%/main.tex to %WS1%/main.tex, langID latex . Refresh dependencies
    [03:34:32.790][Event] ROOT_FILE_CHANGED: "%WS1%/main.tex"
    [03:34:32.791][Cacher][Watcher] Reset.
    [03:34:32.791][Cacher][Watcher] Reset.
    [03:34:32.846][Cacher] Adding %WS1%/main.tex .
    [03:34:32.847][Cacher][Watcher] Watched %WS1%/main.tex with a new .* watcher on %WS1%/.
    [03:34:32.847][Event] FILE_WATCHED: "%WS1%/main.tex"
    [03:34:32.864][Cacher] Caching %WS1%/main.tex .
    [03:34:32.880][Cacher] Updated inputs of %WS1%/main.tex .
    [03:34:32.880][Cacher] Parse LaTeX AST: %WS1%/main.tex .
    [03:34:32.880][Event] ROOT_FILE_SEARCHED
    [03:34:33.388][Cacher] Parsed LaTeX AST: %WS1%/main.tex .
    [03:34:33.393][File] Calling kpsewhich to resolve article.cls .
    [03:34:33.489][File] kpsewhich returned with non-zero code null.
    [03:34:33.497][Cacher] Updated elements in 108.11 ms: %WS1%/main.tex .
    [03:34:33.732][Event] STRUCTURE_UPDATED
    [03:34:38.804][Viewer] Handle data type: open
    [03:34:39.580][Server] Preview PDF file: file://%WS1%/runtime/pdf/1.pdf
    [03:34:56.880][Viewer] Handle data type: loaded
    [03:34:56.881][Event] VIEWER_PAGE_LOADED
    [03:34:56.886][Viewer] SyncTex after build invoked.
    [03:34:56.887][Locator] extension-output-James-Yu.latex-workshop-#1-LaTeX Workshop is not valid LaTeX.
    [03:38:11.154][Commander] REFRESH command invoked.
    [03:38:11.155][Viewer] Call refreshExistingViewer: undefined .
    [03:38:14.311][Server] Preview PDF file: file://%WS1%/runtime/pdf/1.pdf
    [03:38:22.048][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40069/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZxaXpoZW5nJTJGcWl6aGVuZyUyRnJ1bnRpbWUlMkZwZGYlMkZiYWNrdGVzdF9yZXBvcnQucGRm .
    [03:38:22.049][Cacher][Watcher] Watched %WS1%/runtime/pdf/1.pdf by the .pdf watcher.
    [03:38:22.049][Event] FILE_WATCHED: "%WS1%/runtime/pdf/1.pdf"
    [03:38:31.424][Server] Preview PDF file: file://%WS1%/runtime/pdf/1.pdf
    [03:38:31.894][Viewer] Handle data type: open
    [03:38:37.214][Viewer] Handle data type: loaded
    [03:38:37.214][Event] VIEWER_PAGE_LOADED
    [03:38:37.215][Viewer] SyncTex after build invoked.
    [03:38:37.215][Locator] No active editor found.
    [03:40:55.146][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40069/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZxaXpoZW5nJTJGcWl6aGVuZyUyRnJ1bnRpbWUlMkZwZGYlMkZiYWNrdGVzdF9yZXBvcnQucGRm .
    [03:40:55.147][Cacher][Watcher] Watched %WS1%/runtime/pdf/1.pdf by the .pdf watcher.
    [03:40:55.148][Event] FILE_WATCHED: "%WS1%/runtime/pdf/1.pdf"
    [03:41:02.424][Server] Preview PDF file: file://%WS1%/runtime/pdf/1.pdf
    [03:41:02.635][Viewer] Handle data type: open
    [03:41:04.676][Viewer] Handle data type: loaded
    [03:41:04.677][Event] VIEWER_PAGE_LOADED
    [03:41:04.677][Viewer] SyncTex after build invoked.
    [03:41:04.677][Locator] No active editor found.
    [03:41:47.915][Viewer][Panel] Internal PDF viewer at http://127.0.0.1:40069/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZxaXpoZW5nJTJGcWl6aGVuZyUyRnJ1bnRpbWUlMkZwZGYlMkZkYWlseV9yZXBvcnQucGRm .
    [03:41:47.915][Cacher][Watcher] Watched %WS1%/runtime/pdf/2.pdf by the .pdf watcher.
    [03:41:47.916][Event] FILE_WATCHED: "%WS1%/runtime/pdf/2.pdf"
    [03:41:55.982][Server] Preview PDF file: file://%WS1%/runtime/pdf/2.pdf
    [03:41:56.374][Viewer] Handle data type: open
    [03:41:57.395][Viewer] Handle data type: loaded
    [03:41:57.395][Event] VIEWER_PAGE_LOADED
    [03:41:57.395][Viewer] SyncTex after build invoked.
    [03:41:57.396][Locator] No active editor found.
    [03:42:43.491][Cacher][Watcher] "delete" emitted on %WS1%/runtime/pdf/2.pdf.
    [03:42:43.742][Cacher][Watcher] File deletion confirmed: %WS1%/runtime/pdf/2.pdf .
    [03:42:43.742][Event] FILE_REMOVED: "%WS1%/runtime/pdf/2.pdf"

Developer Tools Console

Please paste the whole log messages below, not parts of ones. This console logs can sometimes be very important in many cases. To access the log, click Help -> Toggle Developer Tools -> Console.

INFO Started local extension host with pid 12164.
log.ts:419  INFO Invoking resolveAuthority(ssh-remote)...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][0ms] obtaining proxy...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][0ms] invoking...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][1005ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][2050ms] waiting...
log.ts:429  WARN [remote-ssh]: Couldn't find message for key setting.usseExecServer.description.
12log.ts:429  WARN [cmake-tools]: Couldn't find message for key cmake-tools.configuration.cmake.options.advanced.statusBarLength.description.
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][3004ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][4006ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][5003ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][6006ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][7008ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][8006ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][9004ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][10002ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][11002ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][12007ms] waiting...
log.ts:419  INFO [LocalProcess0][resolveAuthority(ssh-remote,1)][12247ms] returned Managed(1)
log.ts:419  INFO resolveAuthority(ssh-remote) returned 'Managed(1)' after 12248 ms
log.ts:419  INFO Creating a socket (renderer-Management-080ecc8e-faf7-4185-9dbf-a08af23dbdc7)...
log.ts:419  INFO Creating a socket (renderer-ExtensionHost-b078c4a3-eef5-449f-9558-ef4df023b832)...
log.ts:419  INFO Creating a socket (renderer-Management-080ecc8e-faf7-4185-9dbf-a08af23dbdc7) was successful after 583 ms.
log.ts:419  INFO Creating a socket (renderer-ExtensionHost-b078c4a3-eef5-449f-9558-ef4df023b832) was successful after 583 ms.
log.ts:419  INFO [perf] Render performance baseline is 81ms
log.ts:419  INFO Extension host (Remote) is unresponsive.
log.ts:419  INFO Extension host (Remote) is responsive.
James-Yu commented 1 month ago

mv command first deletes the original file. This is also reflected in the log. You are recommended to file a feature request to vscode’s repo on this behavior, as this extension relies on its file system API to monitor file changes or deletions.