Wrong syntax highlighting for latex? #19
Comments
Can you test it with the reference implementation (textmate)? |
No, but it implements highlighting with TmLanguage files correctly. In theory SyntaxKit tries to emulate TextMate's highlighting (there are small differences). Just add the rainbow dash theme to textmate and post the screenshot. Also does SyntaxKit emit any messages? |
No message from |
I'll test it. Looks like there is a problem with math and the article. |
Yep. Thanks. |
First I will take a look at the grammar (you have to eliminate \G). Then you just have to do a manual parsing pass and compare it to what the parse does. You can familiarize yourself with the parsing alogrithm if you want to. |
Thanks @alehed . |
I'll take the code for a spin in the next few days. |
For me the expression in $$ is highlighted just fine. All you have to do is make sure that it can also find the tex grammar (the latex grammar includes the tex grammar). I still have to figure out why the article is not colored. |
So I have to include the tex grammar as a resource? No need to load it? Thanks |
Just put the tex.tmlanguage in a place where your callback will find it (probably next to the latex.tmlanguage). When SyntaxKit sees the include, it tries to include the language grammar automatically. |
About the There is no latex.tmLanguage file in this bundle but only a latex.plist I guess if I add to the resources the .tmbundle it will not find the .plist file as a grammar, won't it? |
It doesn't matter what extension, just add the TeX.plist to the same place as you already have the LaTeX.plist and make sure your function finds it there (give it the correct name). |
Ok 👌 |
The reason I don't like plist is because it can mean anything (xml, json based or binary). In the code you gave me it looks specifically for a let bundleManager = BundleManager { (identifier, kind) -> (URL?) in
let name = kind == .Language ? identifier._split(separator: ".")[1] : identifier
return bundle.url(forResource: name.capitalized, withExtension: ".plist") ?? URL(fileURLWithPath: "")
} |
Thanks 👍 |
I think this issue can be closed. The newest version produces the following output for the first test (it does need to find the tex.tmLanguage): Currently the only difference between SyntaxKit and TextMate is that the |
Well done! |
It seems that there is an issue with this library.
For the text
and the theme
Rainbow_Dash
, I get the coloursThese are not (I guess) the correct colours.
The
.tmLanguage
file that I use is given here.More precisely, here is the
NSAttributedString
I get:The text was updated successfully, but these errors were encountered: