vscli icon indicating copy to clipboard operation
vscli copied to clipboard

Specifying a custom container path does not work.

Open lohrm-stabl opened this issue 11 months ago • 1 comments

vscli open -b force-container -c /home/me/projects/vscli/.devcontainer/devcontainer.json /workspace/vscli/tests

Error:
   0: Path /workspace/vscli/subfolder does not exist

Location:
   src/workspace.rs:86

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Does not work.

lohrm-stabl avatar Mar 11 '24 08:03 lohrm-stabl

This is because the second path needs to be specified as a path which is outside the container and it needs to point to an actual vscode workspace.

So this works for example:

vscli open -b force-container -c /home/michi/dev/vscli/.devcontainer/devcontainer.json /home/michi/dev/wslpath2

Works fine.

However, it seems like if the folder you are trying to open does not contain a .devcontainer even though you specified one by URL, this does not work:

❯ vs -b force-container -c /home/michi/dev/vscli/.devcontainer/devcontainer.json /home/michi/dev/wslpath2/target 

image However, if I select the target workspace from this UI. image

I can see that the workspace path is relative to the devcontainer: image

So it seems like vscode then tries to find the 'nearest' devcontainer and launch relatively from there?

This means we could possible fix this by finding the nearest devcontainer and then appending the relative path from there to there: https://github.com/michidk/vscli/blob/main/src/workspace.rs#L41

michidk avatar Sep 14 '24 13:09 michidk