James-Yu / LaTeX-Workshop

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

Using command palette to surround text has strange behaviour with $0/$1/.../$9 #4430

Closed DokterKaj closed 1 month ago

DokterKaj commented 1 month ago

Pre-checks*

Environment*

Please list the environment and version number if you are using VSCodium, Snap or Flatpack versions of Visual Studio Code, and/or Visual Studio Code Remote Containers/SSH/WSL.

  • Issue is also present in VSCodium 1.94.1 (deb package) on Linux Mint 22

The Issue*

Reproduction Steps

  1. Open a TeX file in VS Code with the extension enabled
  2. Type some text including $0/$1/.../$9 and highlight it
  3. Open the surround text pop-up (with Ctrl+L, Ctrl+W or otherwise) and pick one of the options

Expected Behavior

Logs

LaTeX Workshop Output*

Log ``` [22:05:26.371][Logger] New log placeholder %WS1% registered for c:\Users\DokterKaj\Documents\New folder . [22:05:26.371][Extension] Initializing LaTeX Workshop. [22:05:26.773][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_LATEX: "" [22:05:26.774][Build][Recipe] Set $LATEXWORKSHOP_DOCKER_PATH: "docker" [22:05:26.923][Server] Creating LaTeX Workshop http and websocket server. [22:05:27.227][Format][Bib] Bibtex format config: {"tab":" ","case":"lowercase","left":"{","right":"}","trailingComma":false,"sort":["key"],"alignOnEqual":true,"sortFields":false,"fieldsOrder":[],"firstEntries":["string","xdata"]} [22:05:27.401][Server] Server successfully started: {"address":"127.0.0.1","family":"IPv4","port":53284} . [22:05:27.439][Extension] Extension root: c:\Users\DokterKaj\.vscode\extensions\james-yu.latex-workshop-10.5.0 [22:05:27.440][Extension] $PATH: C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Eclipse Adoptium\jdk-8.0.312.7-hotspot\bin;C:\Program Files\Common Files\Oracle\Java\javapath;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\dotnet\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Calibre2\;C:\Program Files\Git\cmd;C:\Program Files (x86)\gnupg\bin;C:\Users\DokterKaj\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\DokterKaj\AppData\Local\Programs\Python\Python311\;C:\Users\DokterKaj\AppData\Local\Microsoft\WindowsApps;C:\Users\DokterKaj\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\DokterKaj\.dotnet\tools;C:\Users\DokterKaj\AppData\Roaming\npm;C:\Program Files\heroku\bin;C:\Users\DokterKaj\AppData\Local\GitHubDesktop\bin; [22:05:27.441][Extension] $SHELL: undefined [22:05:27.441][Extension] $LANG: undefined [22:05:27.441][Extension] $LC_ALL: undefined [22:05:27.442][Extension] process.platform: win32 [22:05:27.443][Extension] process.arch: x64 [22:05:27.443][Extension] vscode.env.appName: Visual Studio Code [22:05:27.444][Extension] vscode.env.remoteName: undefined [22:05:27.444][Extension] vscode.env.uiKind: 1 [22:05:27.535][Extension] Trigger characters for intellisense of LaTeX documents: ["\\",",","{","}"] [22:05:27.539][Root] Current workspace folders: ["file:///c:/Users/DokterKaj/Documents/New folder"] [22:05:27.539][Root] Try finding root from magic comment. [22:05:27.540][Extension] LaTeX Workshop initialized. [22:05:27.541][Root] Try finding root from active editor. [22:05:27.542][Root] Found root file from active editor: %WS1%\test.tex [22:05:27.542][Root] Root file changed: from %WS1%\test.tex to %WS1%\test.tex, langID latex . Refresh dependencies [22:05:27.542][Event] ROOT_FILE_CHANGED: "c:\\Users\\DokterKaj\\Documents\\New folder\\test.tex" [22:05:27.544][Cacher][Watcher] Reset. [22:05:27.544][Cacher][Watcher] Reset. [22:05:27.554][Cacher] Adding %WS1%\test.tex . [22:05:27.558][Cacher][Watcher] Watched file:///c:/Users/DokterKaj/Documents/New folder/test.tex with a new .* watcher on %WS1% . [22:05:27.558][Event] FILE_WATCHED: "file:///c:/Users/DokterKaj/Documents/New folder/test.tex" [22:05:27.562][Cacher] Caching %WS1%\test.tex . [22:05:27.564][Event] ROOT_FILE_SEARCHED [22:05:27.586][Server] validOrigin is http://127.0.0.1:53284 [22:05:27.745][Cacher] Updated inputs of %WS1%\test.tex . [22:05:27.745][Cacher] Parse LaTeX AST: %WS1%\test.tex . [22:05:27.764][Cacher] Parsed LaTeX AST in 19.03 ms: %WS1%\test.tex . [22:05:27.767][File] Calling kpsewhich to resolve article.cls . [22:05:27.939][File] kpsewhich returned with non-zero code 1. [22:05:27.943][Cacher] Updated elements in 177.50 ms: %WS1%\test.tex . [22:05:27.945][Event] FILE_PARSED: "c:\\Users\\DokterKaj\\Documents\\New folder\\test.tex" [22:05:27.955][Structure] Structure force updated with 0 root sections for %WS1%\test.tex . [22:05:27.957][Event] STRUCTURE_UPDATED ```

