Closed tgray closed 2 years ago
I think this is related to some earlier issues (like https://github.com/latex-lsp/texlab/issues/510); I see a similar problem in Neovim (where the replacement is correct, but the server crashes afterwards).
Does texlab only provide completion suggestions with the assumption that there is a matching closing brace already? In other words \begin{verb|} (cursor at the |).
Thanks for the report. This problem is not necessarily unrelated to the missing closing brace. Instead, the problem lies in the ambiguity of LaTeX
. If you write \ref{foo bar}
for example, then this command references \label{foo bar}
. Most identifiers are allowed to contain spaces (xkeyval
is another example) so the completion tries to replace the whole identifier. Obviously, this heuristic fails here.
As a solution, we could do one of the following:
tree-sitter
needs to be checked). This also fixes the LSP spec violation.Your response makes a lot of sense. This one is relatively easy to work around with balanced braces for now, but I bet 99% of use cases without the trailing brace would be fixed by #1. Glad to hear the report was useful.
Can you try out 4dd2518, please? The issue should be fixed now.
Seems better. When \cite{ is on its own line, the completion doesn't go past the line breaks. Thanks!
Released with texlab
3.3.2.
Using texlab (installed with homebrew on macOS) with BBEdit 14.1 for completions. Sometimes asking for a completion of a tex command where the insertion point is after a left brace (
\begin{
or\cite{
), the return text range is nmuch too large and ends up replacing too much text, often to the next comma, slash, or brace. For example, cursor at the |:Trying to complete 'verbatim' will result in:
Verbose logging shows that the replacement range spans lines:
Does texlab only provide completion suggestions with the assumption that there is a matching closing brace already? In other words
\begin{verb|}
(cursor at the |).