-
Notifications
You must be signed in to change notification settings - Fork 302
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
Add tasks support to devcontainer.json #9951
Comments
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
This would be great, for now, we have to copy our default tasks in all our workspaces :-( |
I feel like it worked already before... P. S. VSCode: 0 Me: 1 "customizations": {
"vscode": {
"settings": {
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "echo Hello"
}
]
}, P. P. S. I found some section in docs (or some info that it might work that way) year ago or so, but yes it took a while. |
@sandy081 I didn't know this works: |
It is working because |
@sandy081 Should it become part of the schema? |
It is not official to support tasks inside settings. Its an implementation detail. To support it officially, you should have a separate |
@sandy081 From your answer I suppose that the launch configuration in devcontainer.json is also not supported (just another implementation detail)? But this is "documented" as a setting.
|
User launch configuration is supported as a setting, but, IMO it is not the right way and hence user tasks use a separate file. |
So, currently, implementation is "consistent" (as both launch and tasks are supported under And, in your opinion, launch support under Isn't it? PS: In my opinion, as you can imagine as I opened the issue, this support is useful to allow setting default workspace tasks and launch configurations. |
Are we doing duplication here? One can have workspace tasks and launches already in the workspace under |
@sandy081 We want to have some "default" workspace settings pushed to git repository (in .devcontainer/devcontainer.json) + allow for custom developer configs not pushed to git repository (in .vscode/*). This way, anyone checking out the repository has a default "ready to run" configuration but he is able to "customize" it as needed by setting it's own config under .vscode (which is in .gitignore). |
I think this can be pushed into git repository under |
But is "difficult" to keep local changes not pushed by mistake. With my proposal (and current implementation, indeed) you have not to worry about local changes that should not be pushed. The developer is free to have working defaults but also is free to "augment" or "personalize" those. |
But it is preventing to work on the repo just by cloning.
This problem is true for all projects. There is already a request to support this feature and it should be supported in the right way. This is just a workaround which seems not to a generic solution. |
As a side note: We also have a mechanism that allows to install some default workspace extensions (by setting them in .devcontainer/devcontainer.json) but allows the developer to "automatically" install custom extensions (by an automatic task that check for the presence of a custom, not git pushed, .devcontainer/extensions.local.json file and installs the extensions defined there). This way the developer does not "lose" any manually installed extension on container rebuild. |
What do yo mean by "it is preventing to work on the repo just by cloning"? You mean it prevents you to work cause you do not have the VSCode tasks configured? But we are talking about devcontainer development, isn't it? So you wont be able to work just by cloning cause you probably wont have the needed software installed in your "host" machine (as it is not going to use the Docker image and install the needed features...)
I agree there might be much better solutions (and the pointed proposal of having xx.local.xx files seems very similar to my noted solution for extension installations) but, to me, it is not that bad and is the only "currently" available (indeed, I'm just using it right now in some projects). |
Hi, our team uses a single devcontainer with multiple workspaces since they all require the same setup. However, we're currently forced to copy the necessary tasks into each .code-workspace file, which is error-prone. The only section that needs duplication is the tasks block; all other shared settings are already centralized in the devcontainer file. Our goal is to have a single file that contains all tasks and settings needed across workspaces, leaving the .code-workspace files to define only the workspace folders. This would streamline our workflow and reduce the risk of errors. We hope this request helps in considering this feature for future releases. |
@benzman81 This makes sense to me. My recommendation here is to have separate section/file for tasks in devContainer and on remote machine. CC @meganrogge I think you are owning tasks feature now. |
As a side note about current implementation on tasks support inside devcontainer.json... If you have a multi-root workspace defined, and you have a task configured with |
For me, this functionality is also essential in cases, for example, where the task needs something that does not exist on the person's machine but exists in the devcontainer. Assuming we have an |
Looks like, currently, only launch configurations are supported inside devcontainer.json.
You can define launch configurations in devcontainer.json like:
It would be great to have the same but for tasks. Something like:
This way we could have a set of predefined launch and tasks configurations available in the devcontainer (and checked in the git repository, as they are inside the devcontainer.json file) and allow the user to "extend" those configurations locally (by adding them to .vscode folder that might be added to .gitignore).
NOTE: I suppose this should also be added to .code-workspace settings implementation (as, under the hood, looks like devcontainers are using the workspace settings mechanism) and documented in default settings.
The text was updated successfully, but these errors were encountered: