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

Introducing SimpleEditorContext for simple widget editors #123130

Merged
merged 1 commit into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/vs/editor/contrib/clipboard/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export const CutAction = supportsCut ? registerCommand(new MultiCommand({
group: '',
title: nls.localize('actions.clipboard.cutLabel', "Cut"),
order: 1
}, {
menuId: MenuId.SimpleEditorContext,
group: CLIPBOARD_CONTEXT_MENU_GROUP,
title: nls.localize('actions.clipboard.cutLabel', "Cut"),
when: EditorContextKeys.writable,
order: 1,
}]
})) : undefined;

Expand Down Expand Up @@ -91,6 +97,11 @@ export const CopyAction = supportsCopy ? registerCommand(new MultiCommand({
group: '',
title: nls.localize('actions.clipboard.copyLabel', "Copy"),
order: 1
}, {
menuId: MenuId.SimpleEditorContext,
group: CLIPBOARD_CONTEXT_MENU_GROUP,
title: nls.localize('actions.clipboard.copyLabel', "Copy"),
order: 2,
}]
})) : undefined;

Expand Down Expand Up @@ -126,6 +137,12 @@ export const PasteAction = supportsPaste ? registerCommand(new MultiCommand({
group: '',
title: nls.localize('actions.clipboard.pasteLabel', "Paste"),
order: 1
}, {
menuId: MenuId.SimpleEditorContext,
group: CLIPBOARD_CONTEXT_MENU_GROUP,
title: nls.localize('actions.clipboard.pasteLabel', "Paste"),
when: EditorContextKeys.writable,
order: 4,
}]
})) : undefined;

Expand Down
3 changes: 2 additions & 1 deletion src/vs/editor/contrib/contextmenu/contextmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ export class ContextMenuController implements IEditorContribution {
}

// Find actions available for menu
const menuActions = this._getMenuActions(this._editor.getModel(), MenuId.EditorContext);
const menuActions = this._getMenuActions(this._editor.getModel(),
this._editor.isSimpleWidget ? MenuId.SimpleEditorContext : MenuId.EditorContext);

// Show menu if we have actions to show
if (menuActions.length > 0) {
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/actions/common/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class MenuId {
static readonly DebugWatchContext = new MenuId('DebugWatchContext');
static readonly DebugToolBar = new MenuId('DebugToolBar');
static readonly EditorContext = new MenuId('EditorContext');
static readonly SimpleEditorContext = new MenuId('SimpleEditorContext');
static readonly EditorContextCopy = new MenuId('EditorContextCopy');
static readonly EditorContextPeek = new MenuId('EditorContextPeek');
static readonly EditorTitle = new MenuId('EditorTitle');
Expand Down