14

I want to konw if sublime text can do something like function lookup in eclipse or intellij idea.

roger
  • 9,063
  • 20
  • 72
  • 119

4 Answers4

5

In Sublime Text 3 there are the following built-in options:

  • Ctrl+Shift+R to go to a symbol (function, class etc.)
  • F12 to go to a definition of what's under the cursor
  • Shift+F12 to go to a reference of what's under the cursor

These are all available under the "Goto" menu which also show the keyboard shortcuts which may be different depending on your OS and settings.

Where there are multiple options for where to go, Sublime will present a filterable list of choices with the usual preview options as you move through the choices.

awatts
  • 1,008
  • 8
  • 13
  • The MacOS equivalents of these are ⌘+R for go to symbol, ⌘+⌥+down arrow for go to definition, and ⌘+⌥+⇧+down arrow for go to reference – Elezar Mar 30 '23 at 17:49
3

The SublimeText package CTags gives you access to the feature of the Exuberant CTags tool (multi language index builder and browser). Seems to work for version 2 and 3.

MonsieurDart
  • 6,005
  • 2
  • 43
  • 45
1

There is a plugin called Goto Usage https://packagecontrol.io/packages/Goto%20Usage

Chuan
  • 3,103
  • 1
  • 19
  • 23
-1

A "find" solution might be of help.

1) Make the word at the cursor as the active word

CMD + E

2a) Find next such word in the current file

SHIFT + CMD + G

2b) Highlight ALL such words in the current file

SHIFT + CMD + G

Replace CMD with CTRL in windows

Leo Bastin
  • 310
  • 4
  • 6
  • There are a couple obvious downsides to this approach. The big one is that this will find all instances of the word being searched, even if it's not a reference to the symbol. So it will find any comments or string literals that have the same word. The other problem is that the commands listed only search in the current file, so won't find any references in other files. There is a Find in Files command that could be used, but it's not as easy to use. – Elezar Mar 30 '23 at 17:59