James-Yu / LaTeX-Workshop

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

PDF viewer turns blank after refreshing when spreading is enabled #4415

Closed LinqLover closed 1 month ago

LinqLover commented 1 month ago

Pre-checks*

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

  • [ ] The issue has not been reported in this repository. No, it has been mentioned: #4300 (closed as not reproducible) and https://github.com/James-Yu/LaTeX-Workshop/pull/4295#issuecomment-2188891983 (issue there was apparently fixed)
  • [ ] 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: Linux x64 6.5.0-45-generic (Ubuntu 22)
  • Visual Studio Code Version: 1.93.1
  • LaTeX Workshop Version: v10.4.1
  • TeX Distribution Version: TeX Live 2022

The Issue*

Please briefly describe the issue you come across.

  • PDF viewer (in browser or in VS Code tab) becomes blank after refreshing document when spreading (Odd Spreads/Even Spreads) is enabled

Reproduction Steps

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

  1. MWE:
    % !TeX root = test.tex
    \documentclass[twoside]{scrbook}
    \usepackage{blindtext}
    \begin{document}
    \Blinddocument
    \end{document}
  2. Save
  3. Command latex-workshop.view or latex-workshop.viewInBrowser
  4. In the menu at the right top corner, select "Odd Spreads" or "Even Spreads"
  5. Command latex-workshop.refresh-viewer
  6. Do some scrolling in the PDF viewer
  7. Now, the viewer "crashes": it turns blanks and the scroll bar is lost. F5 in the browser helps but then the viewer state (scroll position, view mode, etc.) is lost. See errors below.

Expected Behavior

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

  • The file should just be updated

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.

