Home Download Buy Blog Forum Support

Extend ST3 Project Tagging

Extend ST3 Project Tagging

Postby chrisguilbeau on Sun Jun 23, 2013 6:38 am

I'd like goto symbol in project to work with a few custom data-structures in our python code. I was wondering if there was a way to add regular expressions to things the tagger matches. Is this possible? If so, how does one do it?
chrisguilbeau
 
Posts: 19
Joined: Fri Nov 11, 2011 5:06 am

Re: Extend ST3 Project Tagging

Postby freewizard on Mon Jun 24, 2013 12:37 am

Same Q here, should I change the syntax files to get that?
using Sublime Text 3 dev in OS X 10.8
my ST packages: https://github.com/freewizard
freewizard
 
Posts: 36
Joined: Wed Feb 09, 2011 4:14 am

Re: Extend ST3 Project Tagging

Postby FichteFoll on Mon Jun 24, 2013 2:32 am

Technically, yes, but it's not as easy as you'd expect.

You need to do 2 different things:
  1. Copy the "Python.tmLanguage" syntax definition and modify it. Yes, this is the toughest part, but if you want to highlight your own "data-structures" you have to add a highlighter for them.

    See http://docs.sublimetext.info/en/latest/ ... xdefs.html for a brief description (and tutorial).

  2. Create a .tmPreferences file with your specific selector and add a "showInSymbolList" key. See "Packages/Python/Symbol List.tmPreferences" for a good example on this.

    Sadly, there are no docs available for this but I intend to write some soon(tm).
FichteFoll
 
Posts: 313
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Extend ST3 Project Tagging

Postby fjl on Mon Jun 24, 2013 6:54 am

Here's an example tmPreferences file:

Code: Select all
<?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>Macro Symbols</string>
    <key>scope</key>
    <string>entity.name.macro.definition.erlang</string>
    <key>settings</key>
    <dict>
        <key>showInSymbolList</key>
        <integer>1</integer>
       
        <key>symbolTransformation</key>
        <string>s/^/Macro: /</string>
       
        <key>showInIndexedSymbolList</key>
        <integer>1</integer>
       
        <key>symbolIndexTransformation</key>
        <string>s/^/Macro: /</string>
    </dict>
</dict>
</plist>
fjl
 
Posts: 36
Joined: Wed Dec 28, 2011 12:41 am


Return to General Discussion

Who is online

Users browsing this forum: aksdb, Google [Bot], jhawk28 and 27 guests

cron