emeraldwalk / vscode-runonsave

Visual Studio Code extension to run commands whenever a file is saved.
Apache License 2.0
182 stars 57 forks source link

Run other vscode extension on save #46

Open vedartm opened 4 years ago

vedartm commented 4 years ago

Is there any option to run another extension command inside cmd? For example,

            {
                "match": "\\.dart",
                "cmd": "dart-import.fix"
            }

where dart-import.fix is the command from another extension

jednano commented 4 years ago

Are you aware of the built-in vscode feature, codeActionsOnSave?

// settings.json
{
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
}

You can also scope it to a particular language, something like:

  "[dart]": {
    "editor.codeActionsOnSave": {
      "dart-import.fix": true 
    }
  },
vedartm commented 4 years ago

I am aware of that but I cannot use it to trigger a command from another extension. Basically on save it should trigger this extension - https://github.com/luanpotter/vscode-dart-import

dart-import.fix or source.fixAll does not work like the extension does.

My question is, is there any way trigger this external extension command on save instead of calling it seperately