-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Embedding C++ code in latex is broken but C code works fine #76603
Comments
@alexr00 this probably follows under your domain. Hey @jlelong, nice to meet you. @matter123 and I maintain the C++/C syntax. This is a somewhat complicated issue that isn't quite limited to C++. I'll work to get some sort of solution in the next few days though and I could use your help. The same issue should also show up for shell, perl, and dockerfile syntaxes if using any of the "Better __ Syntax" extensions. Why did this occur in the first place?There was a previous issue embedding languages inside markdown here: As part of that fix for that, all of the languages I'm generating are wrapped inside a duplicate EDIT: @jlelong I see that you're already adding the What exactly is happening?In order to wrap the whole language, the pattern is designed to start with the beginning of the file and end with the end of the file (which means it doesn't match anything). This isn't an issue for markdown because markdown uses a So here are the solution options, all of which have significant downsides.0. LaTeX fix for multi-line C++ embeddings.Downsides
\begin{minted}{cpp}
int f() {
return 0
}
\end{minted} Changes:
1. LaTeX reacting to the source wrapper (not recommended)Inside LaTeX and any other languages that cannot use the
Downsides
2. Coordinated change the other language embeddings
Downsides
3. Upgrade VS Code Textmate (ideal)
Downsides
NotesRight now the best solution is probably #2, in the next few days I'll try to reach out to other syntax maintainers and see if they can add the |
@jlelong thank you for finding this issue and @jeff-hykin thank you for the detailed options. For an immediate fix in 1.36.1 I can roll back to the version of the grammar we had in 1.35. For insiders and for the next release, option 2 does sound the best. For the grammars that VS Code pulls in from unmaintained repos, I can make the changes in the grammar local to VS Code. The only one that I actually see that will need the update is markdown. We can track down grammars that exist in other extensions and recommend the change to add the |
Okay the source wrapper has been removed 👍 |
@jeff-hykin thank you! When I pull in the update I'll make the change to the built in markdown grammar. |
To verify: |
@jlelong This is an issue with the grammar that was in use for 1.35. Objective-C and Objective-C++ used to inherit from the C and C++ grammar. As a result many patterns such as This causes issues when a non C-like language embeds C++, however, as What you are seeing should be identical to how vscode 1.35 looked. |
In insiders we are using a newer version of the grammar which solves both this issue that was present in 1.35 and the other embedding issue. Based on that, we're getting closer to everything being completely fixed. |
@alexr00 thanks for the clarification. I thought the new grammar would appear in 1.36.1 but I am not well aware of vscode's releasing process. |
I am a maintainer of LaTeX-Workshop and embedding
C++
code stopped working with vscode 1.36.The following piece of code embeds C++ inside LaTeX, but we never step out from
cpp
scopeIf instead of including
source.cpp
, we includesource.c
everything works fineThis is related to James-Yu/LaTeX-Workshop/issues/1476. Let me know if we can help investigating the issue.
The text was updated successfully, but these errors were encountered: