-
Notifications
You must be signed in to change notification settings - Fork 5.9k
/
Copy pathmenuRegistry.ts
40 lines (36 loc) · 1.64 KB
/
menuRegistry.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { IDisposable } from "vs/base/common/lifecycle";
import * as actions from "vs/platform/actions/common/actions";
import { CloseWorkspaceAction } from "vs/workbench/browser/actions/workspaceActions";
import { OpenProcessExplorer } from "vs/workbench/contrib/issue/electron-browser/issueActions";
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions/developerActions";
import { OpenPrivacyStatementUrlAction, OpenRequestFeatureUrlAction, OpenTwitterUrlAction } from "vs/workbench/electron-browser/actions/helpActions";
import { CloseCurrentWindowAction, NewWindowAction, ShowAboutDialogAction } from "vs/workbench/electron-browser/actions/windowActions";
import { REVEAL_IN_OS_COMMAND_ID } from "vs/workbench/contrib/files/browser/fileCommands";
const toSkip = [
ToggleDevToolsAction.ID,
OpenTwitterUrlAction.ID,
OpenPrivacyStatementUrlAction.ID,
ShowAboutDialogAction.ID,
OpenProcessExplorer.ID,
OpenRequestFeatureUrlAction.ID,
NewWindowAction.ID,
CloseCurrentWindowAction.ID,
CloseWorkspaceAction.ID,
REVEAL_IN_OS_COMMAND_ID,
// Unfortunately referenced as a string
"update.showCurrentReleaseNotes",
"workbench.action.openIssueReporter",
];
// Intercept appending menu items so we can skip items that won't work.
const originalAppend = actions.MenuRegistry.appendMenuItem.bind(actions.MenuRegistry);
actions.MenuRegistry.appendMenuItem = (id: actions.MenuId, item: actions.IMenuItem | actions.ISubmenuItem): IDisposable => {
if (actions.isIMenuItem(item)) {
if (toSkip.indexOf(item.command.id) !== -1) {
// Skip instantiation
return {
dispose: (): void => undefined,
};
}
}
return originalAppend(id, item);
};