Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX syntax highlighting broken with minted and escapeinside #180692

Closed
The-Compiler opened this issue Apr 24, 2023 · 3 comments
Closed

LaTeX syntax highlighting broken with minted and escapeinside #180692

The-Compiler opened this issue Apr 24, 2023 · 3 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@The-Compiler
Copy link

The-Compiler commented Apr 24, 2023

Type: Bug

When using minted with LaTeX with its escapeinside feature (see pages 22/23 in the docs), this breaks VS Code's syntax highlighting, and the rest of the file is (mostly) rendered in red.

Minimal example:

\documentclass{article}
\usepackage{minted}

\begin{document}
\begin{minted}[escapeinside=||]{python}
    print(|\emph{test}|)
\end{minted}

\textbf{\textrightarrow{} Syntax highlighting broken for the rest of the file!}
\end{document}

Outcome on stock config without extensions:

image

VS Code version: Code 1.77.1 (b7886d7, 2023-04-04T23:20:37.202Z); 1.77.3 (704ed70)
OS version: Linux x64 6.2.11-arch1-1
Modes:
Sandboxed: No

System Info
Item Value
CPUs AMD Ryzen 7 PRO 4750U with Radeon Graphics (16 x 4000)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 3, 1, 1
Memory (System) 46.29GB (19.20GB free)
Process Argv --user-data-dir /tmp/fresh --disable-extensions
Screen Reader no
VM 0%
DESKTOP_SESSION herbstluftwm-locked
XDG_CURRENT_DESKTOP undefined
XDG_SESSION_DESKTOP undefined
XDG_SESSION_TYPE x11
Extensions disabled
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
vsccc:30610678
nodejswelcome1cf:30587006
2e4cg342:30602488
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
6233i204:30672705
vsctsb:30705553
azdwalk:30721579
pythonms35:30701012
pythonfmttext:30716742
pythonclientmv:30713943

@VSCodeTriageBot
Copy link
Collaborator

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.77.3. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@The-Compiler
Copy link
Author

Also present on 1.77.3. The "Inspect editor tokens and scopes" feature reveals that VS Code still assumes Python inside the escape:

image

and then gets stuck in that even past the \end{minted}:

image

@alexr00
Copy link
Member

alexr00 commented Apr 25, 2023

@The-Compiler thank you for the clear example. I've moved the issue over to jlelong/vscode-latex-basics#58, which is where we get our syntax highlighting grammar from. I suspect though that this is going to be a tough one to fix.

@alexr00 alexr00 closed this as completed Apr 25, 2023
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream labels Apr 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants