Does sublime text 3 supports "find usages"("go to references" or "list references") or any plugins support this?
Asked Answered
G

4

15

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

Guenzi answered 21/10, 2014 at 3:48 Comment(1)
There's SublimeCodeIntel that works for a number of languages.Anana
H
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.

Honewort answered 18/2, 2015 at 13:0 Comment(2)
IMHO Ctags are good for "go to definition" but not "go to references" (opposite way).Myrmecology
You are right, I mixed up with Cscope. :-) I don't know if there is a SublimeText or TextMate wrapper for Cscope.Honewort
L
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.

Lowspirited answered 18/6, 2020 at 14:13 Comment(1)
The MacOS equivalents of these are ⌘+R for go to symbol, ⌘+⌥+down arrow for go to definition, and ⌘+⌥+⇧+down arrow for go to referenceOuttalk
H
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.

Honewort answered 18/2, 2015 at 13:0 Comment(2)
IMHO Ctags are good for "go to definition" but not "go to references" (opposite way).Myrmecology
You are right, I mixed up with Cscope. :-) I don't know if there is a SublimeText or TextMate wrapper for Cscope.Honewort
S
1

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

Sula answered 14/3, 2019 at 19:24 Comment(0)
S
-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

Scarrow answered 19/4, 2018 at 9:23 Comment(1)
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.Outtalk

© 2022 - 2024 — McMap. All rights reserved.