James-Yu / LaTeX-Workshop

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

Autocomplete for '\begin{}' inserts a double closing '}' #2075

Closed albanleandri closed 4 years ago

albanleandri commented 4 years ago

Preliminary questions [Required]

Disable all the other extensions except for LaTeX Workshop, and check that you still see this issue. [Required]

You still see this issue?: Yes

Make sure to visit the wiki FAQ before filling an issue.

You visited the wiki?: Yes

If your issue is with compiling a document (not having to do with finding the root file of a project), check first that you can compile manually.

You can compile a TeX document manually?: Yes

Describe the bug [Required]

Invalid syntax from autocomplete for \begin{itemize} or \begin{enumerate} causing compilation error.

To Reproduce

When typing: \begin{i} The suggestions for autocomplete will appear. In this case, the relevant suggestion will be: \begin{itemize} If I proceed with this suggestion then I will have what follows:

\begin{itemize}
    \item 
\end{itemize}}

As you can see, the ending command contains an additional closing curly brace. It's wrong and will cause a compilation error if not removed (manually).

Expected behavior

I want the autocomplite to lead to what's below:

\begin{itemize}
    \item 
\end{itemize}

Logs [Required]

Please paste the whole log messages here, not parts of ones. It is very important to identify problems.

LaTeX Workshop Output [Required]

To access the log, click the 'TeX' icon on the Activity Bar on the left side, select 'View Log Messages', then select 'View LaTeX Workshop extension log'.

[Paste the log here]

Developer Tools Console [Required]

To access the log, click 'help' -> 'Toggle Developer Tools. Paste anything suspicious.

[Paste the log here]

Screenshots

If applicable, add screenshots to help explain your problem.

image

image

Desktop [Required]

Additional questions

Are you using LaTeX Workshop with VS Code Remote?

Yes, I am using LaTeX Workshop

jlelong commented 4 years ago

You should not write the closing } of \begin your self.

May-09-2020 15-52-06

albanleandri commented 4 years ago

@jlelong actually, I don't, it's auto closing. Is it a VSC setting I can change?

jlelong commented 4 years ago

OK I understand. I only type \beg and hit TAB to complete. Doing so I only get \begin{. I agree with you that when typing \begin{ you automatically get the closing }.

I will investigate if I can remove the extra } on the fly if it has already been inserted.

c-harding commented 4 years ago

jlelong commented 4 years ago

I think this is solved by #2080 Could you test this branch to make sure it does not have side effects?