Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Watch window or evaluate expressions while debugging in VS Code?

I really like Visual Studio Code, it's a great editor but one thing is really annoying me while debugging Node apps:

I can't see any sort of watch window or the ability to evaluate expressions while debugging. This makes debugging pretty painful and I'm considering moving back to VS 2013.

I know we have the local and global variables windows but they are a pain to look through (maybe add a search box?) and some things just don't appear in the list.

For example using TypeScript, a class function compiles down to something like this:

Stack.prototype.push = function (item) {
    if (this.items.length == this.length)
        this.resize(length * 2);
    this.items[this.length++] = item;
};

When debugging this function however I don't have any access to the this variable while in the push() function. It does not appear in either the local or global variables and I can't evaluate it anywhere.

Has anyone else experienced this and found a solution?

like image 668
antfx Avatar asked May 09 '15 09:05

antfx


People also ask

How do you start a Debug session to evaluate expressions?

To open the Debug Console, use the Debug Console action at the top of the Debug pane or use the View: Debug Console command (Ctrl+Shift+Y). Expressions are evaluated after you press Enter and the Debug Console REPL shows suggestions as you type.


1 Answers

Since version 0.6.0 VS Code supports watches and since 0.8.0 VS Code has a debug console (aka REPL).

The "missing this" problem has been fixed.

like image 58
Andre Weinand Avatar answered Sep 22 '22 08:09

Andre Weinand