vscode-ltex
vscode-ltex copied to clipboard
False Positive in COMMA_PARENTHESIS_WHITESPACE in conjunction with macro
Describe the bug \newcommand{\test}{\texttt{test}} \newcommand{\notest}{\texttt{no test}} Example: Consider \test, but not \notest.
This yields two warnings at the macros both COMMA_PARENTHESIS_WHITESPACE with slightly different text: \test: Put a space after the comma, but not before (the comma). \notest: Don't put a space before the full stop.
In both cases, the macro seems just to be ignored.
Steps to reproduce Steps to reproduce the behavior:
- Make a tex-file with the above line.
- Activate ltex
- See errors
Expected behavior As one cannot know what the macro really does, may also be invisible, one shall not check when a macro is present. Conceivable also to assume, it is non-empty text and risk false positives.
I think, "\test " is rarely ok, whereas "\test," and "\test," and that like are (macro followed by mark). So maybe for macros we need another type of whitespace check.
Sample document Too simple.
LTeX configuration
No file settings.json
.
"LTeX Language Server" log file
Nothing referring to the problem
"LTeX Language Client" log file Nothing referring to the problem
Version information List here the version information of the relevant software.
- Operating system: Linux (which distribution/version), macOS xx.xx, or Windows xx
- VS Code: 1.65.0
- vscode-ltex: 13.1.0
- ltex-ls: x.xx (only if not using ltex-ls automatically downloaded by LTeX)
- Java: x.xx (usually obtained with
java -version
, only if not using Java automatically downloaded by LTeX)
Additional context/information None.
I can confirm this happens on my environment as well
This can be (temporarily?) mitigated by adding both \test
and \notest
to the ltex.latex.commands
setting with type dummy
.
This can be (temporarily?) mitigated by adding both
\test
and\notest
to theltex.latex.commands
setting with typedummy
.
This is super helpful!! Thank you @jonasc Also, I think this is better than a "temporarily solution", as users can have arbitrary macros and it make sense for them to be in charge to telling ltex how to parse them.