Sublime Forum

Cmd+Shift+R index methods within objects

#1

Sublime is superb in indexing functions, but it currently ignore functions defined as methods within object, e.g. R6 object in R. Where to modify to tell Sublime to index those functions too?

0 Likes

#2

Sublime Text automatically indexes all tokens with the scope of entity.name.function or entity.name.type. There are two options to add missing functions/entities.

  1. Modify the syntax definition to correctly scope all function like entities. Some syntaxes use entity.name.method or something like that to distinguish global functions and class methods.
    This might be quite sophisticated and is therefore not recommended.
  2. Create a new Indexed Symbols.tmPreferences file within ST’s Packages folder to add more entities to include into indexing. You’d need to find out the correct scope of the entities to index and create a corresponding selector. ST’s default selector is entity.name.function, entity.name.type.

Example

<?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>scope</key>
    <string>entity.name.function, entity.name.type</string>
    <key>settings</key>
    <dict>
        <key>showInIndexedSymbolList</key>
        <string>1</string>
    </dict>
</dict>
</plist>
0 Likes