Closed muzimuzhi closed 1 month ago
Thanks for your report. Unfortunately, VS Code syntax engine does not support variables to activate or deactivate some rules.
I have had a quick look at the corner cases you listed in https://github.com/texstudio-org/texstudio/issues/618#issuecomment-499325441, I do not think these can be robustly fixed. It should be possible to restrict \iffalse...\fi
highlighting to LaTeX language and to drop it in TeX language. I am sure if this could really help.
@muzimuzhi Could you try #98? This PR should make all the corner cases listed in https://github.com/texstudio-org/texstudio/issues/618#issuecomment-499325441 work well.
A clear and concise description of what the bug is.
754e79d (Highlight
iffalse
blocks as comments (#78), 2024-03-08) and 8624d0b (Only catch \iffalse at the beginning of a line, 2024-04-20) made the\iffalse ... \fi
blocks highlighted as comments, when\iffalse
is at the beginning of a line. But as the complexity of TeX, there are still false positive cases.One kind of such cases are brace tricks like
\iffalse{\fi}
which are usually encountered in tabular-related implementation. See this Q&A on TeX-SX for more info.I listed some rarer cases in https://github.com/texstudio-org/texstudio/issues/618#issuecomment-499325441.
Catching corner cases like these may not worth the effort. Maybe there can be a new setting to turn off
\iffalse ... \fi
highlight?A minimal example to reproduce the issue