mirror of
https://github.com/coder/code-server.git
synced 2026-05-06 12:31:58 +02:00
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:
23
packages/vscode/src/fill/workbenchRegistry.ts
Normal file
23
packages/vscode/src/fill/workbenchRegistry.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { logger } from "@coder/logger";
|
||||
import { IDisposable } from "vs/base/common/lifecycle";
|
||||
import { Registry } from "vs/platform/registry/common/platform";
|
||||
import { IWorkbenchActionRegistry, Extensions } from "vs/workbench/common/actions";
|
||||
import { SyncActionDescriptor } from "vs/platform/actions/common/actions";
|
||||
import { ContextKeyExpr } from "vs/platform/contextkey/common/contextkey";
|
||||
import { ToggleDevToolsAction } from "vs/workbench/electron-browser/actions";
|
||||
|
||||
// Intercept adding workbench actions so we can skip actions that won't work.
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
|
||||
const originalRegister = registry.registerWorkbenchAction.bind(registry);
|
||||
registry.registerWorkbenchAction = (descriptor: SyncActionDescriptor, alias: string, category?: string, when?: ContextKeyExpr): IDisposable => {
|
||||
switch (descriptor.id) {
|
||||
case ToggleDevToolsAction.ID: // There appears to be no way to toggle this programmatically.
|
||||
logger.debug(`Skipping unsupported workbench action ${descriptor.id}`);
|
||||
|
||||
return {
|
||||
dispose: (): void => undefined,
|
||||
};
|
||||
}
|
||||
|
||||
return originalRegister(descriptor, alias, category, when);
|
||||
};
|
||||
Reference in New Issue
Block a user