I have tried to implement this programatically but I can not get it to work.
This is my VSCode Version:
Version: 1.71.2 (user setup)
Commit: 74b1f979648cc44d385a2286793c226e611f59e7
Date: 2022-09-14T21:03:37.738Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.18363
Sandboxed: No
What I have done is to try the commands related to some shorcuts (ctrl+shift+P -> search for "Open Keyboard shorcuts") using the VSCode API:
vscode.commands.executeCommand("git.openMergeEditor", file)
Because before trying this method the following worked for the diff functionality:
vscode.commands.executeCommand("vscode.diff", file1, file2)
Also, I tried the Git API but it has not the method for doing this as a standalone operation (but the Git API object has an array of Repository objects, which objects have a method to run diff using merge editor)
Here you can see the interfaces declarations:
https://github.com/microsoft/vscode/blob/main/extensions/git/src/api/git.d.ts
My next step was to see this file inside github's repo
https://github.com/microsoft/vscode/blob/main/extensions/git/src/commands.ts
Then I realized there is a command called
@command('git.runGitMergeDiff3')
but inside my VSCode installation it does not seem to exist.
At the end what I want to do is achieve the same than using de CLI with the following command:
code --merge <path1> <path2> <base> <result>
but programatically.