2

I am trying to build an extension for vscode for a specific file format. Now I want to run a custom build script (a batch file that is placed inside the custom extension) that gets exectued when the user presses ctrl+shift+B

I successfully created such a behaviour in a sublime3 extension where the sublime-build script looks like that:

{
    "working_dir": "${project_path:${folder:${file_path}}}",
    "shell": true,
    "osx":
    {
        "cmd": ["cd '$packages/myextension/buildscript/'  && ./mybuildscript.sh $file"]
    },
    "windows":
    {
        "shell_cmd": "cd '$packages/myextension/buildscript/'  && ./mybuildscript.bat $file",
    },
    "linux":
    {
        "cmd": ["cd '$packages/myextension/buildscript/'  && ./mybuildscript.sh $file"]
    }
}

Can you provide an example how something similar can be done in the vscode extension?

tmp
  • 21
  • 2
  • The usual approach here is to register a vscode command in package.json, write a handler for that in your extension.js/ts file and launch a child process for that script (or do all the work in the extension, which gives you even more power than what you have in your script). – Mike Lischke Feb 11 '22 at 13:14

0 Answers0