| |
| Posted by Aldo in reply to Paul | PermalinkReply |
|
Aldo
| On Friday, 25 September 2020 at 13:38:56 UTC, Paul wrote:
> Hi Community,
>
> I'm Win10: I have VSCode installed. I have DMD installed and can compile examples from a Win CMD console.
>
> 1) How do I compile and run from within VSCode?
> 2) VSCode Extensions:
> Do I need them?
> One kept generating errors and a note said it was not under active development so I
> uninstalled it.
> The remaining two are by WebFreak. Are they working? Do I need them?
>
> Thanks for your time.
In VSCode the best way to work is by using dub directly. You should have a terminal on the bottom, just type dub it will compile & run your app. Or if you want you can use the vscode build system, create a new task in your project (Ctrl+Shift+B) and add the following task for example:
{
"label": "Compile and run",
"type": "shell",
"command":"dub",
"group": {
"kind": "build",
"isDefault": true
}
}
For debugging (on windows), I use the "C/C++" extension and the F5 key. It will create a launch.json file in "C:/projectPath/.vscode/launch.json". You just need to add something like that in this file:
{
"name": "(Windows) Debug",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/yourexecutable.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
}
Don't forget to enable breakpoints everywhere in your VSCode settings (Allow Breakpoints Everywhere checkbox).
|