0

I would like to extend Sublime Text's GotoAnything for a custom source format. I've created a .tmPreferences file and from the behaviour I can tell it's being recognized. However, I have some trouble with the correct RegEx string.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Symbol List Function</string>
    <key>scope</key>
    <string>source.nsis</string>
    <key>settings</key>
    <dict>
        <key>symbolIndexTransformation</key>
        <string>s/Function $1/</string>
    </dict>
    <key>uuid</key>
    <string>9b3c04e2-e02a-4c55-85e9-de83ac7eedaf</string>
</dict>
</plist>

So yes, I want to match functions using in the scheme Function myFunctionName (for Goto @myFunctionName). This seems very trivial, yet I'm not sure why I don't get it to work.

idleberg
  • 12,634
  • 7
  • 43
  • 70

1 Answers1

0

Can you post the entire tmPreferences file. What you have posted here simply transforms an identified token. It does not identify them. Tokens are added based on scopes. Take a look at my answer here for how to add entries to the symbol list.

Community
  • 1
  • 1
skuroda
  • 19,514
  • 4
  • 50
  • 34
  • Assuming your syntax follows the normal convention, source.nsis is the entire file. If that's the scope of the text you want, you need to modify your tmLanguage file to add some additional scope. Also, you are missing the `showInSymbolList` key. While you are trying to get this to work, I'd recommend removing the transformation until you have the correct text showing. That way, you know you are starting with the correct scopes being identified. – skuroda Dec 24 '13 at 06:46
  • So, I have to edit the tmLanguage file as well? I'm using the one from the official [NSIS plugin](https://github.com/SublimeText/NSIS/blob/master/NSIS.tmLanguage) – idleberg Dec 26 '13 at 01:04
  • If source.nsis is the only scope displayed when you view the scope for that text, then yes. It's possible someone has already created an updated language file with Function defined, but I don't know of any. You will have to investigate a bit yourself. – skuroda Dec 26 '13 at 22:03