News for hackers. Stuff that matters.
Re:Teaching D from Scratch: Is it a viable first language? by gavinray on Wednesday December 29, 2021 @06:35PM (#29731542)
RE: Debugging D in VS Code, this hasn't been my experience at all

  > "Another challenge I’ve faced is the lack of a good debugging experience for VS Code on Windows. The C debugger for VS Code displays, for example, a string as a length and a C string (which might have trailing garbage). I’d rather not confuse them with this. I have read that Visual D has a better debugging experience, but I need dub support for these projects, and Visual D focuses on Visual Studio integration, something I don’t necessarily want to deal with in teaching these kids. "
You need to use the Microsoft C/C++ "cppvsdbg" option in your "launch.json" config as the "type", and also to use Webfreak's custom Natvis file for how to display D native types in the debugger:

https://code.visualstudio.com/docs/cpp/launch-json-reference...

https://github.com/Pure-D/dlang-debug#natvis-with-vsdbg

This makes associative arrays display properly, and strings, etc.

I think this has been integrated in latest code-d. You want to compile with "-gc" flag though (not sure if this is the same flag name on DMD as it is on GDC/LDC).

The LLDB debugging is worse than the "cppvsdbg" mode IME.

There are no comments on this comment yet.