Developer Tools Console

Log ``` log.ts:419 INFO Started local extension host with pid 25740. TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/TeX.tmLanguage.json register @ TMScopeRegistry.ts:46 Uis @ TMGrammarFactory.ts:74 S @ textMateTokenizationFeatureImpl.ts:260 await in S (async) U @ textMateTokenizationFeatureImpl.ts:280 (anonymous) @ textMateTokenizationFeatureImpl.ts:118 get tokenizationSupport @ languages.ts:2158 j @ tokenizationRegistry.ts:146 resolve @ tokenizationRegistry.ts:140 getOrCreate @ tokenizationRegistry.ts:76 P @ textMateTokenizationFeatureImpl.ts:129 (anonymous) @ textMateTokenizationFeatureImpl.ts:82 d @ extensionsRegistry.ts:151 acceptUsers @ extensionsRegistry.ts:142 Hb @ abstractExtensionService.ts:1119 Eb @ abstractExtensionService.ts:1049 jb @ abstractExtensionService.ts:507 ib @ abstractExtensionService.ts:454 await in ib (async) (anonymous) @ nativeExtensionService.ts:139 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/LaTeX.tmLanguage.json register @ TMScopeRegistry.ts:46 Uis @ TMGrammarFactory.ts:74 S @ textMateTokenizationFeatureImpl.ts:260 await in S (async) U @ textMateTokenizationFeatureImpl.ts:280 (anonymous) @ textMateTokenizationFeatureImpl.ts:118 get tokenizationSupport @ languages.ts:2158 j @ tokenizationRegistry.ts:146 resolve @ tokenizationRegistry.ts:140 getOrCreate @ tokenizationRegistry.ts:76 P @ textMateTokenizationFeatureImpl.ts:129 (anonymous) @ textMateTokenizationFeatureImpl.ts:82 d @ extensionsRegistry.ts:151 acceptUsers @ extensionsRegistry.ts:142 Hb @ abstractExtensionService.ts:1119 Eb @ abstractExtensionService.ts:1049 jb @ abstractExtensionService.ts:507 ib @ abstractExtensionService.ts:454 await in ib (async) (anonymous) @ nativeExtensionService.ts:139 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/Bibtex.tmLanguage.json register @ TMScopeRegistry.ts:46 Uis @ TMGrammarFactory.ts:74 S @ textMateTokenizationFeatureImpl.ts:260 await in S (async) U @ textMateTokenizationFeatureImpl.ts:280 (anonymous) @ textMateTokenizationFeatureImpl.ts:118 get tokenizationSupport @ languages.ts:2158 j @ tokenizationRegistry.ts:146 resolve @ tokenizationRegistry.ts:140 getOrCreate @ tokenizationRegistry.ts:76 P @ textMateTokenizationFeatureImpl.ts:129 (anonymous) @ textMateTokenizationFeatureImpl.ts:82 d @ extensionsRegistry.ts:151 acceptUsers @ extensionsRegistry.ts:142 Hb @ abstractExtensionService.ts:1119 Eb @ abstractExtensionService.ts:1049 jb @ abstractExtensionService.ts:507 ib @ abstractExtensionService.ts:454 await in ib (async) (anonymous) @ nativeExtensionService.ts:139 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/markdown-latex-combined.tmLanguage.json register @ TMScopeRegistry.ts:46 Uis @ TMGrammarFactory.ts:74 S @ textMateTokenizationFeatureImpl.ts:260 await in S (async) U @ textMateTokenizationFeatureImpl.ts:280 (anonymous) @ textMateTokenizationFeatureImpl.ts:118 get tokenizationSupport @ languages.ts:2158 j @ tokenizationRegistry.ts:146 resolve @ tokenizationRegistry.ts:140 getOrCreate @ tokenizationRegistry.ts:76 P @ textMateTokenizationFeatureImpl.ts:129 (anonymous) @ textMateTokenizationFeatureImpl.ts:82 d @ extensionsRegistry.ts:151 acceptUsers @ extensionsRegistry.ts:142 Hb @ abstractExtensionService.ts:1119 Eb @ abstractExtensionService.ts:1049 jb @ abstractExtensionService.ts:507 ib @ abstractExtensionService.ts:454 await in ib (async) (anonymous) @ nativeExtensionService.ts:139 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/cpp-grammar-bailout.tmLanguage.json register @ TMScopeRegistry.ts:46 Uis @ TMGrammarFactory.ts:74 S @ textMateTokenizationFeatureImpl.ts:260 await in S (async) U @ textMateTokenizationFeatureImpl.ts:280 (anonymous) @ textMateTokenizationFeatureImpl.ts:118 get tokenizationSupport @ languages.ts:2158 j @ tokenizationRegistry.ts:146 resolve @ tokenizationRegistry.ts:140 getOrCreate @ tokenizationRegistry.ts:76 P @ textMateTokenizationFeatureImpl.ts:129 (anonymous) @ textMateTokenizationFeatureImpl.ts:82 d @ extensionsRegistry.ts:151 acceptUsers @ extensionsRegistry.ts:142 Hb @ abstractExtensionService.ts:1119 Eb @ abstractExtensionService.ts:1049 jb @ abstractExtensionService.ts:507 ib @ abstractExtensionService.ts:454 await in ib (async) (anonymous) @ nativeExtensionService.ts:139 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/TeX.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/TeX.tmLanguage.json register @ TMScopeRegistry.ts:46 es @ TMGrammarFactory.ts:74 f @ textMateTokenizationWorker.worker.ts:93 await in f (async) $init @ textMateTokenizationWorker.worker.ts:74 g @ simpleWorker.ts:510 handleMessage @ simpleWorker.ts:487 k @ simpleWorker.ts:245 h @ simpleWorker.ts:209 handleMessage @ simpleWorker.ts:178 onmessage @ simpleWorker.ts:493 globalThis.onmessage @ simpleWorkerBootstrap.ts:31 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.latex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/LaTeX.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/LaTeX.tmLanguage.json register @ TMScopeRegistry.ts:46 es @ TMGrammarFactory.ts:74 f @ textMateTokenizationWorker.worker.ts:93 await in f (async) $init @ textMateTokenizationWorker.worker.ts:74 g @ simpleWorker.ts:510 handleMessage @ simpleWorker.ts:487 k @ simpleWorker.ts:245 h @ simpleWorker.ts:209 handleMessage @ simpleWorker.ts:178 onmessage @ simpleWorker.ts:493 globalThis.onmessage @ simpleWorkerBootstrap.ts:31 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.bibtex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/Bibtex.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/Bibtex.tmLanguage.json register @ TMScopeRegistry.ts:46 es @ TMGrammarFactory.ts:74 f @ textMateTokenizationWorker.worker.ts:93 await in f (async) $init @ textMateTokenizationWorker.worker.ts:74 g @ simpleWorker.ts:510 handleMessage @ simpleWorker.ts:487 k @ simpleWorker.ts:245 h @ simpleWorker.ts:209 handleMessage @ simpleWorker.ts:178 onmessage @ simpleWorker.ts:493 globalThis.onmessage @ simpleWorkerBootstrap.ts:31 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope text.tex.markdown_latex_combined. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/markdown-latex-combined.tmLanguage.json register @ TMScopeRegistry.ts:46 es @ TMGrammarFactory.ts:74 f @ textMateTokenizationWorker.worker.ts:93 await in f (async) $init @ textMateTokenizationWorker.worker.ts:74 g @ simpleWorker.ts:510 handleMessage @ simpleWorker.ts:487 k @ simpleWorker.ts:245 h @ simpleWorker.ts:209 handleMessage @ simpleWorker.ts:178 onmessage @ simpleWorker.ts:493 globalThis.onmessage @ simpleWorkerBootstrap.ts:31 TMScopeRegistry.ts:46 Overwriting grammar scope name to file mapping for scope source.cpp.embedded.latex. Old grammar file: file:///c%3A/Users/DokterKaj/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json. New grammar file: file:///c%3A/Users/DokterKaj/.vscode/extensions/james-yu.latex-workshop-10.5.0/syntax/cpp-grammar-bailout.tmLanguage.json register @ TMScopeRegistry.ts:46 es @ TMGrammarFactory.ts:74 f @ textMateTokenizationWorker.worker.ts:93 await in f (async) $init @ textMateTokenizationWorker.worker.ts:74 g @ simpleWorker.ts:510 handleMessage @ simpleWorker.ts:487 k @ simpleWorker.ts:245 h @ simpleWorker.ts:209 handleMessage @ simpleWorker.ts:178 onmessage @ simpleWorker.ts:493 globalThis.onmessage @ simpleWorkerBootstrap.ts:31 log.ts:419 INFO [perf] Render performance baseline is 84ms ```

Anything Else?