In Visual Studio Codium I want to define a command that has a variable parameter.
I want the IDE to open specific file, which name is written in another file. Assume I have the following project structure:
/home/user/myproject/
/home/user/myproject/dir1/
/home/user/myproject/dir1/problem1.py
/home/user/myproject/dir1/problem2.py
/home/user/myproject/dir2/problem1.py
...
/home/user/myproject/pointer.txt
The pointer.txt
contains path to the file I want to work on. For example, it contains:
dir1/problem1
.
I have read the documentation here. Now I created the following construction:
keybindings.json
:
{
"key": "numpad3",
"command": "htmlRelatedLinks.openFile",
"args": {
"file": "${workspaceFolder}/${input:mycatinput}.py",
"method": "vscode.open",
"viewColumn": 2,
}
},
tasks.json
:
{
"version": "2.0.0",
"tasks": [
{
"label": "mycat",
"type": "shell",
"command": "cat /home/user/myproject/pointer.txt"
},
],
"inputs": [
{
"id": "mycatinput",
"type": "command",
"command": "workbench.action.tasks.runTask",
"args": "mycat"
}
]
}
But when I press numpad3, I get an error notification with text: Unable to open '${input:mycatinput}.py': File not found.
Am I missing something? How do I specify a variable in keybindings.json command, which itself is a result of another command (a shell command, not a vscode command).