How to show a Function/Method List in Visual Studio Code

avatar
Borislav Hadzhiev

Last updated: Apr 6, 2024
4 min

banner

# How to show a Function/Method List in Visual Studio Code

There are multiple ways to show a function and method list in VS Code.

You can show the list in Explorer (the left sidebar) or directly in your file.

To list the functions and methods in VS Code:

  1. Open a file.
  2. On Windows and Linux, press: Ctrl + Shift + O (the letter o, not zero).
  3. On macOS: press CMD + Shift + O (the letter o, not zero).

show function method list keyboard shortcut

You can view the key combination for the different operating systems in this table in the docs. The command is called Go to Symbol....

You can use the arrow keys to navigate and the Enter key to move your cursor to a specific function or method.

show function method list

The menu also lists class methods if you have any classes in the file.

menu allows you to list class methods

You can type : (a colon) after pressing Ctrl + Shift + O (or Cmd + Shift + O on macOS) if you want to group the symbols in categories (e.g. methods, functions, classes and variables).

group functions and methods into categories

You can also issue the command via the Command Palette:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type go to symbol and select Go to Symbol in Editor....

go to symbol command

You can also issue the command directly:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
  1. Type @.

issue command directly

The command lists the functions and methods in the file.

If you want to list the functions and methods in the entire workspace:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
  1. Type #.

  2. Start typing to filter for specific functions or methods.

list functions and methods in workspace

There is also a keyboard shortcut for the Show All Symbols command:

  • on Windows and Linux: Ctrl + T
  • on macOS: Cmd + T

# Changing the keyboard shortcut of the command

If you need to change the keyboard shortcuts of the Go to Symbol in Editor or the Go to Symbol in Workspace commands:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type Keyboard Shortcuts and select Preferences: Open Keyboard Shortcuts.

preferences open keyboard shortcuts

  1. Search for go to symbol and double-click on the corresponding command.
  2. Specify your preferred key combination and hit Enter to confirm.

set custom keyboard shortcuts for go to symbol

# Show a Function/Method list in the Left Sidebar in VS Code

If you need to show a function/method list in the left sidebar (Explorer) in VS Code:

  1. Open a file in the editor.
  2. In the left sidebar, click on the OUTLINE menu to expand it.
  3. View the functions and methods.

expand outline view in sidebar

The Outline view is located right below the list of files in Explorer (the left sidebar).

If explorer is not shown, press Ctrl + B (or Cmd + B on macOS) to toggle it.

click to expand outline

Once you expand the outline tab, you will be able to see the list of functions and methods for the currently opened file.

view file outline

Notice that the methods are indented under the Employee class.

NOTE: you can double-click on the functions or methods in the outline view to move your cursor to the given method in the file.

focus function or method from outline view

You can click on the three dots that appear when you hover over the outline tab to display sorting options.

sort functions and methods in list

When the Follow Cursor setting is enabled, the function or method that is selected in the file gets highlighted in the outline view in the sidebar.

view sorting options

You can sort the functions and methods by their position in the file, by their name or type.

  • Sort by Position - sorts the functions and methods by their position in the file (this is the default).
  • Sort by Name - sorts them by their name in ascending order.
  • Sort by Category - sorts the functions and methods by their type (functions and methods grouped together) in the Outline view.

Note that errors and warnings are also displayed in the Outline view.

I've also written an article on how to view the local history & restore previous file versions in VS Code.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.