James-Yu / LaTeX-Workshop

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

Writing \end would autocomplete with another \end #3783

Open ttoommxx opened 1 year ago

ttoommxx commented 1 year 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: Chrome OS (Crostini - Debian 11)
  • Visual Studio Code Version: 1.76.2
  • LaTeX Workshop Version: 9.7.0
  • TeX Distribution Version: TeX Live 2020

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.

  • I am using XXX whose version is YY.ZZ

The Issue*

Please briefly describe the issue you come across.

  • When I write \end{theorem} in a \begin{theorem} environment, the extension would auto-complete to \end{theorem} \end{theoren} as if the first end was a \begin

Reproduction Steps

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

  1. write \begin{theorem}
  2. remove the auto-completed \end{theorem}
  3. write \end{theorem} again Screen recording 2023-03-21 19.03.30.webm

Expected Behavior

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

  • no auto-completion upon re-writing \end{theorem}

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.

<IT'S JUST EMPTY>

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.

workbench.desktop.main.js:1882 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/ttoommxx/.vscode/extensions/james-yu.latex-workshop-9.7.0/syntax/TeX.tmLanguage.json
register @ workbench.desktop.main.js:1882
workbench.desktop.main.js:1882 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/ttoommxx/.vscode/extensions/james-yu.latex-workshop-9.7.0/syntax/LaTeX.tmLanguage.json
register @ workbench.desktop.main.js:1882
workbench.desktop.main.js:1882 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/ttoommxx/.vscode/extensions/james-yu.latex-workshop-9.7.0/syntax/Bibtex.tmLanguage.json
register @ workbench.desktop.main.js:1882
workbench.desktop.main.js:1882 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/ttoommxx/.vscode/extensions/james-yu.latex-workshop-9.7.0/syntax/markdown-latex-combined.tmLanguage.json
register @ workbench.desktop.main.js:1882
workbench.desktop.main.js:1882 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/ttoommxx/.vscode/extensions/james-yu.latex-workshop-9.7.0/syntax/cpp-grammar-bailout.tmLanguage.json
register @ workbench.desktop.main.js:1882
workbench.desktop.main.js:615  INFO [perf] Render performance baseline is 92ms
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/core/vs/workbench/workbench.desktop.main.js.map: Load canceled due to load timeout

Anything Else?

Add any other context about the problem below.

jlelong commented 1 year ago

The issue only happens if you start typing \end with the cursor not aligned with the start of \begin. Note after typing the { in \end{, the lines is de-indented. This behaviour is really weird and I have really no idea what could cause this in the extension. I am really wondering if this might not be a VS Code issue.

ttoommxx commented 1 year ago

That's quite strange, I did try on my home workstation, which is Arch-based, and the problem persists. Did you have a look at the video I uploaded and reproduced that? Apparently that happens even without removing \end{theorem} but just writing a new \end{theorem} again.

On Tuesday, 21 March 2023 at 19:19:53 GMT, Jerome Lelong @.***> wrote:

I cannot reproduce the issue.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ttoommxx commented 1 year ago

The issue only happens if you start typing \end with the cursor not aligned with the start of \begin. Note after typing the { in \end{, the lines is de-indented. This behaviour is really weird and I have really no idea what could cause this in the extension. I am really wondering if this might not be a VS Code issue.

Exactly, that's when it happens, write backslash, the environment get de-indented and then it autocompletes to \end.

jlelong commented 1 year ago

I think this is a VS Code issue. I have reported it https://github.com/microsoft/vscode/issues/178075

ttoommxx commented 1 year ago

Couldn't quite tell whether it was the extension or VScode itself, thanks for sorting that out for me! Shall I close the thread then?

jlelong commented 1 year ago

We can leave the issue open for now. I will take care of it.

James-Yu commented 8 months ago

It seems that somehow the issue was fixed on vscode side. I will close this issue for now.

https://github.com/James-Yu/LaTeX-Workshop/assets/4210342/b8cc8926-5701-4511-8dcf-462c63d24e97

ian-h-chamberlain commented 8 months ago

I'm still seeing this behavior with \end{itemize} on v9.17.0 of the extension and VSCode 1.85.1. The issue as described in https://github.com/microsoft/vscode/issues/178075 seems different than what I'm seeing, but maybe I'm misunderstanding the original issue here... the completion of \end behaves as though it was completing \begin, in my case:

https://github.com/James-Yu/LaTeX-Workshop/assets/11131775/3c0107ce-1012-4964-969a-a941039e409d

Is the the same thing, or should I file a different issue to track this?

jlelong commented 8 months ago

With VS Code 1.85.1, I can reproduce https://github.com/microsoft/vscode/issues/178075 with all extensions disabled included LW

Jan-04-2024 07-49-32

When activating LW

Jan-04-2024 07-52-05

@James-Yu, I even tried with a clean and fresh profile and only LW and I always face the issue. I am wondering what particular configuration you could have to prevent the issue from popping up on your side.

LinqLover commented 3 months ago

@jlelong Sorry if I'm hijacking this issue, I'm not sure whether this would be the same issue or a new feature request: Could we also have automatic completion of \end{theorem} after typing \begin{theorem? Currently, I can either type theorem and press tab (but this only works for environments that have already existed during the last build) or start with \begin{theorem and write everything manually.

James-Yu commented 3 months ago

@LinqLover It's a different thing.