mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
add git.experimental.mergeEditor
setting to enable/disable merge editor for conflicting files
This commit is contained in:
parent
1ed660b17e
commit
38931b6a3d
|
@ -2445,6 +2445,12 @@
|
|||
],
|
||||
"markdownDescription": "%config.logLevel%",
|
||||
"scope": "window"
|
||||
},
|
||||
"git.experimental.mergeEditor": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"markdownDescription": "%config.experimental.mergeEditor%",
|
||||
"scope": "window"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -236,6 +236,7 @@
|
|||
"config.logLevel.error": "Log only error, and critical information",
|
||||
"config.logLevel.critical": "Log only critical information",
|
||||
"config.logLevel.off": "Log nothing",
|
||||
"config.experimental.mergeEditor": "Open the _experimental_ merge editor for files that are currently under conflict.",
|
||||
"submenu.explorer": "Git",
|
||||
"submenu.commit": "Commit",
|
||||
"submenu.commit.amend": "Amend",
|
||||
|
|
|
@ -296,6 +296,10 @@ export class Resource implements SourceControlResourceState {
|
|||
const command = this._commandResolver.resolveChangeCommand(this);
|
||||
await commands.executeCommand<void>(command.command, ...(command.arguments || []));
|
||||
}
|
||||
|
||||
clone() {
|
||||
return new Resource(this._commandResolver, this._resourceGroupType, this._resourceUri, this._type, this._useIcons, this._renameResourceUri);
|
||||
}
|
||||
}
|
||||
|
||||
export const enum Operation {
|
||||
|
@ -602,18 +606,21 @@ class ResourceCommandResolver {
|
|||
resolveChangeCommand(resource: Resource): Command {
|
||||
const title = this.getTitle(resource);
|
||||
|
||||
if (!resource.leftUri && resource.rightUri && resource.type === Status.BOTH_MODIFIED) {
|
||||
return {
|
||||
command: '_git.openMergeEditor',
|
||||
title: localize('open.merge', "Open Merge"),
|
||||
arguments: [resource.rightUri]
|
||||
};
|
||||
} else if (!resource.leftUri) {
|
||||
return {
|
||||
command: 'vscode.open',
|
||||
title: localize('open', "Open"),
|
||||
arguments: [resource.rightUri, { override: resource.type === Status.BOTH_MODIFIED ? false : undefined }, title]
|
||||
};
|
||||
if (!resource.leftUri) {
|
||||
const bothModified = resource.type === Status.BOTH_MODIFIED;
|
||||
if (resource.rightUri && bothModified && workspace.getConfiguration('git').get<boolean>('experimental.mergeEditor', false)) {
|
||||
return {
|
||||
command: '_git.openMergeEditor',
|
||||
title: localize('open.merge', "Open Merge"),
|
||||
arguments: [resource.rightUri]
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
command: 'vscode.open',
|
||||
title: localize('open', "Open"),
|
||||
arguments: [resource.rightUri, { override: bothModified ? false : undefined }, title]
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
command: 'vscode.diff',
|
||||
|
@ -918,6 +925,12 @@ export class Repository implements Disposable {
|
|||
onConfigListener(updateIndexGroupVisibility, this, this.disposables);
|
||||
updateIndexGroupVisibility();
|
||||
|
||||
workspace.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('git.experimental.mergeEditor')) {
|
||||
this.mergeGroup.resourceStates = this.mergeGroup.resourceStates.map(r => r.clone());
|
||||
}
|
||||
}, undefined, this.disposables);
|
||||
|
||||
filterEvent(workspace.onDidChangeConfiguration, e =>
|
||||
e.affectsConfiguration('git.branchSortOrder', root)
|
||||
|| e.affectsConfiguration('git.untrackedChanges', root)
|
||||
|
|
Loading…
Reference in a new issue