-
Notifications
You must be signed in to change notification settings - Fork 98
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
Apostrophes (single quotes) triggering weird highlighting. #804
Comments
This is a limitation of the TextMate grammar. In this case, we might find a less greedy regular expression but we can only do so much... |
Actually, it seems as if this might be more to do with the embedded grammars. I just notices that the behavior does not start until after my first embedded code listing which declares a language (in this case, Go) It seems as if the embedded grammar is not being fenced by the |
It seems related to #403 |
Yes, that seems likely, especially given the bash block example which shows the same behavior with single quotes. Normally I'd be inclined to ignore it--parsing is hard and TextMate's regexp approach is limited-- but contractions are common enough that this makes my text difficult to read. In any case, feel free to close as a duplicate. |
As a workaround, you can try to use:
It might help the regular expression. |
I tried this out, but unfortunately it's a non-starter since it would require a ton of changes since my entire document is written with inline code and some of it shows the evolution of a particular piece of code, which means it differs from the final version that is actually on disk. I could save multiple files I guess, but that would be yet more work, and I would need to structure the repository so that the intermediate files are ignored. It's a shame since this is otherwise a great extension, but it looks like I'll have to disable it for now. Perhaps a faster workaround might be adding an option to disable the embedded grammar parsing? I don't really require it in the main editor window and highlighting would continue to work in preview and render. It might even be a good idea to disable this by default, since, presumably, it is broken everywhere, for everyone. |
Could you please provide a minimal reproduction case? We might be able to tighten the regular expression. Thanks! |
So, I have some interesting news and maybe even a fix. When I received the GH notification, I happened to be editing the beginning of the chapter where I first noticed the highlight problem, so I went to the first code listing to make the reproduction case, and found that it had an unterminated function (i.e. missing the final curly bracket). Upon fixing that, the rest of the document seems to work again, since every other listing appears to be valid (still testing, though). So this seems to be exactly what is described in #403, where the first example was the result of a missing parenthesis and the second is likely because I did some digging, and ran across microsoft/vscode#20488, which lead me to a mention of the fix for markdown which encountered similar issues, along with a related fix in another project.
In any case, here, is the minimal repro:
|
Update: wasn't able to get this working in testing. I think the |
@flowchartsman Let me know if you need help and thanks for looking into it, greatly appreciated 🙌🏻 |
If I'm reading the documentation correctly, apotrophe (
'
) characters between two word characters are detected and rendered as a single curved apostrophe. This seems to be correct in my rendering, but the extension seems to highlight them as if I'm writing a quoted phrase. This causes long blocks of colored text in my document every time I use a contraction.Here is a contrived example screenshot, taken from my editor with the
Light+
color scheme enabled.The text was updated successfully, but these errors were encountered: