code-server/packages/vscode/src/fill/workbenchRegistry.ts
Kyle Carberry 85d2225e0c Featureful (#31)
* Fix loading within the CLI

* Remove app

* Remove promise handle

* Add initial travis file

* Add libxkbfile dependency

* Add libxkbfile-dev

* Add build script

* Fix malformed bash statement

* Remove yarn from script

* Improve build script

* Extract upx before usage

* Only run upx if on linux

* Ensure resource directory exists

* Pack runnable binary

* Export binary with platform

* Improve build process

* Install upx before running install script

* Update typescript version before running nexe

* Add os.release() function for multi-platform support

* Update travis.yml to improve deployment

* Add on CI

* Update to v1.31.0

* Add libsecret

* Update build target

* Skip cleanup

* Fix built-in extensions

* Add basics for apps

* Create custom DNS server

* Fix forking within CLI. Fixes TS language features

* Fix filename resolve

* Fix default extensions path

* Add custom dialog

* Store workspace path

* Remove outfiles

* Cleanup

* Always authed outside of CLI

* Use location.host for client

* Remove useless app interface

* Remove debug file for building wordlist

* Use chromes tcp host

* Update patch

* Build browser app before packaging

* Replace all css containing file:// URLs, fix webviews

* Fix save

* Fix mkdir
2019-02-21 11:55:42 -06:00

40 lines
2.1 KiB
TypeScript

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/developerActions";
import { TerminalPasteAction } from "vs/workbench/parts/terminal/electron-browser/terminalActions";
import { KEYBINDING_CONTEXT_TERMINAL_FOCUS } from "vs/workbench/parts/terminal/common/terminal";
import { KeyCode, KeyMod } from "vs/base/common/keyCodes";
import { client } from "../client";
// Intercept adding workbench actions so we can skip actions that won't work or
// modify actions that need different conditions, keybindings, etc.
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,
};
case TerminalPasteAction.ID: // Modify the Windows keybinding and add our context key.
// tslint:disable-next-line no-any override private
(descriptor as any)._keybindings = {
primary: KeyMod.CtrlCmd | KeyCode.KEY_V,
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_V },
win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V },
mac: { primary: 0 },
};
// tslint:disable-next-line no-any override private
(descriptor as any)._keybindingContext = ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FOCUS, client.clipboardContextKey);
}
return originalRegister(descriptor, alias, category, when);
};