Vscode: Support inputs in launch.json

Created on 29 Nov 2018  路  12Comments  路  Source: microsoft/vscode

inputs processing occurs in the configuration resolver service, so not much should need to be done to support inputs:

  • Add inputs to launch.json schema
  • Pass debug section name ('debug'?) into calls to resolveWithInteraction
  • Ensure that the IDebugConfiguration that is returned from IConfigurationService includes the inputs section.
debug feature-request verification-needed verified

Most helpful comment

The section name was missing from here https://github.com/Microsoft/vscode/issues/63987#issue-385758206 馃槉

All 12 comments

@isidorn it would be great if we could support this for debug in November so that our release notes and documentation could cover both tasks and debug.

@alexr00

  • where is the schema currently living? It should be somwhere in the configuratinoResolverService region so we can depend on it both from tasks and debug
  • I can not find any references of resolveWithInteraction can you please give me a pointer ( I did a full text search)

Your third point will just work, so need to wory about that.

Good point on the schema. It is currently in tasks so I will move it. None of this is actually merged yet. I think I can merge it today. I'll let you know.

@alexr00 great, just ping me here

@alexr00 I noticed you merged in the branch, so just a reminder on my questions from above

@isidorn, the schema is here: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/services/configurationResolver/electron-browser/jsonSchemaCommon.ts
Since it is now commited you should see references to resolveWithInteraction now. Debug uses the replace version: resolveWithInteractionReplace.

For this I depend on https://github.com/Microsoft/vscode/issues/64207
Once we tackle that I will just add a support for the schema (which is straight forward).

How does this work in launch.json? I set "program": "${input:echoPrompt}" but where do the inputs go? Tried at the top level or inside the debug config but I just get

Attribute 'program' is not absolute ('${input:echoPrompt}'); consider adding '${workspaceFolder}/' as a prefix to make it absolute.

By using intellisense I could successfully create the "input" section in the launch.json but substitution did not work for me.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceRoot}/${input:programName}",
        }
    ],
    "inputs": [
        {
            "label": "programName",
            "type": "prompt",
            "default": "test.js",
            "description": "The program name"
        }
    ]
}

Assigning to @alexr00 for substition.
@alexr00 let me know if you need help, or if you want me to investigate

The section name was missing from here https://github.com/Microsoft/vscode/issues/63987#issue-385758206 馃槉

This works now (but I found issues #64542 and #64547).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sirius1024 picture sirius1024  路  3Comments

chrisdias picture chrisdias  路  3Comments

curtw picture curtw  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments