microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.6k stars 274 forks source link

Add tasks support to devcontainer.json #9951

Open rubensa opened 2 months ago

rubensa commented 2 months ago

Looks like, currently, only launch configurations are supported inside devcontainer.json.

You can define launch configurations in devcontainer.json like:

{
  "customizations": {
    "vscode": {
      "settings": {
        "launch": {
          "configurations": [
          ]
        },
      }
    }
  }
}

It would be great to have the same but for tasks. Something like:

{
  "customizations": {
    "vscode": {
      "settings": {
        "tasks": [
        ],
      }
    }
  }
}

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.

VSCodeTriageBot commented 2 months ago

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!

VSCodeTriageBot commented 1 month ago

:slightly_smiling_face: 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!

benzman81 commented 3 weeks ago

This would be great, for now, we have to copy our default tasks in all our workspaces :-(

alexanderilyin commented 1 week ago

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.

chrmarti commented 1 week ago

@sandy081 I didn't know this works: "tasks" is shown as unknown configuration setting in the remote settings, but the task is shown in Run Task and correctly runs.

sandy081 commented 5 days ago

It is working because tasks are loaded as part of settings.

chrmarti commented 4 days ago

@sandy081 Should it become part of the schema?

sandy081 commented 2 hours ago

It is not official to support tasks inside settings. Its an implementation detail. To support it officially, you should have a separate tasks section in devContainer.json and create the tasks file in the remote machine, just like settings.json.

rubensa commented 2 hours ago

@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.

// Global debug launch configuration. Should be used as an alternative to 'launch.json' that is shared across workspaces. "launch": { "configurations": [], "compounds": [] },

sandy081 commented 1 hour ago

User launch configuration is supported as a setting, but, IMO it is not the right way and hence user tasks use a separate file.