Open akshaybabloo opened 8 years ago
This is not yet rectified in version 1.9.9
.
any news on it? I have the same issue of #250
Related bug: https://github.com/atom/language-gfm/issues/214
I feel the proper solution is two-part:
$base
is converted to an actual rule that dispatches to everything, like most other languages' grammars.Is this sufficient to unblock the bug?
I would imagine though that Atom would be using Tree-sitter parser instead of TextMate.
If you want to use a TextMate grammar, jeff-hykin/cpp-textmate-grammar
fixes the embedding issue. It's based on atom/language-c, but its already separated the C and C++ languages and removed the use of $base
. It's also used as the VS Code C++ TextMate Grammar.
And, yes @isiahmeadows those two changes fix the embedding bug.
@jeff-hykin Atom does use Tree Sitter normally for C files, but not for its GFM grammar. And it doesn't let TextMate grammars delegate to Tree Sitter grammars (or vice versa). It'd be nice, but it doesn't.
So I found out the embeddings are a bit harder to solve, at least for VS Code.
Markdown needs $base
to be changed to be $self
, so that C++ doesn't inject markdown into its patterns. However, the Objective-C and Objective-C++ TextMate grammars need the C and C++ syntax to keep things as $base
because they inherit/import the C and C++ syntax. Just a heads up, its something we're still working on fixing.
This might not be a problem for Atom though if the Tree sitter is being used for Objective-C / Objective-C++. Today I built a feature into the toolset we're using so we can dynamically change between $base
and $self
. I'm going to reach out to the Objective-C and Markdown maintainers probably in the next 3 weeks to figure out the best solution. If you could make use of a $self
version right now though let me know and we'll generate it.
I get the feeling this is really blocked on https://github.com/atom/first-mate/pull/90. I find it odd it hasn't gotten elevated in priority yet, considering how many issues it unblocks. Edit: I'm wrong. Ignore this comment.
This issue is now fixed on https://github.com/jeff-hykin/cpp-textmate-grammar
The Objective-C and Objective-C++ TM grammars were added and made to be independent of the C and C++ syntaxes, and then the C and C++ TM grammars were effectively changed from $base
to $self
which has fixed the issue in markdown files.
All 4 languages are now independent so that issues like this won't happen in the future.
@jeff-hykin Does your last comment apply to VSCode or only to Atom? I tried your VSCode extension and C embedded in markdown still had issues:
Namely the white printf and return lines.
Sorta. The atom maintainers just need to import it.
But, Atom Community is maintained better than the original Atom repo. I try to help out over there when I can. If it doesn't have the fix merged in, we can get it merged in over there.
Sorry, I'm not certain I understand. I was asking about the embedded highlighting behavior in VSCode - I'm not sure how that relates to Atom. (Though I realize I probably shouldn't be asking about vsc on the atom repo.)
On Sat, Sep 18, 2021 at 12:22 PM Jeff Hykin @.***> wrote:
Sorta. The atom maintainers just need to import it.
But, Atom Community is maintained better than the original Atom repo. I try to help out over there when I can. If it doesn't have the fix merged in, we can get it merged in over there.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/atom/language-c/issues/146#issuecomment-922360186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQV7TAXRWRZCUJPSLIDI73UCTRJFANCNFSM4CETXNPQ .
Oh that's my bad I didn't pay attention to the screenshot.
Yeah if it's broken in vs code that's a problem. Try installing the Better C++ Syntax Extension and see if the problem sticks around
I tried with the Better C++ Syntax extension (and restarted VSCode to make sure) but the C code embedded in markdown is highlighted in the exact same faulty way.
Oh, that explains it. A bit more than a week ago I broke up the C++/C/Objective-C/Objective-C++ into seperate repos/extensions. Try installing the better-c-syntax and let me know if that fixes it.
There is still a problem; it shouldn't need an extension to be fixed, but if the extension doesn't fix it there's a much bigger problem.
Hmm, even with the Better C Syntax VSCode extension the issue persists.
I went and tried several extensions and extension packs and none fixed the issue. Microsoft's C/C++ Themes did change the highlight colors but printf("Hello, World!\n");
and return 0;
were still white in the C embedded in markdown.
Welp, looks like that problem has actually been there for a long time. I went ahead and fixed it just now and published a new version. The C Syntax could use a lot of work
Description
I don't know if this is happening to everyone but when I write
/* .. */
in a code block, everything after that turns to pink (See the screenshot).Steps to Reproduce
Expected behavior: No pink color
Actual behavior: Turns anything after
/* .. */
to pink.Versions
Atom version
Atom : 1.7.3 Electron: 0.36.8 Chrome : 47.0.2526.110 Node : 5.1.1
No amp installed.
OS - OSX 10.11.5