I'm trying to build files in vscode with an "unsupported" compiler. Therefore I've created a task to start the compiler and this works perfectly, as long as the source and destination files are given. I give my source file as ${file}
and vscode correctly substitutes this with the source file. For the destination file I have to use the same filename but change it's extension.
Is it possible for me to create a string variable in .json, copy the value of my ${file}
string into that and use change its extension before using it as an argument?
My tasks.json is below, my sourcefile ${file}
= "C:\_projects\Customer\Logging\LogAsync\ASyncLog\Server.kl"
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": ".\\ktrans.exe",
"problemMatcher": [],
"options": {
"cwd": "C:\\Program Files (x86)\\FANUC\\WinOLPC\\bin\\"
},
"args": [
"${file}",
"C:\\_projects\\Customer\\Logging\\LogAsync\\ASyncLog\\Server.pc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
CodePudding user response:
Yes, you can use ${file} to generate an output "arg" for a task in vscode. To do so, simply add the following line to your tasks.json file:
"args": ["${file}"]
CodePudding user response:
Thanks all for helping. My working code is below for other peaple who came here searching for how to compile Fanuc Karel in vscode:
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": ".\\ktrans.exe",
"problemMatcher": [],
"options": {
"cwd": "C:\\Program Files (x86)\\FANUC\\WinOLPC\\bin\\"
},
"args": [
"${file}",
"${fileDirname}\\${fileBasenameNoExtension}.pc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}