如何在Visual Studio 17中有效地更改TextMate语法

时间:2018-07-03 12:36:06

标签: regex xml visual-studio textmate tmlanguage

我正在为我的语言(结构化文本)的高语法开发一种文本伴侣语法。 在编写* .tmLanguage文件之前,我已经在互联网上进行了大量研究,并且发现了其他语言定义文件的位置:

%userprofile%\.vs\Extensions

在这里,我已经在plc.tmLanguage中创建了文件夹(“ plc \ syntaxes”)。 该文件包含以下代码:

<?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>comment</key>
   <string>this file is responsable of *.plc color pattern</string>

<key>fileTypes</key>
<array>
    <string>st</string>
    <string>plc</string>
    <string>inc</string>
</array>

<key>patterns</key>
<array>
    <dict>
        <key>name</key>
        <string>comment.line.plc</string>
        <key>match</key>
        <string>\*.*</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#80dcff</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>variable.parameter.plc</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#ff8000</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>support.type.plc</string>
        <key>match</key>
        <string>^#(define|include)<string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#ff8000</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>string.quoted.double.plc</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#ff8000</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>keyword.other.plc</string>
        <key>match</key>
        <string>(LDN?|ORN?\(?|ANDN?\(?|S(T|UB)?|R|EQ\(?|JMPC?N?|CAL|R?E?F? PATH|NE\(?|ADD|ABS|GT|L(T|E)|GE|MUL|DIV)</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#00ff00</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>keyword.other.plc</string>
        <key>match</key>
        <string>^(%M|%I(W|X))<string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#ff0080</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>keyword.other.plc</string>
        <key>match</match>
        <string>^%(cn|Q(W|X))<string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#0080ff</string>
        </dict>         
    </dict>
    <dict>
        <key>name</name>
        <string>keyword.other.plc</string>
        <key>match<key>
        <string>^%(ax|C)<string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#00ffff</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>keyword.other.plc</string>
        <key>match<key>
        <string>^%R<string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#80ff00</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>keyword.other.plc</string>
        <key>match<key>
        <string>^%.+<string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#ffff00</string>
        </dict>
    </dict>
    <dict>
        <key>name</key>
        <string>keyword.control.plc</string>
        <key>match</key>
        <string>(AT|(END_)?(FUNCTION|VAR)$|VAR_(INPUT|OUTPUT|IN_OUT))</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string></string>
            <key>foreground</key>
            <string>#ff0000</string>
        </dict>
    </dict>
</array>

不幸的是,当我打开Visual Studio时,没有任何变化,并且代码没有着色。 错误在哪里?也许范围selecotors? 请我帮忙!

0 个答案:

没有答案