LaTeX-Workshop: Automatically trigger auto-completion inside a snippet

Description

I found this bug with \ref and it’s autocompletion for the labels. It could also apply to cite, didn’t tested it with cite. Just a quick gif to visualize as it might be easier to understand with the help of the gif:

bug 1

The basic problem is if I use the autocompletion on the \ref command the label suggestions is not working after it. But if I type it out myself without using the autocompletion function then the label suggestion works. Furthermore, if I use the autocompletion but move the cursor outside of the autocompleted text, the autocompletion starts to work again.

Log messages

Log messages didn’t log anything.

How to reproduce

  1. Start typing \ref and use the suggestion ref for completion.
  2. Suggestion for labels is not working
  3. Moving outside of the text from autocompletion, suggestions for labels start work again.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 15

Commits related to this issue

Most upvoted comments

@werunom, the extension parses your tex file for listing all/some macros and then creates suggestions of the form macro{arg}. This is what was happening with \textcite.

@ahelm, the problem is that the first autocompletion (the one inserting \ref{}) should automatically trigger a second one to insert the label. I will investigate this. Meanwhile, while inside the {}, you can manually trigger autocompletion (ctrl-space) and this works as expected.

@werunom, I cannot find \textcite in the snippets defined by the extension. Could it be that you defined it yourself. In this case, you can define it as \texticte{$0} instead of \textcite{${1:arg}}. See my comment to @ahelm just above.