From 278c59b920c6bf0c6230aae1585688abc885b9cc Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 4 Apr 2019 18:04:34 -0400 Subject: [PATCH] Remove non-working menu items --- packages/vscode/src/fill/menuRegistry.ts | 33 ++++++++++++++++++------ packages/vscode/src/fill/product.ts | 8 ++++++ 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/vscode/src/fill/menuRegistry.ts b/packages/vscode/src/fill/menuRegistry.ts index 28cd4f448..f3e7520aa 100644 --- a/packages/vscode/src/fill/menuRegistry.ts +++ b/packages/vscode/src/fill/menuRegistry.ts @@ -1,19 +1,36 @@ -import { logger } from "@coder/logger"; 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"; + +const toSkip = [ + ToggleDevToolsAction.ID, + OpenTwitterUrlAction.ID, + OpenPrivacyStatementUrlAction.ID, + ShowAboutDialogAction.ID, + OpenProcessExplorer.ID, + OpenRequestFeatureUrlAction.ID, + NewWindowAction.ID, + CloseCurrentWindowAction.ID, + CloseWorkspaceAction.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)) { - switch (item.command.id) { - case ToggleDevToolsAction.ID: // There appears to be no way to toggle this programmatically. - logger.debug(`Skipping unsupported menu item ${item.command.id}`); - - return { - dispose: (): void => undefined, - }; + if (toSkip.indexOf(item.command.id) !== -1) { + // Skip instantiation + return { + dispose: (): void => undefined, + }; } } diff --git a/packages/vscode/src/fill/product.ts b/packages/vscode/src/fill/product.ts index 9f5eb7def..1fa3c66d5 100644 --- a/packages/vscode/src/fill/product.ts +++ b/packages/vscode/src/fill/product.ts @@ -4,6 +4,14 @@ import { IProductConfiguration } from "vs/platform/product/node/product"; class Product implements IProductConfiguration { public nameShort = "code-server"; public nameLong = "code-server"; + public documentationUrl = "https://code.visualstudio.com/docs"; + public keyboardShortcutsUrlMac = "https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf"; + public keyboardShortcutsUrlLinux = "https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf"; + public keyboardShortcutsUrlWin = "https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf"; + public introductoryVideosUrl = "https://code.visualstudio.com/docs/getstarted/introvideos"; + public tipsAndTricksUrl = "https://code.visualstudio.com/docs/getstarted/tips-and-tricks"; + public twitterUrl = "https://twitter.com/code"; + public licenseUrl = "https://github.com/codercom/code-server/blob/master/LICENSE"; private _dataFolderName: string | undefined; public get dataFolderName(): string {