code-d icon indicating copy to clipboard operation
code-d copied to clipboard

Launching a dub project from a nested directory

Open AlexanderZhirov opened this issue 4 years ago • 4 comments

I have a nested DUB projects structure (example_1, example_2, ...):

изображение

When I create a new project, I want to run it without reconfiguring the project path using universal variables. When you press Ctrl+Shift+B, the assembly and launch of the open current file is successful. It is not possible to configure debugging for the DUB project, because the paths are not recognized. I tried to configure manually, but the project is still not going to.

2021-11-08_15-48

But running the usual debugging works fine.

2021-11-08_15-46

AlexanderZhirov avatar Nov 08 '21 15:11 AlexanderZhirov

the problem is that in the bottom configuration you have dubBuild set to true and that build is failing because it seems code-d is not spawning dub in the correct directory.

In the top one I'm not even sure how that is running because dubTarget should return an absolute path, so the src/ prefix would mess that one up.

Can you add "args": ["${command:dubTarget}", "${command:dubTargetName}", "${command:dubWorkingDirectory}"] to your launch config and add string[] args in your D main, build it manually and then in the debugger look at the values?

WebFreak001 avatar Nov 08 '21 15:11 WebFreak001

Can you add "args": ["${command:dubTarget}", "${command:dubTargetName}", "${command:dubWorkingDirectory}"] to your launch config and add string[] args in your D main, build it manually and then in the debugger look at the values?

After passing the arguments, I got this output:

["/mnt/lin_disk_data/Programming/D/d-language/src/example_1/bin/example_1", "example_1", "example_1", "/mnt/lin_disk_data/Programming/D/d-language/src/example_1/"]

I launched it with this configuration:

изображение

In the top one I'm not even sure how that is running because dubTarget should return an absolute path, so the src/ prefix would mess that one up.

Yes, I have now corrected this parameter to:

"program": "${command:dubWorkingDirectory}/bin/${command:dubTargetName}"

Now we need to somehow try to build the project through DUB debugging... 🧐

AlexanderZhirov avatar Nov 08 '21 16:11 AlexanderZhirov

I noticed another feature. When creating a NEW dub project, it is necessary to reboot VSCode, since it does not detect the created project, while pulling up the configuration from the previous project.

Before restarting VSCode:

изображение

After restarting VSCode:

изображение

AlexanderZhirov avatar Nov 09 '21 01:11 AlexanderZhirov

create a separate issue for that

WebFreak001 avatar Nov 09 '21 08:11 WebFreak001