DEV Community

Cover image for Intro to Visual Studio Code Debug Visualizer
Bunlong for Algorithms Hub

Posted on

Intro to Visual Studio Code Debug Visualizer

Debug Visualizer is a vscode extension for visualizing data structures while debugging.

Supported Languages

These languages and debuggers are verified to work with this extension: JavaScript/TypeScript, Go, Python, C#, PHP, Java, C++, Swift, Rust.

Installation

Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.

ext install hediet.debug-visualizer
Enter fullscreen mode Exit fullscreen mode

Usage

After installing this extension go to View and click on Command Palette (Ctrl + Shift +P) of VS Code.

Command Palette

And use the command Debug Visualizer: New View to open a new visualizer view.

Debug Visualizer: New View

Visualizer view:

Debug Visualizer

And then go to View and click on Command Palette (Ctrl + Shift +P) of VS Code again.

Command Palette

And use the command Debug Visualizer: Use Selection as Expression (Shift + F1) to use the currently selected text as expression in the most recently opened debug visualizer.

Debug Visualizer: Use Selection as Expression

Download sample JavaScript repository here and following command line:

$ cd demos/js
$ npm install
$ npm run dev
Enter fullscreen mode Exit fullscreen mode

Open demo_sorting.ts in Visual Studio Code and set breakpoint at line 69.

Visual Studio Code and set breakpoint at line 69

And then go to Run and click on Start Debugging (F5) of VS Code.

Start Debugging

And then input the variable array that you want to debug.

Debug Visualizer Input

Debug Visualizer show the graph as following.

Debug Visualizer Graph


Thanks for reading ❤

Follow us to catch the newest Algorithms articles:

Top comments (1)

Collapse
 
moopet profile image
Ben Sinclair • Edited

I've spent 2 minutes looking at those screenshots and have no idea what I'm looking at!

There's a line graph that's somehow connected to an array (out of many possible drop-down items all called "array"), but this is found by selecting a variable of unspecified type called "index".