Run and debug
The VS Code Ballerina plugin 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 plugin by launching its debugger.
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 next line
- workaround: manually put a breakpoint to next line
- There are some cases where stepping over gives unexpected behavior
- Eg: When there are multiple workers and a wait expression waiting for them, even though step over hit and pass wait line in source, workers are not yet finished execution.