Archived
1
0

Remove non-working menu items

This commit is contained in:
Kyle Carberry 2019-04-04 18:04:34 -04:00
parent 5a1eb858a9
commit 278c59b920
No known key found for this signature in database
GPG Key ID: A0409BDB6B0B3EDB
2 changed files with 33 additions and 8 deletions

View File

@ -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,
};
}
}

View File

@ -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 {