File structure output, declaration search, and element usage search are supported for C, C++, C#, Go, Java, JavaScript, Kotlin, Python, TypeScript, the Protocol Buffers data description language, and the .sourcecraft/ci.yamlCI/CD configuration file.
You can easily understand your code's structure and dependencies using the code navigation features in SourceCraft. The solution links declarations of named entities to their usages: for any named entity, you can view its declaration and jump directly to the corresponding line in the source code.
No configuration is required to enable code navigation, as SourceCraft automatically indexes your code for all supported programming languages.
This feature is available both in code browsing mode and when reviewing pull requests.
SourceCraft provides the following code navigation capabilities:
On the Home tab, under Your craftspace, navigate to Repositories.
Select a repository.
In the left-hand panel, click Search.
In the field that opens, enter the text you want to search for. You will be presented a list of all the files and lines this text is used in.
For a code preview, click on the line of interest.
To go to the place of use, double-click the line of interest.
Code navigation availability indicator
The indicator in the file info line tells you that code navigation is available for this file. The indicator can have these two colors:
Green, which means the navigation functionality is ready for use.
Orange, which means code navigation indexes are being built and will be ready soon.
If there is no indicator, no code navigation is available for this file.
File structure navigation
Select the file you want to view.
In the top-right corner, click File structure. The file structure panel will open on the right.
Click the declaration of interest to navigate to it.
Viewing declaration info
Select the file you want to view.
Hover over the named entity whose declaration you want to find. You will see the declaration info in a pop-up window:
Entity type
Signature
File path
Declaration documentation
If SourceCraft fails to figure out which declaration is meant, a list will be displayed. Go through the listed items for detailed info on the declaration of interest.
Navigating to a declaration from a use
Select the file you want to view.
Hover over the named entity whose declaration you want to find. If there are several declarations, select the one you need from the list.
To go to the file and line containing the named entity's declaration, click Go to declaration.
Tip
You can also jump to the file and line containing the named entity's declaration by placing the cursor on the named entity and using the following keyboard shortcut: Ctrl + B in Windows/Linux or Command + B in macOS.
Searching for uses
Select the file you want to view.
Hover over the named entity in code whose uses you want to find. The declaration info will appear in a pop-up window.
Click Find usages. This will open a panel on the right with all the named entity's uses.
Tip
You can also find the uses by placing the cursor on the named entity and using the following keyboard shortcut: Alt + F7 in Windows/Linux or Option + F7 in macOS.
To see a code preview containing the use you selected from the list, click the relevant line.
To navigate to the use, double-click the relevant line.