-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Add debug window context menu contribution points #212501
base: main
Are you sure you want to change the base?
Changes from all commits
3eb8783
d06ef30
508dd57
98ae6c3
5b4516f
35f0f42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import { stripIcons } from '../../../../base/common/iconLabels.js'; | |
import { coalesce } from '../../../../base/common/arrays.js'; | ||
import { Event, Emitter } from '../../../../base/common/event.js'; | ||
import { AnchorAlignment, AnchorAxisAlignment, isAnchor } from '../../../../base/browser/ui/contextview/contextview.js'; | ||
import { IMenuService } from '../../../../platform/actions/common/actions.js'; | ||
import { IMenuService, MenuItemAction } from '../../../../platform/actions/common/actions.js'; | ||
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js'; | ||
import { Disposable } from '../../../../base/common/lifecycle.js'; | ||
|
||
|
@@ -252,7 +252,10 @@ class NativeContextMenuService extends Disposable implements IContextMenuService | |
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', { id: actionToRun.id, from: 'contextMenu' }); | ||
} | ||
|
||
const context = delegate.getActionsContext ? delegate.getActionsContext(event) : undefined; | ||
// Determine whether the action source is contributed via a proxy (e.g. from an external extension) | ||
// Context will need to be serializable (e.g. no recursive structures) | ||
const contributedAction = (actionToRun instanceof MenuItemAction) && actionToRun?.item?.source; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to the existing context menus already utilising referenced objects in their commands which cannot be serialised (e.g. due to circular references or bigint types), a mechanism is required to determine if the context menu item has been contributed by an external extension. The method chosen here relies on a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't try to use two different contexts for one toolbar. That is one thing that has always been an issue with exposing menus to extensions, and I'm not sure whether there's a better way to handle it, I will try to discuss that this week. |
||
const context = delegate.getActionsContext ? delegate.getActionsContext(event, !!contributedAction) : undefined; | ||
|
||
const runnable = actionRunner.run(actionToRun, context); | ||
try { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
// empty placeholder for debug context menus | ||
|
||
// https://github.com/microsoft/vscode/issues/200880 @thegecko |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this ID is meaningful or exposed to extensions elsewhere, or is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could be right, but it may be useful as a unique ID?