-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for and use .devcontainer.json in subdirectories #2413
Comments
Thanks for opening this issue! I believe this ties back to #1460. Although 1460 focuses on the multi-container scenario, it seems like the main ask is still to have VS Code look beyond the root level for a dev container definition. If I'm understanding your ask and its relationship to the other issue correctly, I'll go ahead and close this thread so that we can focus our discussion there. |
@bamurtaugh This issue and #1460 are related, but not the same thing:
For these reasons, while I understand and agree with your thinking in terms of housekeeping, I would suggest that we keep this issue open, as it's separate from #1460. Implementing either of them won't solve the other one, hence they are separate and cannot be tracked in one and the same issue (by merging one of them into the other). |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@rawtaz I appreciate your response here. I had a similar thought/hesitancy, and based on your comment as well, I'll keep this issue open as a separate feature request. |
Thank you! :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Is there any update on this issue? I would like to simply be able to have VsCode open a SINGLE devcontainer.json and etc; just from some other place than .devcontainers in the root....say ./application/.devcontainer/ with all the normal stuff in here where application is nested one or more levels beneath the root. ./application/directory1/directory2/.devcontainer |
https://code.visualstudio.com/remote/advancedcontainers/configure-separate-containers seems to work for me. |
Indeed, this has become available as a stable release in Dev Containers 0.275.0. Closing this issue, thanks. |
It'd be great if VS Code didn't search for .devcontainer/devcontainer.json and .devcontainer.json files in the root workspace folder only, but also in some configurable depth of subfolders (or the entire tree, see below).
Imagine for example the following (simplified pseudo) structure for a web project:
As you can see the actual source code of the project, the files and folders making up what will finally be put into production, is all under the
source/
folder. Many VS Code users would use that folder as their workspace root.However, when you have a project that does contain a lot of material besides the code, material that it doesn't make sense to version control, a workflow is to keep that material in sibling folders to the
source/
folder, as shown above, and open the parent folder of that as the workspace in VS Code. That way one has access to all the material, reference files, backups, etc available in one's workspace in VS Code, alongside the source code.I haven't found a way to make VS Code look further/deeper than the root folder of the workspace for the devcontainer files though. This means that if you like in the example above have your VCS repository in the
source/
folder (since the files above/sibling to that aren't relevant for version control - it's thesource/
folder that's the main actor in the project), and you want to version control the devcontainer files, putting them in thesource/
folder won't work, because VS Code won't detect and make use of them when you open theroot
folder in the example above in VS Code (as opposed to thesource/
folder).I wish that we would have two options to configure this in VS Code:
One option to tell VS Code to look for
.devcontainer/devcontainer.json
and.devcontainer.json
files N levels deep into subfolders to the workspace root folder. E.g.remote.containers.configSearchDepth = 2
would make VS Code search for devcontainer files in both thesource/
folder in the example above, as well as one level of subfolders to that folder (useful when you have a more complex project root folder, e.g. with several differentsource/
folders containing different code).One option to provide an exact path relative to the root workspace folder, for where VS Code should look for
.devcontainer/devcontainer.json
and.devcontainer.json
files. E.g.remote.containers.configSearchPath = 'source/'
would tell VS Code to look for devcontainer files in a subfolder namedsource/
to the workspace root folder.An alternative to this would be to simply make VS Code pick up these files anywhere in the files tree. I'm guessing that VS Code already has a list of all files and that the extension wouldn't have to do a full scan to find such files, instead it can just ask VS Code about it? This guess is based on the Cmd+P showing a really responsive file listing in VS Code, so it appears VS Code already has a list of files in mind.
Let me know if anything in the explanation or use cases is unclear. Thanks!
The text was updated successfully, but these errors were encountered: