augustocdias / vscode-shell-command

A task helper to use system commands as input
MIT License
51 stars 19 forks source link

1.9.0 introduced bug: Could not find input with command {command} and taskId 'undefined'. #79

Closed tmaslach closed 8 months ago

tmaslach commented 8 months ago

Hi!

First of all, thank-you for creating this product! It has been very helpful in enhancing the vscode experience.

It looks like the recent 1.9.0 release has broken our use case. I've created a simple case below that should outline the problem.

You will need to install another extension: rioj7.command-variable (Command Variable). Latest version (1.61.1) works fine.

  1. Create a new folder with the following tasks.json file placed in .vscode folder: tasks.json
  2. Open that folder in vscode.
  3. Go to command palette, Run Task -> Test Shell Command -> Select Target. Hit enter on Select Target
  4. A error box will pop up in vscode stating the following: Could not find input with command 'echo 'ItWorked'' and taskId 'undefined'.

It does work fine with 1.8.2, but not with 1.9.0.

I have not dug into the changes in the past 11 months. The fact that the taskid is undefined does seem wrong. Any ideas?

Thank-you!

tmaslach commented 8 months ago

Per the error message, it does look like it is throwing from shell command extension. But, if I factor out the command variable extension, it works fine. Maybe there is some interplay going on here between the two extensions?

MarcelRobitaille commented 8 months ago

I'm able to reproduce this. The bad commit is e564d564facd17b673a5c7c90cf122255d0b7d4c

MarcelRobitaille commented 8 months ago

Please check if this branch works for you: https://github.com/augustocdias/vscode-shell-command/tree/feature/nested_input

tmaslach commented 8 months ago

Perfect! It works!

Thank-you!

tmaslach commented 8 months ago

Hi - is there any chance of release a new update with the version soon? Thanks again..

MarcelRobitaille commented 6 months ago

Here is the tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Test Shell Command",
            "detail": "Test of Shell Command",
            "type": "shell",
            "command": "echo ${input:testShellCommand}",
            "presentation": {
                "clear": true,
                "echo": true,
                "focus": true,
                "panel": "shared"
            },
            "group": "build",
        },
    ],
    "inputs" : [
        {
            // Prompts the user to select a target and stores the target name in the remember store as 'selectedBazelTarget'
            "id": "testShellCommand",
            "type": "command",
            "command": "extension.commandvariable.pickStringRemember",
            "args": {
                "description": "Choose a target",
                "key": "selectedBazelTarget",
                "rememberTransformed": true,
                "options": [
                    { "label": "Select Target", "value": "${command:bazelTargets}", "description": "NOTE: It may take some time for the selection list to be displayed" }
                ],
                "command": {
                    "bazelTargets": {
                        "command": "shellCommand.execute",
                        "args": {
                            "command": "echo 'ItWorked'",
                            "cwd": "${workspaceFolder}"
                        }
                    }
               }
            }
        }
    ]
}