When I debug Javascript code in VS code or visual studio code, I would like it to show me the values of the variables alongside the code. How to make VS code do that ?
Ideally, don't want to hover my mouse pointer variable over each variable just to see its value, especially if the variable's value occupies only few characters on screen. There are other IDEs whose debuggers show a variables current value next to it.
Example :
var array = [1,2,3,4,5,6,7];
for(var i = 2; i < 5; i++){ "i : 3"
array.splice(i,1); "array : {1,2, 4, 5,6,7}"
}
Hover over a variable to see its value. The most commonly used way to look at variables is the DataTip. When stopped in the debugger hover the mouse cursor over the variable you want to look at. The DataTip will appear showing you the value of that variable.
Set a breakpoint in your code, and start debugging by pressing F5 or selecting Debug > Start Debugging. When paused at the breakpoint, hover over any variable in the current scope. A data tip appears, showing the name and current value of the variable.
Enable Debug: Inline Values
in your Settings.
Open Settings
Search for "debug"
Navigate to Features > Debug
Change the setting for Debug: Inline Values
Or change in your settings.json
file:
{
// Show variable values inline in editor while debugging.
"debug.inlineValues": true,
}
Alternatively, some people use the Quokka extension for the same purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With