Skip unsupported actions and menu items
Using this to skip the toggle developer tools action since there doesn't seem to be any way to do that from the browser. There might be others we will need to add.
This commit is contained in:
21
packages/vscode/src/fill/menuRegistry.ts
Normal file
21
packages/vscode/src/fill/menuRegistry.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { logger } from "@coder/logger";
|
||||
import { IDisposable } from "vs/base/common/lifecycle";
|
||||
import * as actions from "vs/platform/actions/common/actions";
|
||||
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions";
|
||||
|
||||
// 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,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return originalAppend(id, item);
|
||||
};
|
||||
Reference in New Issue
Block a user