Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes diff editor precondition commands. #192747

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class ToggleCollapseUnchangedRegions extends Action2 {
title: { value: localize('toggleCollapseUnchangedRegions', "Toggle Collapse Unchanged Regions"), original: 'Toggle Collapse Unchanged Regions' },
icon: Codicon.map,
toggled: ContextKeyExpr.has('config.diffEditor.hideUnchangedRegions.enabled'),
precondition: ContextKeyExpr.has('isInDiffEditor'),
menu: {
id: MenuId.EditorTitle,
order: 22,
Expand All @@ -47,6 +48,7 @@ export class ToggleShowMovedCodeBlocks extends Action2 {
super({
id: 'diffEditor.toggleShowMovedCodeBlocks',
title: { value: localize('toggleShowMovedCodeBlocks', "Toggle Show Moved Code Blocks"), original: 'Toggle Show Moved Code Blocks' },
precondition: ContextKeyExpr.has('isInDiffEditor'),
});
}

Expand All @@ -64,6 +66,7 @@ export class ToggleUseInlineViewWhenSpaceIsLimited extends Action2 {
super({
id: 'diffEditor.toggleUseInlineViewWhenSpaceIsLimited',
title: { value: localize('toggleUseInlineViewWhenSpaceIsLimited', "Toggle Use Inline View When Space Is Limited"), original: 'Toggle Use Inline View When Space Is Limited' },
precondition: ContextKeyExpr.has('isInDiffEditor'),
});
}

Expand All @@ -84,7 +87,10 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
},
order: 11,
group: '1_diff',
when: EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached,
when: ContextKeyExpr.and(
EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached,
ContextKeyExpr.has('isInDiffEditor'),
),
});

MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
Expand All @@ -96,6 +102,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
},
order: 10,
group: '1_diff',
when: ContextKeyExpr.has('isInDiffEditor'),
});

const diffEditorCategory: ILocalizedString = {
Expand Down