Skip to content

Commit 0797fa3

Browse files
committed
Merge branch 'nikonso-git_actions_context_menu'
2 parents 6c84775 + 0c01c63 commit 0797fa3

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

‎extensions/git/package.json‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,23 @@
834834
"when": "config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
835835
}
836836
],
837+
"editor/context": [
838+
{
839+
"command": "git.stageSelectedRanges",
840+
"group": "2_git@1",
841+
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
842+
},
843+
{
844+
"command": "git.unstageSelectedRanges",
845+
"group": "2_git@2",
846+
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
847+
},
848+
{
849+
"command": "git.revertSelectedRanges",
850+
"group": "2_git@3",
851+
"when": "isInDiffRightEditor && config.git.enabled && gitOpenRepositoryCount != 0 && isInDiffEditor && resourceScheme =~ /^git$|^file$/"
852+
}
853+
],
837854
"scm/change/title": [
838855
{
839856
"command": "git.stageChange",

‎src/vs/editor/browser/widget/diffEditorWidget.ts‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,22 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
284284

285285
this._lineChanges = null;
286286

287-
const services = new ServiceCollection();
288-
services.set(IContextKeyService, this._contextKeyService);
287+
const leftContextKeyService = this._contextKeyService.createScoped();
288+
leftContextKeyService.createKey('isInDiffLeftEditor', true);
289289

290-
const scopedInstantiationService = instantiationService.createChild(services);
290+
const leftServices = new ServiceCollection();
291+
leftServices.set(IContextKeyService, leftContextKeyService);
292+
const leftScopedInstantiationService = instantiationService.createChild(leftServices);
291293

292-
this._createLeftHandSideEditor(options, scopedInstantiationService);
293-
this._createRightHandSideEditor(options, scopedInstantiationService);
294+
const rightContextKeyService = this._contextKeyService.createScoped();
295+
rightContextKeyService.createKey('isInDiffRightEditor', true);
296+
297+
const rightServices = new ServiceCollection();
298+
rightServices.set(IContextKeyService, rightContextKeyService);
299+
const rightScopedInstantiationService = instantiationService.createChild(rightServices);
300+
301+
this._createLeftHandSideEditor(options, leftScopedInstantiationService);
302+
this._createRightHandSideEditor(options, rightScopedInstantiationService);
294303

295304
this._reviewPane = new DiffReview(this);
296305
this._containerDomElement.appendChild(this._reviewPane.domNode.domNode);

0 commit comments

Comments
 (0)