[22:20:25.279][Logger] New log placeholder %WS1% registered for /home/christoph/git/semexp-thesis .
[22:20:25.279][Extension] Initializing LaTeX Workshop.
[22:20:25.455][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_LATEX: ""
[22:20:25.456][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_PATH: "docker"
[22:20:25.543][Server] Creating LaTeX Workshop http and websocket server.
[22:20:25.675][Format][Bib] Bibtex format config: {"tab":"  ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]}
[22:20:25.739][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":41377} .
[22:20:25.974][Extension] Extension root: /home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1
[22:20:25.974][Extension] $PATH: /home/christoph/.local/bin:/home/christoph/bin:/home/christoph/.local/bin:/home/christoph/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/christoph/bin:/home/christoph/development/flutter/bin:/home/christoph/bin
[22:20:25.975][Extension] $SHELL: /bin/bash
[22:20:25.975][Extension] $LANG: en_US.UTF-8
[22:20:25.975][Extension] $LC_ALL: undefined
[22:20:25.976][Extension] process.platform: linux
[22:20:25.976][Extension] process.arch: x64
[22:20:25.976][Extension] vscode.env.appName: Visual Studio Code
[22:20:25.977][Extension] vscode.env.remoteName: undefined
[22:20:25.977][Extension] vscode.env.uiKind: 1
[22:20:25.991][Config] latex-workshop.latex.autoBuild.run: "onSave" .
[22:20:25.992][Config] latex-workshop.latex.autoBuild.cleanAndRetry.enabled: false .
[22:20:26.077][Config] latex-workshop.message.warning.show: false .
[22:20:26.077][Config] latex-workshop.message.error.show: false .
[22:20:26.087][Config] latex-workshop.bind.enter.key: false .
[22:20:26.137][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{","}"]
[22:20:26.141][Root] Current workspace folders: ["file://%WS1%"]
[22:20:26.141][Root] Try finding root from magic comment.
[22:20:26.142][Root] Found magic root %WS1%/test/test.tex
[22:20:26.143][Extension] LaTeX Workshop initialized.
[22:20:26.235][Server] validOrigin is http://127.0.0.1:41377
[22:20:26.897][Root] Found looped magic root %WS1%/test/test.tex .
[22:20:26.898][Root] Root file changed: from %WS1%/test/test.tex to %WS1%/test/test.tex, langID latex . Refresh dependencies
[22:20:26.898][Event] ROOT_FILE_CHANGED: "%WS1%/test/test.tex"
[22:20:26.899][Cacher][Watcher] Reset.
[22:20:26.899][Cacher][Watcher] Reset.
[22:20:26.902][Cacher] Adding %WS1%/test/test.tex .
[22:20:26.903][Cacher][Watcher] Watched file://%WS1%/test/test.tex with a new .* watcher on %WS1%/test .
[22:20:26.904][Event] FILE_WATCHED: "file://%WS1%/test/test.tex"
[22:20:26.906][Cacher] Caching %WS1%/test/test.tex .
[22:20:26.906][Event] ROOT_FILE_SEARCHED
[22:20:27.477][Cacher] Updated inputs of %WS1%/test/test.tex .
[22:20:27.477][Cacher] Parse LaTeX AST: %WS1%/test/test.tex .
[22:20:27.495][Cacher] Parsed LaTeX AST in 17.24 ms: %WS1%/test/test.tex .
[22:20:27.496][File] Calling kpsewhich to resolve scrbook.cls .
[22:20:27.655][File] kpsewhich returned with '/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrbook.cls'.
[22:20:27.658][Cacher] Updated elements in 161.90 ms: %WS1%/test/test.tex .
[22:20:27.659][Event] FILE_PARSED: "%WS1%/test/test.tex"
[22:20:27.675][Structure] Structure force updated with 0 root sections for %WS1%/test/test.tex .
[22:20:27.678][Event] STRUCTURE_UPDATED
[22:20:28.113][Cacher] Parsing .fls %WS1%/test/test.fls .
[22:20:28.806][Cacher] Adding /home/christoph/.texlive2021/texmf-var/fonts/pk/ljfour/jknappen/ec/tcrm1095.600pk .
[22:20:28.807][Cacher][Watcher] Watched file:///home/christoph/.texlive2021/texmf-var/fonts/pk/ljfour/jknappen/ec/tcrm1095.600pk with a new .* watcher on /home/christoph/.texlive2021/texmf-var/fonts/pk/ljfour/jknappen/ec .
[22:20:28.807][Event] FILE_WATCHED: "file:///home/christoph/.texlive2021/texmf-var/fonts/pk/ljfour/jknappen/ec/tcrm1095.600pk"
[22:20:28.819][Cacher] Found .aux %WS1%/test/test.aux from .fls %WS1%/test/test.fls , parsing.
[22:20:28.922][Cacher] Parsed .aux %WS1%/test/test.aux .
[22:20:28.923][Cacher] Parsed .fls %WS1%/test/test.fls .
[22:20:35.426][Commander] VIEW command invoked with mode: browser.
[22:20:35.426][Root] Current workspace folders: ["file://%WS1%"]
[22:20:35.426][Root] Try finding root from magic comment.
[22:20:35.427][Root] Found magic root %WS1%/test/test.tex
[22:20:35.429][Root] Found looped magic root %WS1%/test/test.tex .
[22:20:35.429][Root] Keep using the same root file: %WS1%/test/test.tex
[22:20:35.429][Event] ROOT_FILE_SEARCHED
[22:20:35.430][Event] STRUCTURE_UPDATED
[22:20:35.446][Cacher][Watcher] Watched file://%WS1%/test/test.pdf with a new .pdf watcher on %WS1%/test .
[22:20:35.447][Event] FILE_WATCHED: "file://%WS1%/test/test.pdf"
[22:20:35.447][Viewer] Serving PDF file at http://127.0.0.1:41377/viewer.html?file=pdf..ZmlsZSUzQSUyRiUyRiUyRmhvbWUlMkZjaHJpc3RvcGglMkZnaXQlMkZzZW1leHAtdGhlc2lzJTJGdGVzdCUyRnRlc3QucGRm
[22:20:35.523][Viewer] Open PDF viewer for file://%WS1%/test/test.pdf
[22:20:37.868][Viewer] Handle data type: open
[22:20:37.895][Server] Preview PDF file: file://%WS1%/test/test.pdf
[22:20:38.269][Viewer] Handle data type: loaded
[22:20:38.270][Event] VIEWER_PAGE_LOADED
[22:21:26.892][Extension] onDidSaveTextDocument triggered: file://%WS1%/test/test.tex
[22:21:26.894][Build] Auto build started on saving file: %WS1%/test/test.tex .
[22:21:26.894][Event] AUTO_BUILD_INITIATED: {"type":"onSave","file":"%WS1%/test/test.tex"}
[22:21:26.895][Build] The document of the active editor: file://%WS1%/test/test.tex
[22:21:26.895][Build] The languageId of the document: latex
[22:21:26.896][Build] Building root file: %WS1%/test/test.tex
[22:21:26.896][Build][Recipe] Build root file %WS1%/test/test.tex
[22:21:26.980][Cacher][Watcher] "change" emitted on file://%WS1%/test/test.tex.
[22:21:26.983][Cacher] Caching %WS1%/test/test.tex .
[22:21:26.984][Event] FILE_CHANGED: "file://%WS1%/test/test.tex"
[22:21:27.822][Build][Recipe] Preparing to run recipe: latexmk.
[22:21:27.822][Build][Recipe] Prepared 1 tools.
[22:21:27.853][Build][Recipe] outDir: %WS1%/test .
[22:21:27.856][Build] Recipe step 1 The command is latexmk:["-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","-outdir=%WS1%/test","%WS1%/test/test"].
[22:21:27.856][Build] env: {}
[22:21:27.857][Build] root: %WS1%/test/test.tex
[22:21:27.858][Build] cwd: %WS1%/test
[22:21:27.881][Build] LaTeX build process spawned with PID 281994.
[22:21:27.952][Cacher] Updated inputs of %WS1%/test/test.tex .
[22:21:27.953][Cacher] Parse LaTeX AST: %WS1%/test/test.tex .
[22:21:28.045][Cacher] Parsed LaTeX AST in 91.13 ms: %WS1%/test/test.tex .
[22:21:28.046][File] kpsewhich cache hit on scrbook.cls: /usr/share/texlive/texmf-dist/tex/latex/koma-script/scrbook.cls .
[22:21:28.047][Cacher] Updated elements in 1.75 ms: %WS1%/test/test.tex .
[22:21:28.048][Event] FILE_PARSED: "%WS1%/test/test.tex"
[22:21:28.049][Structure] Structure force updated with 0 root sections for %WS1%/test/test.tex .
[22:21:28.050][Event] STRUCTURE_UPDATED
[22:21:28.942][Parser][TexLog] Logged 2 messages.
[22:21:28.944][Build] Finished a step in recipe with PID 281994.
[22:21:28.945][Build] Successfully built %WS1%/test/test.tex .
[22:21:28.945][Event] BUILD_DONE
[22:21:28.946][Viewer] Call refreshExistingViewer: file://%WS1%/test/test.pdf .
[22:21:28.946][Viewer] Refresh PDF viewer: file://%WS1%/test/test.pdf
[22:21:29.008][Cacher] Parsing .fls %WS1%/test/test.fls .
[22:21:29.015][Server] Preview PDF file: file://%WS1%/test/test.pdf
[22:21:29.149][Cacher] Found .aux %WS1%/test/test.aux from .fls %WS1%/test/test.fls , parsing.
[22:21:29.167][Cacher] Parsed .aux %WS1%/test/test.aux .
[22:21:29.167][Cacher] Parsed .fls %WS1%/test/test.fls .

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 281580.
log.ts:429  WARN [redhat.vscode-yaml]: Cannot register 'redhat.telemetry.enabled'. This property is already registered.
log.ts:419  INFO [sndst00m.vscode-native-svg-preview]: Command `svgPreview.showPreview` already registered by Svg Preview (SimonSiefke.svg-preview)
log.ts:419  INFO [sndst00m.vscode-native-svg-preview]: Command `svgPreview.showPreviewToSide` already registered by Svg Preview (SimonSiefke.svg-preview)
webviewElement.ts:486 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:486
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.java.
Old grammar file: file:///usr/share/code/resources/app/extensions/java/syntaxes/java.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/asf.apache-netbeans-java-23.0.0/syntaxes/java.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/TeX.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/LaTeX.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/Bibtex.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/markdown-latex-combined.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/cpp-grammar-bailout.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.macro.
Old grammar file: file:///usr/share/code/resources/app/extensions/cpp/syntaxes/cpp.embedded.macro.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/jeff-hykin.better-cpp-syntax-1.17.2/autogenerated/cpp.embedded.macro.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.
Old grammar file: file:///usr/share/code/resources/app/extensions/cpp/syntaxes/cpp.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/jeff-hykin.better-cpp-syntax-1.17.2/autogenerated/cpp.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.gdscript.
Old grammar file: file:///home/christoph/.vscode/extensions/geequlim.godot-tools-2.2.0/syntaxes/GDScript.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/jjkim.gdscript-0.0.2/syntaxes/gdscript.tmLanguage
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.sql.
Old grammar file: file:///usr/share/code/resources/app/extensions/sql/syntaxes/sql.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/ms-ossdata.vscode-postgresql-0.3.0/syntaxes/SQL.plist
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.yaml.
Old grammar file: file:///usr/share/code/resources/app/extensions/yaml/syntaxes/yaml.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/redhat.vscode-yaml-1.14.0/syntaxes/yaml.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/Bibtex.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/torn4dom4n.latex-support-3.10.0/grammars/Bibtex.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/LaTeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/torn4dom4n.latex-support-3.10.0/grammars/LaTeX.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/TeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/torn4dom4n.latex-support-3.10.0/grammars/TeX.json
register @ TMScopeRegistry.ts:46
log.ts:439   ERR [Extension Host] (node:281580) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `exe --trace-deprecation ...` to show where the warning was created)
console.ts:137 [Extension Host] (node:281580) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `exe --trace-deprecation ...` to show where the warning was created)
C @ console.ts:137
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.java.
Old grammar file: file:///usr/share/code/resources/app/extensions/java/syntaxes/java.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/asf.apache-netbeans-java-23.0.0/syntaxes/java.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/TeX.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/LaTeX.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/Bibtex.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/markdown-latex-combined.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex.
Old grammar file: file:///usr/share/code/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/cpp-grammar-bailout.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.macro.
Old grammar file: file:///usr/share/code/resources/app/extensions/cpp/syntaxes/cpp.embedded.macro.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/jeff-hykin.better-cpp-syntax-1.17.2/autogenerated/cpp.embedded.macro.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.
Old grammar file: file:///usr/share/code/resources/app/extensions/cpp/syntaxes/cpp.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/jeff-hykin.better-cpp-syntax-1.17.2/autogenerated/cpp.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.gdscript.
Old grammar file: file:///home/christoph/.vscode/extensions/geequlim.godot-tools-2.2.0/syntaxes/GDScript.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/jjkim.gdscript-0.0.2/syntaxes/gdscript.tmLanguage
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.sql.
Old grammar file: file:///usr/share/code/resources/app/extensions/sql/syntaxes/sql.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/ms-ossdata.vscode-postgresql-0.3.0/syntaxes/SQL.plist
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.yaml.
Old grammar file: file:///usr/share/code/resources/app/extensions/yaml/syntaxes/yaml.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/redhat.vscode-yaml-1.14.0/syntaxes/yaml.tmLanguage.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/Bibtex.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/torn4dom4n.latex-support-3.10.0/grammars/Bibtex.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/LaTeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/torn4dom4n.latex-support-3.10.0/grammars/LaTeX.json
register @ TMScopeRegistry.ts:46
TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: file:///home/christoph/.vscode/extensions/james-yu.latex-workshop-10.4.1/syntax/TeX.tmLanguage.json.
New grammar file: file:///home/christoph/.vscode/extensions/torn4dom4n.latex-support-3.10.0/grammars/TeX.json
register @ TMScopeRegistry.ts:46
console.ts:137 [Extension Host] "go-to-character-position" is active
console.ts:137 [Extension Host] vscode-vibrancy is active!
mainThreadExtensionService.ts:107 Activating extension 'gitpod.gitpod-remote-ssh' failed: 14 UNAVAILABLE: No connection established.
$onExtensionActivationError @ mainThreadExtensionService.ts:107
log.ts:429  WARN [gitpod-remote-ssh]: Couldn't find message for key openBrowser.
log.ts:429  WARN [gitpod-remote-ssh]: Couldn't find message for key openPreview.
log.ts:429  WARN [gitpod-remote-ssh]: Couldn't find message for key makeHTTPS.
log.ts:429  WARN [gitpod-remote-ssh]: Couldn't find message for key makeHTTP.
log.ts:429  WARN [csharp]: Couldn't find message for key configuration.dotnet.unitTests.runSettingsPath.markdownDescription.
log.ts:419  INFO [perf] Render performance baseline is 36ms
console.ts:137 [Extension Host] [relatedFiles] unknown language latex
C @ console.ts:137
console.ts:137 [Extension Host] ApplicationInsights:CorrelationIdManager Array(1)
C @ console.ts:137
webviewElement.ts:486 An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing.
mountTo @ webviewElement.ts:486
138Third-party cookie will be blocked. Learn more in the Issues tab.
viewer.mjs:11237 Unable to initialize viewer TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
at globalThis.lwRenderSync (refresh.js:150:30)
at async viewer.mjs:11168:7
(anonymous) @ viewer.mjs:11237
viewer.mjs:13573 An error occurred while loading the PDF.

PDF.js v4.6.82 (build: 9b541910f) Message: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'. _otherError @ viewer.mjs:13573 webviewCommands.ts:32 Using standard dev tools to debug iframe based webview viewer.mjs:121 offsetParent is not set -- cannot scroll



FWIW:
![image](https://github.com/user-attachments/assets/b00aaf90-22bc-42ff-9730-fa3e6a60801f)

### Chrome Dev Console (Browser Viewer)

<div tabindex="-1" class="console-group console-group-messages" style="box-sizing: border-box; min-width: 0px; min-height: 0px; position: relative;"><div tabindex="-1" class="console-message-wrapper console-from-api console-error-level console-selected" jslog="Item; context: console-message; track: click, keydown: ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Enter|Space|Home|End" role="log" aria-label="Unable to initialize viewer" style="box-sizing: border-box; min-width: 0px; min-height: 0px; display: flex; flex-direction: column; margin: 4px; border-radius: 5px; --console-color-black: #000; --console-color-red: #a00; --console-color-green: #0a0; --console-color-yellow: #a50; --console-color-blue: #00a; --console-color-magenta: #a0a; --console-color-cyan: #0aa; --console-color-gray: #aaa; --console-color-darkgray: #555; --console-color-lightred: #f55; --console-color-lightgreen: #5f5; --console-color-lightyellow: #ff5; --console-color-lightblue: #55f; --console-color-ightmagenta: #f5f; --console-color-lightcyan: #5ff; --console-color-white: #fff; background-color: var(--sys-color-surface-error); --message-corner-rounder-background: var(--sys-color-surface-error);"><div class="console-row-wrapper" style="box-sizing: border-box; min-width: 0px; min-height: 0px; display: flex; flex-direction: row;"><div class="console-message" style="box-sizing: border-box; min-width: 0px; min-height: 17px; clear: right; position: relative; padding: 3px 22px 1px 0px; margin-left: 24px; flex: 1 1 auto; display: flex;"><div class="console-message-stack-trace-toggle" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 1 1 auto; display: flex; flex-direction: row; align-items: flex-start; margin-top: -1px;"><div class="console-message-stack-trace-wrapper" aria-label="viewer.mjs:11237 Unable to initialize viewer TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
    at globalThis.lwRenderSync (refresh.js:150:30)
    at async viewer.mjs:11168:7 Stack table expanded" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 1 1 auto; display: flex; flex-direction: column; align-items: stretch;"><div aria-expanded="true" tabindex="-1" style="box-sizing: border-box; min-width: 0px; min-height: 0px; outline-width: 0px; flex: 0 0 auto;"><span class="source-code" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--source-code-font-family); white-space: pre-wrap; font-size: var(--source-code-font-size) !important; line-height: 1.2;"><span class="console-message-anchor" style="box-sizing: border-box; min-width: 0px; min-height: 0px; float: right; text-align: right; max-width: 100%; margin-left: 4px;"><button class="devtools-link text-button link-style invalid-link" jslog="Link; context: script-location; track: click" tabindex="-1" title="http://127.0.0.1:41377/viewer/viewer.mjs:11237" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--text-disabled); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: none; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis;"><br class="Apple-interchange-newline">viewer.mjs:11237</button> </span><span class="console-message-text" style="box-sizing: border-box; min-width: 0px; min-height: 0px; color: var(--override-error-text-color) !important;">Unable to initialize viewer <span class="object-value-error source-code" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--source-code-font-family); white-space: pre-wrap; font-size: var(--source-code-font-size) !important; line-height: 1.2;"><span style="box-sizing: border-box; min-width: 0px; min-height: 0px;">TypeError: Failed to execute 'removeChild' on 'Node': parameter 1 is not of type 'Node'.
<span style="box-sizing: border-box; min-width: 0px; min-height: 0px;">    at globalThis.lwRenderSync (<button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://127.0.0.1:41377/out/viewer/components/refresh.js:150:30" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">refresh.js:150:30</button>)
</span><span style="box-sizing: border-box; min-width: 0px; min-height: 0px;">    at async <button class="devtools-link text-button link-style" jslog="Link; context: script-location; track: click" role="link" tabindex="-1" title="http://127.0.0.1:41377/viewer/viewer.mjs:11168:7" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--sys-color-primary); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: underline; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; word-break: break-all;">viewer.mjs:11168:7</button></span></span></span></span></span></div><div class="" role="group" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 0 0 auto;"><span class="monospace stack-preview-container width-constrained" style="display: inline-block; --monospace-font-size: 11px; --monospace-font-family: &quot;Noto Sans Mono&quot;,&quot;DejaVu Sans Mono&quot;,monospace; --source-code-font-size: 11px; --source-code-font-family: &quot;Noto Sans Mono&quot;,&quot;DejaVu Sans Mono&quot;,monospace; width: 380px; box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--monospace-font-family); font-size: var(--monospace-font-size) !important;">
  | (anonymous) | @ | viewer.mjs:11237
-- | -- | -- | --

</span></div></div></div></div></div></div><div tabindex="-1" class="console-message-wrapper console-from-api console-error-level" jslog="Item; context: console-message; track: click, keydown: ArrowUp|ArrowDown|ArrowLeft|ArrowRight|Enter|Space|Home|End" role="log" aria-label="offsetParent is not set -- cannot scroll" style="box-sizing: border-box; min-width: 0px; min-height: 0px; display: flex; flex-direction: column; margin: 4px; border-radius: 5px; --console-color-black: #000; --console-color-red: #a00; --console-color-green: #0a0; --console-color-yellow: #a50; --console-color-blue: #00a; --console-color-magenta: #a0a; --console-color-cyan: #0aa; --console-color-gray: #aaa; --console-color-darkgray: #555; --console-color-lightred: #f55; --console-color-lightgreen: #5f5; --console-color-lightyellow: #ff5; --console-color-lightblue: #55f; --console-color-ightmagenta: #f5f; --console-color-lightcyan: #5ff; --console-color-white: #fff; background-color: var(--sys-color-surface-error); --message-corner-rounder-background: var(--sys-color-surface-error);"><div class="console-row-wrapper" style="box-sizing: border-box; min-width: 0px; min-height: 0px; display: flex; flex-direction: row;"><div class="console-message" style="box-sizing: border-box; min-width: 0px; min-height: 17px; clear: right; position: relative; padding: 3px 22px 1px 0px; margin-left: 24px; flex: 1 1 auto; display: flex;"><devtools-icon role="presentation" name="cross-circle-filled" class="message-level-icon" aria-label="Error" style="flex: 1 1 auto; display: inline-block; width: 14px; height: 14px; color: var(--icon-error); vertical-align: sub; position: absolute; box-sizing: border-box; min-width: 0px; min-height: 0px; left: -17px; top: 2px; user-select: none;"><span style="display: block; width: 14px; height: 14px; background-color: currentcolor; mask: var(--icon-url) center /contain no-repeat; --icon-url: var(--image-file-cross-circle-filled);"></span></devtools-icon><div class="console-message-stack-trace-toggle" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 1 1 auto; display: flex; flex-direction: row; align-items: flex-start; margin-top: -1px;"><div class="console-message-stack-trace-wrapper" aria-label=" offsetParent is not set -- cannot scroll Stack table collapsed" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 1 1 auto; display: flex; flex-direction: column; align-items: stretch;"><div aria-expanded="false" tabindex="-1" style="box-sizing: border-box; min-width: 0px; min-height: 0px; flex: 0 0 auto;"><devtools-icon role="presentation" name="triangle-right" class="console-message-expand-icon" style="flex-grow: 0; flex-shrink: 0; display: inline-block; width: 14px; height: 14px; color: var(--icon-default); vertical-align: baseline; position: relative; box-sizing: border-box; min-width: 0px; min-height: 0px; margin-bottom: -4px;"><span style="display: block; width: 14px; height: 14px; background-color: currentcolor; mask: var(--icon-url) center /contain no-repeat; --icon-url: var(--image-file-triangle-right);"></span></devtools-icon><span class="source-code" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--source-code-font-family); white-space: pre-wrap; font-size: var(--source-code-font-size) !important; line-height: 1.2;"><span class="console-message-anchor" style="box-sizing: border-box; min-width: 0px; min-height: 0px; float: right; text-align: right; max-width: 100%; margin-left: 4px;"><button class="devtools-link text-button link-style invalid-link" jslog="Link; context: script-location; track: click" tabindex="-1" title="http://127.0.0.1:41377/viewer/viewer.mjs:121" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font: inherit; margin: 0px; height: unset; border: none; border-radius: 2px; padding: 0px !important; color: var(--text-disabled); background: none; flex: 0 0 auto; white-space: nowrap; text-decoration: none; outline-offset: 2px; outline: none; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis;">viewer.mjs:121</button> </span><span class="console-message-text" style="box-sizing: border-box; min-width: 0px; min-height: 0px; color: var(--override-error-text-color) !important;">offsetParent is not set -- cannot scroll</span></span></div></div></div></div></div></div></div><div aria-hidden="true" style="box-sizing: border-box; min-width: 0px; min-height: 0px; height: 0px; color: transparent;"></div><div class="source-code" id="console-prompt" style="box-sizing: border-box; min-width: 0px; min-height: 0px; font-family: var(--source-code-font-family); white-space: pre-wrap; font-size: var(--source-code-font-size) !important; clear: right; position: relative; margin: 0px 22px 0px 20px;"><div class="widget" jslog="TextField; context: console-prompt; track: change, keydown: Enter|ArrowUp|ArrowDown|PageUp" style="box-sizing: border-box; min-width: 0px; min-height: 0px; position: relative; flex: 1 1 auto; contain: style;"><div class="console-prompt-editor-container" style="box-sizing: border-box; min-width: 0px; min-height: 21px;"><devtools-text-editor style="box-sizing: border-box; min-width: 0px; min-height: 0px;"><div class="cm-editor ͼ1 ͼ2 ͼ4 ͼ5" style="box-sizing: border-box; flex-direction: column; position: relative !important; display: flex !important; color: color: var(--sys-color-on-subtle); cursor: auto;"><div class="cm-announced" aria-live="polite" style="position: fixed; top: -10000px;"></div><div tabindex="-1" class="cm-scroller" style="font-family: var(--source-code-font-family); line-height: 1.4em; height: 23.4062px; overflow-x: auto; position: relative; z-index: 0; display: flex !important; align-items: flex-start !important; font-size: var(--source-code-font-size);"><div spellcheck="false" autocorrect="off" autocapitalize="off" translate="no" contenteditable="true" class="cm-content cm-lineWrapping" role="textbox" aria-multiline="true" aria-label="Console prompt" data-language="javascript" aria-autocomplete="list" style="margin: 0px; flex-grow: 2; flex-shrink: 1; display: block; white-space: break-spaces; overflow-wrap: anywhere; box-sizing: border-box; min-height: 100%; padding: 4px 0px; outline: none; word-break: break-word; caret-color: transparent !important; line-height: 1.4em; -webkit-user-modify: read-write-plaintext-only; tab-size: 4;"><div class="cm-line" style="display: block; padding: 0px 2px 0px 6px; caret-color: transparent !important;"><br></div></div><div class="cm-layer cm-layer-above cm-cursorLayer" aria-hidden="true" style="position: absolute; left: 0px; top: 0px; contain: size style; pointer-events: none; z-index: 150; animation-duration: 1200ms; animation-name: cm-blink2;"></div><div class="cm-layer cm-selectionLayer" aria-hidden="true" style="position: absolute; left: 0px; top: 0px; contain: size style; z-index: -2;"></div></div></div></devtools-text-editor></div><div class="console-eager-preview" style="box-sizing: border-box; min-width: 0px; min-height: 0px; padding-bottom: 2px; opacity: 0.6; position: relative;"><div class="console-eager-inner-preview" style="box-sizing: border-box; min-width: 0px; min-height: 0px; text-overflow: ellipsis; overflow: hidden; margin-left: 4px; height: 0px; white-space: nowrap; opacity: 0; color: rgb(31, 31, 31); font-family: &quot;Noto Sans Mono&quot;, &quot;DejaVu Sans Mono&quot;, monospace; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"></div><devtools-icon role="presentation" name="chevron-left-dot" class="preview-result-icon" style="flex-grow: 0; flex-shrink: 0; display: inline-block; width: 16px; height: 16px; color: var(--icon-default); vertical-align: sub; position: absolute; box-sizing: border-box; min-width: 0px; min-height: 0px; left: -13px; top: -1px; opacity: 0; font-family: &quot;Noto Sans Mono&quot;, &quot;DejaVu Sans Mono&quot;, monospace; font-size: 11px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><br class="Apple-interchange-newline">
LinqLover commented 1 month ago

Here is another observation that is possibly linked to or caused by the above, so I will post it here, but of course it can still be moved into a different issue:

% !TeX root = test.tex
\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{pdflscape}
\begin{document}

\blindtext
\clearpage
\blindtext
\clearpage
\blindtext
\clearpage
\blindtext
\clearpage
%\begin{landscape}
\blindtext
%\end{landscape}
\clearpage

\end{document}
  1. Build this, open in viewer, turn on Even Spreads (as above)
  2. Uncomment the landscape environment-related lines and save to rebuild
  3. PDF in viewer turns blank (as above)
  4. Use the menu to switch to a Odd Spreads or any other option
  5. Now, the PDF can be read again, but the final page is incorrectly displayed as a portrait page (with text that overlaps its bounds) until you refresh the page. When zooming out, I can also very briefly see a distorted version of the text.

image

Distorted during zooming:

image

quoc-ho commented 1 month ago

This seems to be caused by a strange reason which persists even when the viewer is not in spread mode. I observed this problem when there are multiple pdfs opened and the one being refreshed is not currently in view. To reproduce, compile the tex file (with the pdf hidden) several times with minor changes. Then after clicking on the pdf tab for that file again, one will observe this problem.

It seems that VS Code (or Chrome in general) does some optimization by not letting JS run fully when a tab is not visible. So, the PDF reloading sequence is messed up, and our code injection to delete pages, etc., does not work correctly. When this happens, the new pages are appended, but the old ones aren't deleted.

Meanwhile @tamuratak implemented a very elegant way to remove flicker using a mask with the old content copied and then remove the mask once the page has been loaded. It is much less invasive than what we have now. https://github.com/tamuratak/latex-toybox?tab=readme-ov-file#true-flicker-free-reloading @tamuratak Can we adapt your code? @James-Yu What do you think about replacing what we have with this new implementation?

James-Yu commented 1 month ago

I am fine with adapting to the new logic as long as license permits. However, I am not working on the viewing part. Would you kindly take the role? @quoc-ho

quoc-ho commented 1 month ago

@James-Yu Great! I'm happy to look into it, but most likely in the winter, after the semester is over. I'm a bit swamped at the moment.

James-Yu commented 1 month ago

That would be awesome! I’ll check the code shortly and see if it is a large work or not.

quoc-ho commented 1 month ago

@James-Yu I took a look a while ago, and it seems that it's actually less than what we had to do in our implementation.

LinqLover commented 1 month ago

Great, thank you for all the swift fixes! Can I ask when these changes are usually live in the VS Code Marketplace? :)