rioj7 / command-variable

Visual Studio Code extension for variable substitution via ${command:commandID}
54 stars 10 forks source link

Support passing dateTime calculated var from launch.json to tasks.json #69

Closed Denis-Alexeev closed 1 year ago

Denis-Alexeev commented 1 year ago

Hi.

I have a configuration in launch.json, where I execute my tests and store the test results into the folder with uniq name. The name includes the result of extension.commandvariable.dateTime. After the test execution I want to start postDebugTask in order to handle the results of the tests. But for that I need to have the name of the directory where the results are stored. So the question is: is it possible to pass the result of extension.commandvariable.dateTime from launch.json to tasks.json? Or maybe there is another simpler way to solve my problem? Any help is appreciated.

Thank you for the excellent extension. I really love it!!!

rioj7 commented 1 year ago

@Denis-Alexeev

You can use the command Transform

It has a key argument that is a name for the Remember command

Use the following input item in launch.json

You have to fill in your arguments for the dateTime command: "args": { }

    {
      "id": "getTestDate",
      "type": "command",
      "command": "extension.commandvariable.transform",
      "args": {
        "text": "${command:testDate}",
        "key": "testDate",
        "command": {
          "testDate": {
            "command": "extension.commandvariable.dateTime",
            "args": {  }
          }
        }
      }
    }

in tasks.json use the key testDate for the remember command.

Denis-Alexeev commented 1 year ago

@rioj7 Excellent! That is what I need. Thank you very much. I really appreciate it. You are awesome!