James-Yu / LaTeX-Workshop

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

Multi-stage builds within devcontainer don't update PDF preview on completion #4052

Closed iwishiwasaneagle closed 11 months ago

iwishiwasaneagle commented 11 months ago

Please fill the following fields with a star (*) and provide as much related information as possible.

Pre-checks*

Please change the following [ ] to [x] for confirmation.

  • [x] The issue has not been reported in this repository.
  • [x] The issue remains after disabling all other extensions and restarting Visual Studio Code.
  • [x] The FAQ cannot address the issue.
  • [x] The issue is not related to compiling a document, or the document can be successfully compiled in the OS terminal but not in Visual Studio Code with this extension.

Environment*

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

  • Operating System: [e.g. Windows 10] Linux jhdesktop 5.15.131-1-MANJARO #1 SMP PREEMPT Thu Sep 7 11:05:18 UTC 2023 x86_64 GNU/Linux
  • Visual Studio Code Version: [e.g. 1.41.0] 1.82.2
  • LaTeX Workshop Version: [e.g. 8.5.0] 9.14.1
  • TeX Distribution Version: [e.g. TeX Live 2019 / MiKTeX 2.9.7250] latexmk 4.76.

The Issue*

Please briefly describe the issue you come across.

  • Having recipes with more than 1 item in them stops the PDF auto-updater from working.

Reproduction Steps

Please list out the steps to reproduce your bug. Include relevant environmental variables or any other configuration.

  1. Have PDF auto-updater enabled
  2. Have a recipe with more than one step
  3. Compile

Expected Behavior

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

  • PDF viewer should update on compile regardless of number of steps

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.

One Recipe (working)

[09:47:25.991][Event] STRUCTURE_UPDATED
[09:47:27.078][Format][TeX] Start formatting with latexindent.
[09:47:27.080][Format][TeX] Formatting LaTeX. The command is latexindent:["-c","%WS1%/","%WS1%/__latexindent_temp_t.tex","-y=defaultIndent: '    '"].
[09:47:27.195][Format][TeX] Formatted %WS1%/t.tex
[09:47:27.271][Extension] onDidSaveTextDocument triggered: file://%WS1%/t.tex
[09:47:27.272][Linter] ChkTeX lints root %WS1%/t.tex .
[09:47:27.272][Linter][ChkTeX] Linter for ChkTeX command The command is chktex:["-wall","-n22","-n30","-e16","-q","-f%f:%l:%c:%d:%k:%n:%m\n","%WS1%/t.tex"].
[09:47:27.290][Linter] Linter for root successfully finished in 0s 3ms
[09:47:27.291][Linter][ChkTeX] No .chktexrc file is found to determine TabSize.
[09:47:27.292][Linter][ChkTeX] Logged 0 messages.
[09:47:27.355][Cacher][Watcher] "change" emitted on %WS1%/t.tex .
[09:47:27.357][Cacher] Caching %WS1%/t.tex .
[09:47:27.358][Cacher] Updated inputs of %WS1%/t.tex .
[09:47:27.359][Cacher] Parse LaTeX AST: %WS1%/t.tex .
[09:47:27.359][Builder] Auto build started detecting the change of a file: %WS1%/t.tex .
[09:47:27.360][Event] AUTO_BUILD_INITIATED: {"type":"onChange","file":"%WS1%/t.tex"}
[09:47:27.360][Commander] BUILD command invoked.
[09:47:27.360][Commander] The document of the active editor: file://%WS1%/t.tex
[09:47:27.361][Commander] The languageId of the document: latex
[09:47:27.361][Commander] Building root file: %WS1%/t.tex
[09:47:27.361][Builder] Build root file %WS1%/t.tex
[09:47:27.361][Event] FILE_CHANGED: "%WS1%/t.tex"
[09:47:27.366][Builder] outDir: %WS1% .
[09:47:27.367][Builder] Preparing to run recipe: latexmk 1x1.
[09:47:27.368][Builder] Prepared 1 tools.
[09:47:27.369][Builder] Recipe step 1 The command is latexmk:["-shell-escape","-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","-outdir=%WS1%","%WS1%/t"].
[09:47:27.370][Builder] env: {}
[09:47:27.370][Builder] root: %WS1%/t.tex
[09:47:27.371][Builder] cwd: %WS1%
[09:47:27.382][Builder] LaTeX build process spawned with PID 2175.
[09:47:27.384][Cacher] Parsed LaTeX AST: %WS1%/t.tex .
[09:47:27.385][Cacher][Path] Calling kpsewhich to resolve article.cls .
[09:47:27.410][Cacher] Updated elements in 25.78 ms: %WS1%/t.tex .
[09:47:27.411][Event] FILE_PARSED: "%WS1%/t.tex"
[09:47:27.412][Structure] Structure force updated with 0 root sections for %WS1%/t.tex .
[09:47:27.412][Event] STRUCTURE_UPDATED
[09:47:27.561][Parser][TexLog] Logged 0 messages.
[09:47:27.562][Builder] Finished a step in recipe with PID 2175.
[09:47:27.563][Builder] Successfully built %WS1%/t.tex .
[09:47:27.563][Event] BUILD_DONE
[09:47:27.564][Viewer] Call refreshExistingViewer: "%WS1%/t.pdf" .
[09:47:27.564][Viewer] Refresh PDF viewer: %WS1%/t.pdf
[09:47:27.566][Cacher] Parsing .fls %WS1%/t.fls .
[09:47:27.571][Cacher] Found .aux %WS1%/t.tex from .fls %WS1%/t.fls , parsing.
[09:47:27.572][Cacher] Parsed .aux %WS1%/t.tex .
[09:47:27.572][Cacher] Parsed .fls %WS1%/t.fls .
[09:47:27.712][Server] Preview PDF file: file://%WS1%/t.pdf
[09:47:27.751][Viewer] Handle data type: loaded
[09:47:27.753][Event] VIEWER_PAGE_LOADED
[09:47:32.688][Cacher][Watcher] "change" emitted on %WS1%/t.pdf after polling for 5001 ms.
[09:47:32.689][Event] FILE_CHANGED: "%WS1%/t.pdf"

