Skip to content

Commit f942bb8

Browse files
committed
Added check to see if the command parameter is undefined and show an error notification.
1 parent a416ba4 commit f942bb8

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ For example, this sets up Beyond Compare 4 on Windows:
3030
trustexitcode = true
3131
```
3232

33-
`keepbackup = false` prevents the system from creating `.orig` backup files after a merge. `trustexitcode = true` tells Git that the diff tool's exit code can be trusted to determine the outcome of the merge.
33+
`keepbackup = false` prevents the system from creating `.orig` backup files after a merge. `trustexitcode = true` tells Git that the diff tool's exit code can be trusted to determine the outcome of the merge.
34+
35+
## Changelog
36+
37+
### 1.0.5
38+
2021-10-02
39+
- Added configuration option to disable the notification on launching the tool.
40+
- Added error notification if VSCode fails to provide the command parameter, which can sometimes happen when the merge conflict list is being refreshed.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"name": "git-diff-and-merge-tool",
33
"displayName": "Git Diff and Merge Tool",
44
"description": "Launch git difftool and mergetool from VSCode.",
5-
"version": "1.0.4",
5+
"version": "1.0.5",
66
"author": {
77
"name": "David Rickard",
88
"email": "david.rickard@gmail.com"
99
},
10-
"publisher": "david-rickard",
10+
"publisher": "RandomEngy",
1111
"repository": "https://github.com/RandomEngy/VSCodeGitDiffAndMergeTool",
1212
"bugs": {
1313
"url": "https://github.com/RandomEngy/VSCodeGitDiffAndMergeTool/issues"

src/extension.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export function activate(context: vscode.ExtensionContext) {
1919
commandParam: any,
2020
gitArgumentsFunc: (targetFile: string) => string[],
2121
infoMessageFunc: (targetFile: string) => string): Promise<void> {
22+
if (!commandParam) {
23+
vscode.window.showErrorMessage('Could not launch merge tool. VSCode did not supply command parameters. Try again in a few seconds.');
24+
return;
25+
}
26+
2227
const fullTargetFilePath: string = commandParam.resourceUri.fsPath;
2328

2429
const simpleGit = await import('simple-git');
@@ -29,7 +34,7 @@ export function activate(context: vscode.ExtensionContext) {
2934
if (fullTargetFilePath.startsWith(projectPath)) {
3035
var targetFile = getRelativeItemPath(projectPath, fullTargetFilePath);
3136
if (targetFile === null) {
32-
vscode.window.showWarningMessage('Could not get target path.');
37+
vscode.window.showErrorMessage('Could not get target path.');
3338
return;
3439
}
3540

@@ -50,7 +55,7 @@ export function activate(context: vscode.ExtensionContext) {
5055
}
5156
}
5257

53-
vscode.window.showWarningMessage('Could not find workspace for ' + fullTargetFilePath);
58+
vscode.window.showErrorMessage('Could not find workspace for ' + fullTargetFilePath);
5459
}
5560
}
5661

0 commit comments

Comments
 (0)