Texstudio: syntax highlighter thinks new command is undefined

Created on 11 Sep 2019  路  3Comments  路  Source: texstudio-org/texstudio


Environment

  • TeXstudio: 2.12.10
  • Qt: 5.8.0
  • OS: Windows 10

How to reproduce

Firstly paste the following code:

\documentclass{article}
\newcommand{\abc}{1}
\newcommand{\abc}{1}
\begin{document}
    \abc
\end{document}

Observe that the syntax highlighter does not highlight the \abc in Line 5 in red, which is the expected behaviour.

Then, delete the third line, and the code should now look like:

\documentclass{article}
\newcommand{\abc}{1}
\begin{document}
    \abc
\end{document}

Observe that now the syntax highlighter treats \abc as undefined by highlighting it in red, which is not the expected behaviour.

bug

All 3 comments

I don't think we keep track of duplicate definitions, which is an edge case and would make the code more complex. As a workaround, you can update the internal state using Idefix -> Refresh Structure.

duplicate definitions are not tracked. You can add it again by editing the remaining line with the definition (add a space)

very low priority

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mirsamantajbakhsh picture mirsamantajbakhsh  路  8Comments

muzimuzhi picture muzimuzhi  路  10Comments

Krzmbrzl picture Krzmbrzl  路  4Comments

juliandragon picture juliandragon  路  6Comments

desk7 picture desk7  路  3Comments