James-Yu / LaTeX-Workshop

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

Three dot in the breadcrumbs/structure view outside a structure commands #3983

Closed AVAtarMod closed 1 year ago

AVAtarMod commented 1 year ago

Pre-checks*

Environment*

The Issue*

If position of the text editor's cursor outside chapter,section and other structure commands, breadcrumbs structure bar shows ... instead of chapter. See screenshot below (in this MWE I used only section, but on more complex structure with chapter, subsection, subsubsection and others I see same behavior) : image

On screenshot cursor placed on 6 line, in the breadcrumbs after test.tex > we can see three dot (...)

Reproduction Steps

  1. Create file with following content:
    \documentclass{article}
    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \begin{document}
    \section{First chapter}
    Text here
    \end{document}
  2. Open created file with LaTeX Workshop version listed above.
  3. Place cursor outside section command, but before document end.
  4. See breadcrumbs structure view content

Expected Behavior

Current structure object name same as when cursor position on it structure command. On screenshot cursor position on section command, and breadcrumbs show have correct content: image

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.

[14:06:18.367][Logger] New log placeholder %WS1% registered for /home/username/Latex .
[14:06:18.367][Config] latex-workshop.latex.tools: [{"name":"latexmk","command":"latexmk","args":["-synctex=1","-interaction=nonstopmode","-file-line-error","-recorder","-pdf","-outdir=%OUTDIR%","%DOC%"],"env":{}},{"name":"lualatexmk","command":"latexmk","args":["-synctex=1","-interaction=nonstopmode","-file-line-error","-lualatex","-recorder","-outdir=%OUTDIR%","%DOC%"],"env":{}},{"name":"xelatexmk","command":"latexmk","args":["-synctex=1","-interaction=nonstopmode","-file-line-error","-xelatex","-recorder","-outdir=%OUTDIR%","%DOC%"],"env":{}},{"name":"latexmk_rconly","command":"latexmk","args":["%DOC%"],"env":{}},{"name":"pdflatex","command":"pdflatex","args":["-synctex=1","-interaction=nonstopmode","-file-line-error","-recorder","%DOC%"],"env":{}},{"name":"bibtex","command":"bibtex","args":["%DOCFILE%"],"env":{}},{"name":"rnw2tex","command":"Rscript","args":["-e","knitr::opts_knit$set(concordance = TRUE); knitr::knit('%DOCFILE_EXT%')"],"env":{}},{"name":"jnw2tex","command":"julia","args":["-e","using Weave; weave(\"%DOC_EXT%\", doctype=\"tex\")"],"env":{}},{"name":"jnw2texmintex","command":"julia","args":["-e","using Weave; weave(\"%DOC_EXT%\", doctype=\"texminted\")"],"env":{}},{"name":"tectonic","command":"tectonic","args":["--synctex","--keep-logs","%DOC%.tex"],"env":{}}] .
[14:06:18.456][Config] latex-workshop.latex.outDir: "%DIR%/cache" .
[14:06:18.532][Config] latex-workshop.view.pdf.viewer: "external" .
[14:06:18.758][Config] latex-workshop.latexindent.args: ["-c","%DIR%/","%TMPFILE%","-y=defaultIndent: '%INDENT%'; lookForAlignDelims: tabular*: 1"] .
[14:06:18.974][Manager] Set $LATEXWORKSHOP_DOCKER_LATEX: ""
[14:06:19.051][Server] Creating LaTeX Workshop http and websocket server.
[14:06:19.138][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":34515} .
[14:06:19.235][Server] valdOrigin is http://127.0.0.1:34515
[14:06:19.240][Extension] Initializing LaTeX Workshop.
[14:06:19.241][Extension] Extension root: /home/username/.vscode-oss/extensions/james-yu.latex-workshop-9.13.4-universal
[14:06:19.241][Extension] $PATH: /usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
[14:06:19.242][Extension] $SHELL: /bin/bash
[14:06:19.242][Extension] $LANG: en_US.UTF-8
[14:06:19.242][Extension] $LC_ALL: undefined
[14:06:19.242][Extension] process.platform: linux
[14:06:19.243][Extension] process.arch: x64
[14:06:19.243][Extension] vscode.env.appName: VSCodium
[14:06:19.244][Extension] vscode.env.remoteName: undefined
[14:06:19.244][Extension] vscode.env.uiKind: 1
[14:06:19.245][Extension] LaTeX Workshop initialized.
[14:06:19.250][Format][Bib] Bibtex format config: {"tab":"  ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]}
[14:06:19.252][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{"]
[14:06:19.255][Manager] Current workspace folders: ["file://%WS1%"]
[14:06:19.267][Manager] Found root file from active editor: %WS1%/test.tex
[14:06:19.277][Manager] Root file changed: from undefined to %WS1%/test.tex
[14:06:19.278][Manager] Start to find all dependencies.
[14:06:19.280][Manager] Root file languageId: latex
[14:06:19.281][Event] ROOT_FILE_CHANGED: "%WS1%/test.tex"
[14:06:19.281][Cacher][Watcher] Reset.
[14:06:19.293][Cacher] Adding %WS1%/test.tex .
[14:06:19.297][Cacher][Watcher] Watched %WS1%/test.tex with a new watcher on %WS1% .
[14:06:19.297][Event] FILE_WATCHED: "%WS1%/test.tex"
[14:06:19.301][Cacher] Caching %WS1%/test.tex .
[14:06:19.317][Cacher] Updated inputs of %WS1%/test.tex .
[14:06:19.318][Cacher] Parse LaTeX AST: %WS1%/test.tex .
[14:06:19.318][Event] ROOT_FILE_SEARCHED
[14:06:19.347][Cacher] Parsed LaTeX AST: %WS1%/test.tex .
[14:06:19.347][Cacher][Path] Calling kpsewhich to resolve article.cls .
[14:06:19.401][Cacher] Updated elements in 54.24 ms: %WS1%/test.tex .
[14:06:19.402][Event] FILE_PARSED: "%WS1%/test.tex"
[14:06:19.403][Cacher] Parsing .fls %WS1%/cache/test.fls .
[14:06:19.408][Cacher] Found .aux %WS1%/test.tex from .fls %WS1%/cache/test.fls , parsing.
[14:06:19.409][Cacher] Parsed .aux %WS1%/test.tex .
[14:06:19.409][Cacher] Parsed .fls %WS1%/cache/test.fls .
[14:06:19.409][Structure] Structure force updated with 0 root sections for %WS1%/test.tex .
[14:06:19.410][Event] STRUCTURE_UPDATED
[14:22:01.614][Event] STRUCTURE_UPDATED

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.

WARN Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.vscode-selfhost-test-provider' wants API proposal 'testContinuousRun' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
workbench.desktop.main.js:620  WARN Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.remote-repositories' wants API proposal 'contribEditorGutterMenu' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
workbench.desktop.main.js:620  WARN Via 'product.json#extensionEnabledApiProposals' extension 'github.vscode-pull-request-github' wants API proposal 'contribEditorGutterMenu' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
workbench.desktop.main.js:620  WARN Via 'product.json#extensionEnabledApiProposals' extension 'ms-toolsai.jupyter' wants API proposal 'notebookControllerKind' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
workbench.desktop.main.js:1910 Overwriting grammar scope name to file mapping for scope text.tex.
Old grammar file: file:///usr/share/codium/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json.
New grammar file: file:///home/username/.vscode-oss/extensions/james-yu.latex-workshop-9.13.4-universal/syntax/TeX.tmLanguage.json
register @ workbench.desktop.main.js:1910
workbench.desktop.main.js:1910 Overwriting grammar scope name to file mapping for scope text.tex.latex.
Old grammar file: file:///usr/share/codium/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json.
New grammar file: file:///home/username/.vscode-oss/extensions/james-yu.latex-workshop-9.13.4-universal/syntax/LaTeX.tmLanguage.json
register @ workbench.desktop.main.js:1910
workbench.desktop.main.js:1910 Overwriting grammar scope name to file mapping for scope text.bibtex.
Old grammar file: file:///usr/share/codium/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json.
New grammar file: file:///home/username/.vscode-oss/extensions/james-yu.latex-workshop-9.13.4-universal/syntax/Bibtex.tmLanguage.json
register @ workbench.desktop.main.js:1910
workbench.desktop.main.js:1910 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined.
Old grammar file: file:///usr/share/codium/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.
New grammar file: file:///home/username/.vscode-oss/extensions/james-yu.latex-workshop-9.13.4-universal/syntax/markdown-latex-combined.tmLanguage.json
register @ workbench.desktop.main.js:1910
workbench.desktop.main.js:1910 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex.
Old grammar file: file:///usr/share/codium/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.
New grammar file: file:///home/username/.vscode-oss/extensions/james-yu.latex-workshop-9.13.4-universal/syntax/cpp-grammar-bailout.tmLanguage.json
register @ workbench.desktop.main.js:1910
workbench.desktop.main.js:620   ERR [/home/username/.vscode-oss/extensions/eamodio.gitlens-14.0.1-universal]: Extension is not compatible with Code 1.77.3. Extension requires: ^1.78.0.
workbench.desktop.main.js:620  INFO [perf] Render performance baseline is 59ms
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/base/parts/sandbox/electron-browser/preload.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/code/electron-sandbox/workbench/workbench.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/workbench/workbench.desktop.main.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/node_modules/vscode-textmate/release/main.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/node_modules/xterm/lib/xterm.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/base/worker/workerMain.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/editor/common/services/editorSimpleWorker.nls.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/workbench/services/languageDetection/browser/languageDetectionSimpleWorker.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/node_modules/@vscode/vscode-languagedetection/dist/lib/index.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/workbench/contrib/output/common/outputLinkComputer.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/base/worker/workerMain.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/editor/common/services/editorSimpleWorker.nls.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/650fc437e02159df39d99355a91b2e3b1f1220c5/core/vs/base/worker/workerMain.js.map: Fetch through target failed: Target not supported; Fallback: Unknown error
workbench.desktop.main.js:90 [Violation] 'requestAnimationFrame' handler took 91ms

Anything Else?

Related issues: #2961 Related PRs: #2967

James-Yu commented 1 year ago

Will look into it later.

jlelong commented 1 year ago

This is because the line range of sections is wrong.

Once the sections are properly nested in https://github.com/James-Yu/LaTeX-Workshop/blob/fe888d7c54d8db5cbda4671995d10f3d0b6a7f85/src/providers/structurelib/latex.ts#L30-L52, the ranges of every section must be recomputed. Prior to #3879, this was done by https://github.com/James-Yu/LaTeX-Workshop/blob/18bd1b4e66ce1c1e4a237c7bc73cebbf321f3b86/src/providers/structurelib/latex.ts#L520-L539

I may try to resurrect this function in the coming days.