66

Is there's any functionality simillar to CTRL+R of sublime in VSCode?

Sublime search method functionality

Ricardo Silva
  • 1,184
  • 1
  • 11
  • 19
  • 1
    Possible duplicate of [Method List in Visual Studio Code](https://stackoverflow.com/questions/36154283/method-list-in-visual-studio-code) – Alex Aug 01 '17 at 14:29
  • Within the current file or within the open project/folder? – KevinVictor Jun 04 '20 at 10:13
  • Would that be the sort of functionality provided by https://marketplace.visualstudio.com/items?itemName=trixnz.go-to-method or https://marketplace.visualstudio.com/items?itemName=kbysiec.vscode-search-everywhere ? – Peter W Sep 26 '20 at 04:34

6 Answers6

103

Go to Symbol workbench.action.gotoSymbol Ctrl+Shift+O (Cmd+Shift+O on a Mac).

You can reassign it to Ctrl+R.

You can also group them by typing colon @:.

matharden
  • 757
  • 6
  • 15
Alex
  • 59,571
  • 22
  • 137
  • 126
  • 16
    In case it helps anyone reading this, press Ctrl+P for "quick open", then you can use @ or @: The latter is handy to see all the symbols in the file grouped by classes, constants, fields, methods... (for C# in my case) – KevinVictor Jun 04 '20 at 10:35
  • 6
    how would I do a global search for a method in all my files? – stackjlei Jun 09 '20 at 19:57
  • For Ruby, you need this extension to make `gotoSymbol` work: https://stackoverflow.com/a/65607196/1852005 – stwr667 Oct 11 '21 at 02:34
  • Getting message "No editor Symbols", not worked this solution for me. Thanks – Kamlesh Apr 27 '23 at 07:20
85

To search a method name across all files you can use CTRL + P and then start search with # (to get directly here use CTR+T)

For example: #register

enter image description here

Neithan Max
  • 11,004
  • 5
  • 40
  • 58
Hamed Naeemaei
  • 8,052
  • 3
  • 37
  • 46
23

I found multiple options to search function/definition.

According to your convenience, you can choose one of the below options :

  1. Best shortcut: Ctrl+Shift+O and type your function name.

  2. Press Ctrl+P for "quick open", then you can use @ or @: The latter is handy to see all the symbols in the file grouped by classes, constants, fields, methods

  3. Press Ctrl+T to searches across files, not just the current file.

Thanks, @kevinvictor and @alex

Irshad Khan
  • 5,670
  • 2
  • 44
  • 39
15

The answer is to use Ctrl + T and start typing a method name.

(It searches for the method name in multiple files. You can use Ctrl + F to do the search in the current file.)

More detailed answer -

There are several ways to do a search in VS Code. One global way to do a search is to use Ctrl + P.

When you first click on Ctrl + P (Go to File), it shows the recently opened files.

  1. Then when you start typing in the search box not beginning with a special character like # or @, it will search for files.

  2. But when you start typing in the search box beginning with a special character like # or @, it will search for other things.

    Ctrl + P + # - show all symbols including methods in all files (same as shortcut: Ctrl + T)

    Ctrl + P + @ - go to symbol (same as shortcut: Ctrl + Shift + O)

FullStackCoder
  • 420
  • 4
  • 6
4

Having same issue in Visual Studio editor. I simply install PHP IntelliSense extension.

You can find this extension in ctrl + shift + x search IntelliSense and install it. And then type ctrl + shift + o so you can see all method and function.

Vipul Jethva
  • 647
  • 1
  • 7
  • 27
0

If you want to check for multiple uses of a function in VSCode another quick way to do this is

By using CTRL+CLICK (Windows) or CMD+CLICK (Mac) on the function name and then you would see a column on the right which would tell you all the other places in the file system that function has been used.

What lookup looks like