\begin{lstlisting} creates an environment in which syntax is not parsed, similarly to \begin{verbatim}. However, Scintilla doesn't respect that, making code such as
\begin{lstlisting}[language=tcl]
puts $foo
\end{lstlisting}
mess up the syntax for the rest of the document, as if there were a non-terminated $.
This can be solved easily (I think) by treating \begin{lstlisting} the same way as \begin{verbatim} is treated.
I won't be working on this myself.