Run and Debug
The VS Code Ballerina extension gives you the same debugging experience as the conventional VS Code Debugger. Thus, you can run or debug your Ballerina programs easily via the VS Code Ballerina extension by launching its debugger.
Starting a Debug Session
Follow the steps below to start a debug session.
- Click the Debug icon in the left menu or press the Control + Shift + D keys, to launch the Debugger view.
- Add the debug points you require by clicking on the respective line numbers of the file.
- Click No Configurations and select Add Configuration….
- Click Ballerina Debug. This opens the launch.json file. You can edit this file to change the debug configuration options as required.
- Click on the name of the file that you want to debug.
- Click the Start Debugging icon.
You view the output in the DEBUG CONSOLE.
For more information on debugging your code using VS Code, go to VS Code Documentation.
- Stepping over code lines in non-blocking paths (eg: action invocations) will not pause VM on the next line
- workaround: manually put a breakpoint to the next line
- There are some cases where stepping over gives unexpected behavior
- E.g., when there are multiple workers and a wait expression waiting for them, even though it steps over to hit and pass the wait line in the source, the workers may not have finished the execution yet.