C
C#2y ago
Marwin

❔ Writing VS Extension to Support Language with TextMate Grammar File

Hello, I am trying to write extension to support BNF(Backus–Naur form) metalanguage files. I am trying to add Syntax Highlight. I find this https://www.youtube.com/watch?v=ftug7sL-5kw but it doesn't seem to work for me. My best ques is that I have a something wrong in tmLanguage file. I added only comments (one line). To what I understood the name should define the style, I used just comment thinking that it will make my comments green like they are in my VS Theme. I didn't find the tmTheme definition for the defaults VS Themes if anybody found them, that might be helpfull. Here is my tmLanguage file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>bnf</string>
</array>
<key>keyEquivalent</key>
<string>^~B</string>
<key>name</key>
<string>bnf</string>
<key>patterns</key>
<array>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>!</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>comment.line.bnf</string>
</dict>
</dict>
<key>end</key>
<string>\n</string>
<key>name</key>
<string>comment.line.bnf</string>
</dict>
</array>
</dict>
</array>
<key>scopeName</key>
<string>source.bnf</string>
<key>uuid</key>
<string>ba3fad05-08de-470a-819e-5126daaafcf4</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>bnf</string>
</array>
<key>keyEquivalent</key>
<string>^~B</string>
<key>name</key>
<string>bnf</string>
<key>patterns</key>
<array>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>!</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>comment.line.bnf</string>
</dict>
</dict>
<key>end</key>
<string>\n</string>
<key>name</key>
<string>comment.line.bnf</string>
</dict>
</array>
</dict>
</array>
<key>scopeName</key>
<string>source.bnf</string>
<key>uuid</key>
<string>ba3fad05-08de-470a-819e-5126daaafcf4</string>
</dict>
</plist>
Microsoft Visual Studio
YouTube
Writing Visual Studio Extensions with Mads - Supporting new Languag...
Let's build an extension for Visual Studio to add support for new languages using TextMate grammar files. Send Mads your Suggestions: https://aka.ms/extensions/suggestion Featuring: Mads Kristensen (@mkristensen) #Textmate #VisualStudio #Extensions
2 Replies
Marwin
MarwinOP2y ago
! as a 1st character in regex has a special meaning. I never heard about that VS regex dosn't use it either. If an exclamation mark (!) occurs as the first character in a regular expression, all magic characters are treated as special characters. An exclamation mark is treated as a regular character if it occurs anywhere but at the very start of the regular expression.
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server