TransWikia.com

VS Code with Latex produces wrong commenting

TeX - LaTeX Asked by LosWochos on April 11, 2021

I’m using Visual Studio Code with Latex Workshop as my editor to create beamer slides. Until now everything works quite well. Today I tripped over a strange behaviour of VS code.

I’m using minted environments to include programming code on my slides. Somehow VC Code gets confused and switches internally to a different language from one line to another (e.g. syntax highlighting suddenly changes).

Until this block everything works fine and I can comment in/out with ctrl+k,ctrl+c using "%" as expected:

begin{minted}{javascript}
$("p").dblclick(function () {
  $(this).css("color", "red"); 
}
end{minted}

After that block VS code suddenly thinks I’m writing JavaScript and changes the syntax highlighting accordingly. When I comment in/out with ctrl+k, ctrl+c it then uses "//".

I already manually selected the language but it did not help. What can I do to tell VS code to really handle the whole document as a Latex file, even if it contains some minted code of other languages?

Best regards…

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP