Skip to content
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

Determine launch.json configuration field from result of task #237607

Open
michaeleisel opened this issue Jan 9, 2025 · 1 comment
Open

Determine launch.json configuration field from result of task #237607

michaeleisel opened this issue Jan 9, 2025 · 1 comment
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality

Comments

@michaeleisel
Copy link

michaeleisel commented Jan 9, 2025

I have a program that I run via a launch.json config, where the program's path gets determined by the preLaunchTask. The task writes a file out with the path, and the launch config reads from that path:

tasks.json

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "gen_file_path",
        "type": "shell",
        "command": "/path/to/gen_file_path",
        "problemMatcher": []
      }
    ],
}

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run C++",
            "type": "cppdbg",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "program": "${input:fileContent}",
            "preLaunchTask": "gen_file_path"
        },
    ],
    "inputs": [
        {
            "id": "fileContent",
            "type": "command",
            "command": "extension.commandvariable.file.content",
            "args": {
                "fileName": "/path/to/output_from_task"
            }
        }
    ]
}

However, this fails because VSCode reads from the file before the preLaunchTask runs, so it can't get the new output. Is there any way to populate a field in a launch.json configuration from the output of a task?

@roblourens roblourens added feature-request Request for new features or functionality debug Debug viewlet, configurations, breakpoints, adapter issues labels Jan 10, 2025
@vs-code-engineering vs-code-engineering bot added this to the Backlog Candidates milestone Jan 10, 2025
Copy link

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants