Back to VS Code home
The Ballerina VS Code extension provides support for code navigation.
The Ballerina VS Code extension provides support for code navigation. The different kinds of supported navigations are described in the following sections.
Go to definition
The Go to definition feature navigates you to the definition of a particular symbol. For example, when you invoke the Go To Definition
option on a function call expression, it navigates you to the definition of the function.
To go to a symbol's definition, press F12
. Hold Ctrl
on Windows and Linux or ⌘
on Mac and hover over the symbol to see a preview of its declaration.
Go to symbol
The Go to symbol feature allows you to navigate symbols inside a file.
You can navigate symbols within a file by pressing Ctrl
+ Shift
+ O
on Windows and Linux, or shift
+ ⌘
+ O
on a Mac.
The symbols can be grouped by category by typing :
.
Find all references
Invoking the references (right click on a symbol and select Find All References) on a symbol will prompt you with all the symbol references in the current project.
You can also press Alt
+ Shift
+ F12
on Windows and Linux, or ⌥
+ shift
+ F12
on Mac to find all references.
Peek
This feature allows you to peek the definition or references of a given symbol.
On Windows and Linux, press Ctrl
+ Shift
+ F10
, or on Mac, press shift
+ F12
to open the peek view.
Rename symbols
This feature allows you to rename symbols by renaming all the references of the particular symbol.
Press F2
, type the new desired name, and then press Enter
. This will rename all usages of the symbol across files.
You can also right-click on the symbol and select Rename Symbol to rename it.