rules_rust icon indicating copy to clipboard operation
rules_rust copied to clipboard

Generate `rust-project.json` in an arbitrary directory.

Open reiyw opened this issue 4 years ago • 5 comments

I want to place rust-project.json in an arbitrary directory instead of the project root, but simply moving it does not work because rust-project.json has relative paths to modules. Could you please suggest me any workaround?

reiyw avatar Jun 29 '21 10:06 reiyw

Hi @reiyw

There is unfortunately no workaround. We did hear this feature request in the past, it does sound like an important use case to cover. We just have been occupied by other issues. If you have capacity to spend some time on a PR, I'm happy to guide you.

hlopko avatar Jul 01 '21 06:07 hlopko

Hi @hlopko

Thank you for your reply! I'm not familiar with Bazel extensions, but I'm willing to contribute. I'll take a closer look at the implementation this weekend.

reiyw avatar Jul 01 '21 16:07 reiyw

One note (that I didn't think about before :) - I use VSCode, and one reason to create a VSCode workspace in a subdirectory is so I don't see all the unrelated packages. But that can be achieved by exclude-ing unwanted packages in VSCode settings.json.

One think to be careful about - creating a workspace in a subdirectory can break debugging in VSCode.

hlopko avatar Jul 07 '21 13:07 hlopko

One think to be careful about - creating a workspace in a subdirectory can break debugging in VSCode.

You can do debugging in vscode?! How?! 🙏 😄

Don't want to derail this thread but that'd be an awesome doc to have somewhere.

UebelAndre avatar Jul 07 '21 13:07 UebelAndre

I agree there should be a doc. This is what I have in my notes:

Debugging with CodeLLDB, assuming your VSCode workspace is rooted at the workspace directory, you setup your launch.json as follows:
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "Debug //foo/bar:yolo",
            "program": "${workspaceFolder}/bazel-bin/foo/bar/yolo",
            "args": [],
            "sourceMap": {
                ".": "${workspaceFolder}/"
            },
        },
    ]
}

hlopko avatar Jul 22 '21 13:07 hlopko