3

playing around with the newly released VSCode Editor/IDE. I wanted to try out debugging on a very basic Node.JS CLI application, which uses the "prompt" npm package:

prompt.start();
prompt.get(schema, function (err, result) { ...

When I set some breakpoints and start the app debugging, VSCode just steps over the prompt.get() and hangs in the debug process until I force to stop it, which ends in an error "OpenDebug process has terminated unexpectedly".

I expected VSCode to open up a shell that I can interact with.

My guess is that it's just not implemented the right way yet, but probably I just couldn't figure it out...

tsdtsdtsd
  • 375
  • 4
  • 17
  • I couldn't get variables to work in debug mode. The app is in preview, I think it still needs some polish. Looks promising though. – Dermot Apr 30 '15 at 03:51
  • Is it possible it took over a shell you had running in the background without noticing? I tried out that prompt code in VSCode on my computer and it silently took over a terminal window I had running in the background. If it hadn't been partly uncovered I wouldn't have noticed. – Logan Tegman Apr 30 '15 at 04:13
  • @LoganTegman thought about that too and doublechecked, but there was nothing in the single open terminal, neither in Tilda. I guess Dermot is right, it's in a very early preview stage. I think it's going to the right direction but needs a good bunch of work. – tsdtsdtsd Apr 30 '15 at 11:24
  • I believe this is currently a limitation of Visual Studio Code: Preview debug. @Dermot can you please give more details on variables not working in debug mode? – Isidor Nikolic Apr 30 '15 at 13:21
  • @IsidorNikolic The variables window was blank and hovering over variables didn't display anything. Callstack was populated and step-thru debugging was working. I hope to spend more time with it at the weekend. Will update back if I notice anything different. – Dermot Apr 30 '15 at 23:15
  • 2
    Visual Studio code 0.3.0 has fixed this. – Andre Weinand Jun 02 '15 at 22:26

1 Answers1

6

On Linux Visual Studio Code does not yet open a terminal for the program to be debugged, so there is no way to interact with it through the command line. As a workaround you can launch the node program from a terminal in debug mode and attach to it from VSCode. I have created a bug on our side and will make sure it’s fixed with the next release.

Andre Weinand, Visual Studio Code

Andre Weinand
  • 1,907
  • 11
  • 8
  • Hi @andre-weinand I've been googling and trying to find more information but I don't seem to find any updated info on this. Is there a way to learn more about how to debug cli applications on VSCode? thanks! – Dvid Silva Dec 27 '16 at 01:42
  • 1
    The problem from above has been fixed some time ago. You can launch node.js programs into the 'Integrated Terminal' or an 'External Terminal'. Both support reading input from the terminal. See VS Code documentation: https://code.visualstudio.com/docs/editor/node-debugging#_node-console – Andre Weinand Dec 29 '16 at 11:06