latex-lsp / texlab-vscode

LaTeX for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=efoerster.texlab
GNU General Public License v3.0
88 stars 3 forks source link

"Undefined control sequence" not parsed? #827

Open coxackie opened 11 months ago

coxackie commented 11 months ago

I came back to texlab after some time, and using the extension on VSCode. I am running in some trouble, in that the very important "undefined control sequence" errors do not seem to be parsed. Before I explain, here are my settings:

   "texlab.build.args": [        
        "-lualatex",
        "-synctex=1",
        "-file-line-error",
        "-interaction=nonstopmode",
        "%f"
    ],
    "texlab.forwardSearch.executable": "zathura",
    "texlab.forwardSearch.args": [
        "--synctex-forward",
        "%l:1:%f",
        "%p"
    ],
    "texlab.build.forwardSearchAfter": true,

Now, to the issue. Here is a minimal example. LaTeX doc, call it test.tex:

\documentclass{article}

\newcommand{\cA}{\mathcal{A}}

\title{Test}
\begin{document}
\maketitle

Denote by $\cB$ the\ldots

\end{document}

The problem is clear - I have defined \cA but worngly using \cB. When I build (on save - my setting are at the end), I only get a LaTeX Warning: No \author given error. When I look at test.log, I of course see LaTeX Warning: No \author given, but there is clearly a

/home/coxackie/Documents/Test/test.tex:10: Undefined contr
ol sequence.    
<recently read> \cB 

l.10 Denote by $\cB
                 $ the\ldots
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

It appears that texlab is not able to catch it.

Could you check whether you can reproduce it? I am happy to give any other information. (I am not providing all the output of test.log, as I do not think it is necessary.) If these errors are not caught, it is unfortunately a deal-breaker for me, as I tend to work with large files, and I cannot visually spot the problems...

coxackie commented 11 months ago

Edit: it appears that the problem is the use of lualatex. Once I go to the default configuration, it is ok. The corresponding part of the log is

LaTeX Warning: No \author given.

LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 10.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 10.
! Undefined control sequence.
<recently read> \cB 

l.10 Denote by $\cB
                   $ the\ldots
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

Could it be that it is parsed correctly here because the log output is more clear - especially with the ! identifier?

coxackie commented 11 months ago

Scrap the previous... it was in fact the -file-line-error command-line argument for latexmk. Taking that out, even if I use -lualatex the error is parsed.