Two Recipes (not working)

[09:46:39.502][Event] STRUCTURE_UPDATED
[09:46:42.197][Format][TeX] Start formatting with latexindent.
[09:46:42.199][Format][TeX] Formatting LaTeX. The command is latexindent:["-c","%WS1%/","%WS1%/__latexindent_temp_t.tex","-y=defaultIndent: '    '"].
[09:46:42.305][Format][TeX] Formatted %WS1%/t.tex
[09:46:42.391][Extension] onDidSaveTextDocument triggered: file://%WS1%/t.tex
[09:46:42.391][Linter] ChkTeX lints root %WS1%/t.tex .
[09:46:42.392][Linter][ChkTeX] Linter for ChkTeX command The command is chktex:["-wall","-n22","-n30","-e16","-q","-f%f:%l:%c:%d:%k:%n:%m\n","%WS1%/t.tex"].
[09:46:42.408][Linter] Linter for root successfully finished in 0s 2ms
[09:46:42.409][Linter][ChkTeX] No .chktexrc file is found to determine TabSize.
[09:46:42.410][Linter][ChkTeX] Logged 0 messages.
[09:46:42.458][Cacher][Watcher] "change" emitted on %WS1%/t.tex .
[09:46:42.462][Cacher] Caching %WS1%/t.tex .
[09:46:42.464][Cacher] Updated inputs of %WS1%/t.tex .
[09:46:42.464][Cacher] Parse LaTeX AST: %WS1%/t.tex .
[09:46:42.465][Builder] Auto build started detecting the change of a file: %WS1%/t.tex .
[09:46:42.465][Event] AUTO_BUILD_INITIATED: {"type":"onChange","file":"%WS1%/t.tex"}
[09:46:42.465][Commander] BUILD command invoked.
[09:46:42.466][Commander] The document of the active editor: file://%WS1%/t.tex
[09:46:42.466][Commander] The languageId of the document: latex
[09:46:42.466][Commander] Building root file: %WS1%/t.tex
[09:46:42.466][Builder] Build root file %WS1%/t.tex
[09:46:42.467][Event] FILE_CHANGED: "%WS1%/t.tex"
[09:46:42.471][Cacher] Parsed LaTeX AST: %WS1%/t.tex .
[09:46:42.472][Cacher][Path] Calling kpsewhich to resolve article.cls .
[09:46:42.497][Cacher] Updated elements in 25.21 ms: %WS1%/t.tex .
[09:46:42.497][Event] FILE_PARSED: "%WS1%/t.tex"
[09:46:42.498][Structure] Structure force updated with 0 root sections for %WS1%/t.tex .
[09:46:42.498][Event] STRUCTURE_UPDATED
[09:46:42.500][Builder] outDir: %WS1% .
[09:46:42.501][Builder] Preparing to run recipe: latexmk x2.
[09:46:42.502][Builder] Prepared 2 tools.
[09:46:42.505][Builder] Recipe step 1 The command is latexmk:["-shell-escape","-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","-outdir=%WS1%","%WS1%/t"].
[09:46:42.505][Builder] env: {}
[09:46:42.505][Builder] root: %WS1%/t.tex
[09:46:42.506][Builder] cwd: %WS1%

[09:46:42.517][Builder] LaTeX build process spawned with PID 2055.
[09:46:42.704][Parser][TexLog] Logged 0 messages.
[09:46:42.705][Builder] Finished a step in recipe with PID 2055.
[09:46:42.706][Builder] Recipe step 2 The command is latexmk:["-shell-escape","-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","-outdir=%WS1%","%WS1%/t"].
[09:46:42.706][Builder] env: {}
[09:46:42.707][Builder] root: %WS1%/t.tex
[09:46:42.707][Builder] cwd: %WS1%
[09:46:42.719][Builder] LaTeX build process spawned with PID 2058.
[09:46:42.806][Builder] Finished a step in recipe with PID 2058.
[09:46:42.807][Builder] Successfully built %WS1%/t.tex .
[09:46:42.807][Event] BUILD_DONE
[09:46:47.858][Cacher][Watcher] "change" emitted on %WS1%/t.pdf after polling for 5001 ms.
[09:46:47.859][Event] FILE_CHANGED: "%WS1%/t.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.

Empty

Anything Else?

Add any other context about the problem below.

  • Modified example docker container setup mvp.tar.gz
James-Yu commented 11 months ago

Can you observe the same behavior without devcontainer?

iwishiwasaneagle commented 11 months ago

Yes, same behaviour.

I used:

"latex-workshop.docker.image.latex": "blang/latex:ubuntu",
"latex-workshop.docker.enabled": true

to test this outside of a devcontainer.

James-Yu commented 11 months ago

What about not using Docker? Docker support is not officially supported.

iwishiwasaneagle commented 11 months ago

What about not using Docker? Docker support is not officially supported.

I don't have that set up, and don't want to have the millions of supporting packages on my machine. Sorry

James-Yu commented 11 months ago

OK, I figured it. In your final step, you called latexmk, which will exit immediately because the document has been successfully compiled in the first latexmk. The extension detects that the last latexmk does not actually compile, so refreshing PDF is skipped. This logic can be improved.