# TeXstudio : Error in fontlock (disable syntax highlighting) in a newenvironment that extends from verbatim environment

I'm using TeXstudio 2.11 on windows 8.1 and have problems with a syntax highlighting when I use math symbols in a new environment:

My Code:

\documentclass{book}

\usepackage{verbatim}
\usepackage{minted}

\newenvironment{languagebat}{\VerbatimEnvironment\minted[
frame=single,
xleftmargin=0mm,
numbersep=5pt,
autogobble,
breaklines,
breakanywhere,
breaklines,
framesep=2mm,
rulecolor=black!30,
bgcolor=black!3,
linenos=false,
startinline,
tabsize=4
]{bat}}{\endminted}

\begin{document}

\begin{languagebat}
$git rm --cached giant_file \end{languagebat} \end{document} Result in the editor: I think the languagebat environment extends from verbatim environment correctly and that should be working fine. The problem seems to be the$ sign in the languagebat environment, and TeXstudio believes that I have entered some math code that I have not yet terminated with an ending \$ sign. Is there a way to tell TeXstudio to ignore syntax highlighting within a particular environment?

Caveat emptor: I'm not a TXS user

Emacs, the editor you are referring to in the other answer, can parse .tex files and add newly defined commands/environments to its completion list on fly. I don't think that TXS has this feature, hence you have to write your own .cwl file. The way I get it you have to put your minted related (and other?) code in a .sty file, say mydefs.sty, e.g.

\ProvidesPackage{mydefs}[2016/11/13 Package mydefs]
\RequirePackage{minted}
\newenvironment{languagebat}{\VerbatimEnvironment\minted[
frame=single,
% ...
]{bat}}{\endminted}

and use it with \usepackage{mydefs} in your preamble (why not using \newminted BTW?)

Next, you write a mydefs.cwl file like:

\begin{languagebat}#V
\end{languagebat}

put it into a directory described here. You probably have to restart TXS and load your file in order to get it work.

Maybe some TXS expert can confirm this.