SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

tmPreferences symbol transformations don't require a leading `s` #172

Closed FichteFoll closed 6 years ago

FichteFoll commented 6 years ago

Random example file:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Symbol Index</string>
    <key>scope</key>
    <string>source.gdl entity.name.function</string>
    <key>settings</key>
    <dict>
        <key>showInIndexedSymbolList</key>
        <integer>1</integer>
        <key>symbolIndexTransformation</key>
        <string>/\"([:word:]+)\"/$1/;</string>
    </dict>
</dict>
</plist>
keith-hall commented 6 years ago

It does if you stick an s before the / - I had the impression that it is necessary, no? image

runxel commented 6 years ago

@keith-hall the css package doesn't do it... 🤷‍♂️

FichteFoll commented 6 years ago

Ehm yeah, I seem to remember reading contexts that do this. Yes, the s is required and the syntax does indeed already help you spot that issue (at least if you know that regex replacements are highlighted).

Carry on.

FichteFoll commented 6 years ago

Actually, I just tested it and as @runxel mentioned the s is in fact not required. Talk about intuitivity.

runxel commented 6 years ago

Why does the s do anyway? Found no explanation on this topic...

FichteFoll commented 6 years ago

It's short for "substitution" and frequently used to denote a regex replacement in old-ish tools like vim, ed, sed et al (and perl).

You also see it used in IRC occasionally to correct a spelling or other mistake due to this.