@theia/core 1.77.0-next.7 → 1.77.0-next.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/lib/browser/breadcrumbs/breadcrumbs-renderer.js +1 -1
- package/lib/browser/breadcrumbs/breadcrumbs-renderer.js.map +1 -1
- package/lib/browser/catalog.json +304 -18
- package/lib/browser/color-application-contribution.d.ts +7 -1
- package/lib/browser/color-application-contribution.d.ts.map +1 -1
- package/lib/browser/color-application-contribution.js +15 -4
- package/lib/browser/color-application-contribution.js.map +1 -1
- package/lib/browser/color-application-contribution.spec.d.ts +2 -0
- package/lib/browser/color-application-contribution.spec.d.ts.map +1 -0
- package/lib/browser/color-application-contribution.spec.js +96 -0
- package/lib/browser/color-application-contribution.spec.js.map +1 -0
- package/lib/browser/color-registry.d.ts +7 -1
- package/lib/browser/color-registry.d.ts.map +1 -1
- package/lib/browser/color-registry.js +12 -0
- package/lib/browser/color-registry.js.map +1 -1
- package/lib/browser/common-commands.d.ts +3 -0
- package/lib/browser/common-commands.d.ts.map +1 -1
- package/lib/browser/common-commands.js +15 -0
- package/lib/browser/common-commands.js.map +1 -1
- package/lib/browser/common-frontend-contribution.d.ts +8 -1
- package/lib/browser/common-frontend-contribution.d.ts.map +1 -1
- package/lib/browser/common-frontend-contribution.js +47 -3
- package/lib/browser/common-frontend-contribution.js.map +1 -1
- package/lib/browser/common-frontend-contribution.spec.js +2 -1
- package/lib/browser/common-frontend-contribution.spec.js.map +1 -1
- package/lib/browser/components/card.d.ts +1 -1
- package/lib/browser/components/card.d.ts.map +1 -1
- package/lib/browser/components/card.js +3 -2
- package/lib/browser/components/card.js.map +1 -1
- package/lib/browser/connection-status-service.spec.js +2 -1
- package/lib/browser/connection-status-service.spec.js.map +1 -1
- package/lib/browser/context-key-service.d.ts +11 -0
- package/lib/browser/context-key-service.d.ts.map +1 -1
- package/lib/browser/context-key-service.js +7 -0
- package/lib/browser/context-key-service.js.map +1 -1
- package/lib/browser/decorations-service.spec.js +2 -1
- package/lib/browser/decorations-service.spec.js.map +1 -1
- package/lib/browser/dialogs/react-dialog.spec.js +2 -1
- package/lib/browser/dialogs/react-dialog.spec.js.map +1 -1
- package/lib/browser/diff-uris.js +1 -1
- package/lib/browser/diff-uris.js.map +1 -1
- package/lib/browser/endpoint.js +2 -1
- package/lib/browser/endpoint.js.map +1 -1
- package/lib/browser/endpoint.spec.js +2 -1
- package/lib/browser/endpoint.spec.js.map +1 -1
- package/lib/browser/frontend-application-module.d.ts.map +1 -1
- package/lib/browser/frontend-application-module.js +3 -0
- package/lib/browser/frontend-application-module.js.map +1 -1
- package/lib/browser/keybinding.d.ts +95 -17
- package/lib/browser/keybinding.d.ts.map +1 -1
- package/lib/browser/keybinding.js +406 -76
- package/lib/browser/keybinding.js.map +1 -1
- package/lib/browser/keybinding.spec.js +804 -33
- package/lib/browser/keybinding.spec.js.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js +1 -1
- package/lib/browser/keyboard/browser-keyboard-frontend-contribution.js.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts +3 -4
- package/lib/browser/keyboard/browser-keyboard-layout-provider.d.ts.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.js +3 -3
- package/lib/browser/keyboard/browser-keyboard-layout-provider.js.map +1 -1
- package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js +42 -3
- package/lib/browser/keyboard/browser-keyboard-layout-provider.spec.js.map +1 -1
- package/lib/browser/keyboard/keyboard-layout-service.d.ts +67 -15
- package/lib/browser/keyboard/keyboard-layout-service.d.ts.map +1 -1
- package/lib/browser/keyboard/keyboard-layout-service.js +313 -98
- package/lib/browser/keyboard/keyboard-layout-service.js.map +1 -1
- package/lib/browser/keyboard/keyboard-layout-service.spec.js +570 -15
- package/lib/browser/keyboard/keyboard-layout-service.spec.js.map +1 -1
- package/lib/browser/keyboard/keys.spec.js +187 -3
- package/lib/browser/keyboard/keys.spec.js.map +1 -1
- package/lib/browser/label-provider.d.ts.map +1 -1
- package/lib/browser/label-provider.js +5 -3
- package/lib/browser/label-provider.js.map +1 -1
- package/lib/browser/label-provider.spec.js +2 -1
- package/lib/browser/label-provider.spec.js.map +1 -1
- package/lib/browser/markdown-rendering/markdown-link-handler.js +2 -1
- package/lib/browser/markdown-rendering/markdown-link-handler.js.map +1 -1
- package/lib/browser/markdown-rendering/markdown-renderer.d.ts +1 -1
- package/lib/browser/markdown-rendering/markdown-renderer.d.ts.map +1 -1
- package/lib/browser/markdown-rendering/markdown-renderer.js +4 -4
- package/lib/browser/markdown-rendering/markdown-renderer.js.map +1 -1
- package/lib/browser/markdown-rendering/markdown.js +2 -1
- package/lib/browser/markdown-rendering/markdown.js.map +1 -1
- package/lib/browser/markdown-rendering/markdown.spec.js +2 -1
- package/lib/browser/markdown-rendering/markdown.spec.js.map +1 -1
- package/lib/browser/menu/action-menu-node.d.ts +5 -3
- package/lib/browser/menu/action-menu-node.d.ts.map +1 -1
- package/lib/browser/menu/action-menu-node.js +2 -11
- package/lib/browser/menu/action-menu-node.js.map +1 -1
- package/lib/browser/menu/action-menu-node.spec.d.ts +2 -0
- package/lib/browser/menu/action-menu-node.spec.d.ts.map +1 -0
- package/lib/browser/menu/action-menu-node.spec.js +54 -0
- package/lib/browser/menu/action-menu-node.spec.js.map +1 -0
- package/lib/browser/menu/browser-menu-plugin.js +1 -1
- package/lib/browser/menu/browser-menu-plugin.js.map +1 -1
- package/lib/browser/menu/menu.spec.js +2 -1
- package/lib/browser/menu/menu.spec.js.map +1 -1
- package/lib/browser/opener-service.spec.js +3 -2
- package/lib/browser/opener-service.spec.js.map +1 -1
- package/lib/browser/perspective-service.spec.js +2 -1
- package/lib/browser/perspective-service.spec.js.map +1 -1
- package/lib/browser/preferences/preference-proxy.spec.js +2 -1
- package/lib/browser/preferences/preference-proxy.spec.js.map +1 -1
- package/lib/browser/preferences/preference-schema-provider.spec.js +2 -1
- package/lib/browser/preferences/preference-schema-provider.spec.js.map +1 -1
- package/lib/browser/preferences/preference-service.spec.js +2 -1
- package/lib/browser/preferences/preference-service.spec.js.map +1 -1
- package/lib/browser/preferences/preference-validation-service.spec.js +78 -77
- package/lib/browser/preferences/preference-validation-service.spec.js.map +1 -1
- package/lib/browser/quick-input/quick-command-service.d.ts +10 -1
- package/lib/browser/quick-input/quick-command-service.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-command-service.js +31 -6
- package/lib/browser/quick-input/quick-command-service.js.map +1 -1
- package/lib/browser/quick-input/quick-command-service.spec.d.ts +2 -0
- package/lib/browser/quick-input/quick-command-service.spec.d.ts.map +1 -0
- package/lib/browser/quick-input/quick-command-service.spec.js +130 -0
- package/lib/browser/quick-input/quick-command-service.spec.js.map +1 -0
- package/lib/browser/quick-input/quick-help-service.js +1 -1
- package/lib/browser/quick-input/quick-help-service.js.map +1 -1
- package/lib/browser/quick-input/quick-input-service.spec.js +2 -1
- package/lib/browser/quick-input/quick-input-service.spec.js.map +1 -1
- package/lib/browser/quick-input/quick-pick-service-impl.d.ts +6 -6
- package/lib/browser/quick-input/quick-pick-service-impl.d.ts.map +1 -1
- package/lib/browser/quick-input/quick-view-service.spec.js +2 -1
- package/lib/browser/quick-input/quick-view-service.spec.js.map +1 -1
- package/lib/browser/secondary-window-handler.d.ts +4 -4
- package/lib/browser/secondary-window-handler.d.ts.map +1 -1
- package/lib/browser/shell/application-shell.js +1 -1
- package/lib/browser/shell/application-shell.js.map +1 -1
- package/lib/browser/shell/application-shell.spec.js +2 -1
- package/lib/browser/shell/application-shell.spec.js.map +1 -1
- package/lib/browser/shell/index.d.ts +1 -0
- package/lib/browser/shell/index.d.ts.map +1 -1
- package/lib/browser/shell/index.js +1 -0
- package/lib/browser/shell/index.js.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.d.ts +2 -0
- package/lib/browser/shell/shell-layout-restorer.d.ts.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.js +6 -0
- package/lib/browser/shell/shell-layout-restorer.js.map +1 -1
- package/lib/browser/shell/shell-layout-restorer.spec.js +9 -1
- package/lib/browser/shell/shell-layout-restorer.spec.js.map +1 -1
- package/lib/browser/shell/side-panel-handler.d.ts +12 -1
- package/lib/browser/shell/side-panel-handler.d.ts.map +1 -1
- package/lib/browser/shell/side-panel-handler.js +73 -0
- package/lib/browser/shell/side-panel-handler.js.map +1 -1
- package/lib/browser/shell/side-panel-handler.spec.d.ts +2 -0
- package/lib/browser/shell/side-panel-handler.spec.d.ts.map +1 -0
- package/lib/browser/shell/side-panel-handler.spec.js +85 -0
- package/lib/browser/shell/side-panel-handler.spec.js.map +1 -0
- package/lib/browser/shell/side-panel-item-visibility.d.ts +55 -0
- package/lib/browser/shell/side-panel-item-visibility.d.ts.map +1 -0
- package/lib/browser/shell/side-panel-item-visibility.js +100 -0
- package/lib/browser/shell/side-panel-item-visibility.js.map +1 -0
- package/lib/browser/shell/side-panel-item-visibility.spec.d.ts +2 -0
- package/lib/browser/shell/side-panel-item-visibility.spec.d.ts.map +1 -0
- package/lib/browser/shell/side-panel-item-visibility.spec.js +80 -0
- package/lib/browser/shell/side-panel-item-visibility.spec.js.map +1 -0
- package/lib/browser/shell/side-panel-toolbar.d.ts +1 -1
- package/lib/browser/shell/side-panel-toolbar.d.ts.map +1 -1
- package/lib/browser/shell/sidebar-menu-widget.js +1 -1
- package/lib/browser/shell/sidebar-menu-widget.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.js.map +1 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.js +2 -1
- package/lib/browser/shell/tab-bar-toolbar/tab-bar-toolbar.spec.js.map +1 -1
- package/lib/browser/shell/tab-bars.d.ts +17 -0
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +33 -15
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/shell/tab-bars.spec.js +86 -0
- package/lib/browser/shell/tab-bars.spec.js.map +1 -1
- package/lib/browser/status-bar/status-bar.js +1 -1
- package/lib/browser/status-bar/status-bar.js.map +1 -1
- package/lib/browser/storage-service.spec.js +2 -1
- package/lib/browser/storage-service.spec.js.map +1 -1
- package/lib/browser/test/jsdom.d.ts.map +1 -1
- package/lib/browser/test/jsdom.js +11 -0
- package/lib/browser/test/jsdom.js.map +1 -1
- package/lib/browser/tooltip-service.js +1 -1
- package/lib/browser/tooltip-service.js.map +1 -1
- package/lib/browser/tree/tree-compression/compressed-tree-model.d.ts +2 -0
- package/lib/browser/tree/tree-compression/compressed-tree-model.d.ts.map +1 -1
- package/lib/browser/tree/tree-compression/compressed-tree-model.js +6 -2
- package/lib/browser/tree/tree-compression/compressed-tree-model.js.map +1 -1
- package/lib/browser/tree/tree-compression/compressed-tree-model.spec.d.ts +2 -0
- package/lib/browser/tree/tree-compression/compressed-tree-model.spec.d.ts.map +1 -0
- package/lib/browser/tree/tree-compression/compressed-tree-model.spec.js +52 -0
- package/lib/browser/tree/tree-compression/compressed-tree-model.spec.js.map +1 -0
- package/lib/browser/tree/tree-consistency.spec.js +1 -1
- package/lib/browser/tree/tree-consistency.spec.js.map +1 -1
- package/lib/browser/tree/tree-container.spec.js +6 -5
- package/lib/browser/tree/tree-container.spec.js.map +1 -1
- package/lib/browser/tree/tree-iterator.js +1 -1
- package/lib/browser/tree/tree-iterator.js.map +1 -1
- package/lib/browser/tree/tree-model.js +2 -2
- package/lib/browser/tree/tree-model.js.map +1 -1
- package/lib/browser/tree/tree-selection-state.d.ts +23 -1
- package/lib/browser/tree/tree-selection-state.d.ts.map +1 -1
- package/lib/browser/tree/tree-selection-state.js +23 -1
- package/lib/browser/tree/tree-selection-state.js.map +1 -1
- package/lib/browser/tree/tree-view-welcome-widget.js +1 -1
- package/lib/browser/tree/tree-view-welcome-widget.js.map +1 -1
- package/lib/browser/tree/tree-widget.d.ts +2 -2
- package/lib/browser/tree/tree-widget.d.ts.map +1 -1
- package/lib/browser/tree/tree-widget.js +3 -4
- package/lib/browser/tree/tree-widget.js.map +1 -1
- package/lib/browser/tree/tree-widget.spec.js +18 -0
- package/lib/browser/tree/tree-widget.spec.js.map +1 -1
- package/lib/browser/tree/tree.spec.js +2 -1
- package/lib/browser/tree/tree.spec.js.map +1 -1
- package/lib/browser/user-working-directory-provider.js +1 -1
- package/lib/browser/user-working-directory-provider.js.map +1 -1
- package/lib/browser/view-container.d.ts.map +1 -1
- package/lib/browser/view-container.js +2 -1
- package/lib/browser/view-container.js.map +1 -1
- package/lib/browser/widgets/react-renderer.js +1 -1
- package/lib/browser/widgets/react-renderer.js.map +1 -1
- package/lib/browser/widgets/react-widget.js +1 -1
- package/lib/browser/widgets/react-widget.js.map +1 -1
- package/lib/browser/widgets/select-component.d.ts.map +1 -1
- package/lib/browser/widgets/select-component.js +10 -14
- package/lib/browser/widgets/select-component.js.map +1 -1
- package/lib/browser/widgets/select-component.spec.d.ts +2 -0
- package/lib/browser/widgets/select-component.spec.d.ts.map +1 -0
- package/lib/browser/widgets/select-component.spec.js +67 -0
- package/lib/browser/widgets/select-component.spec.js.map +1 -0
- package/lib/browser/widgets/widget.js +1 -1
- package/lib/browser/widgets/widget.js.map +1 -1
- package/lib/common/buffer.js +3 -2
- package/lib/common/buffer.js.map +1 -1
- package/lib/common/cancellation.js.map +1 -1
- package/lib/common/command.spec.js +2 -1
- package/lib/common/command.spec.js.map +1 -1
- package/lib/common/core-preferences.js +5 -5
- package/lib/common/core-preferences.js.map +1 -1
- package/lib/common/disposable.spec.js +3 -2
- package/lib/common/disposable.spec.js.map +1 -1
- package/lib/common/encoding-service.js +2 -2
- package/lib/common/encoding-service.js.map +1 -1
- package/lib/common/event.d.ts +1 -1
- package/lib/common/event.d.ts.map +1 -1
- package/lib/common/event.js +0 -1
- package/lib/common/event.js.map +1 -1
- package/lib/common/file-uri.js +2 -1
- package/lib/common/file-uri.js.map +1 -1
- package/lib/common/fuzzy-search.js +1 -1
- package/lib/common/fuzzy-search.js.map +1 -1
- package/lib/common/glob.d.ts.map +1 -1
- package/lib/common/glob.js +9 -15
- package/lib/common/glob.js.map +1 -1
- package/lib/common/index.js +1 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/keyboard/keyboard-layout-provider.d.ts +7 -0
- package/lib/common/keyboard/keyboard-layout-provider.d.ts.map +1 -1
- package/lib/common/keyboard/keyboard-layout-provider.js.map +1 -1
- package/lib/common/keys.d.ts +86 -3
- package/lib/common/keys.d.ts.map +1 -1
- package/lib/common/keys.js +263 -24
- package/lib/common/keys.js.map +1 -1
- package/lib/common/message-rpc/channel.spec.js +3 -2
- package/lib/common/message-rpc/channel.spec.js.map +1 -1
- package/lib/common/messaging/proxy-factory.js +2 -2
- package/lib/common/messaging/proxy-factory.js.map +1 -1
- package/lib/common/messaging/proxy-factory.spec.js +2 -1
- package/lib/common/messaging/proxy-factory.spec.js.map +1 -1
- package/lib/common/messaging/web-socket-channel.d.ts +1 -1
- package/lib/common/messaging/web-socket-channel.d.ts.map +1 -1
- package/lib/common/path.spec.js +2 -1
- package/lib/common/path.spec.js.map +1 -1
- package/lib/common/performance/stopwatch.spec.js +2 -1
- package/lib/common/performance/stopwatch.spec.js.map +1 -1
- package/lib/common/preferences/preference-schema-service.d.ts +2 -2
- package/lib/common/preferences/preference-schema-service.d.ts.map +1 -1
- package/lib/common/preferences/preference-service.js +1 -1
- package/lib/common/preferences/preference-service.js.map +1 -1
- package/lib/common/promise-util.d.ts.map +1 -1
- package/lib/common/promise-util.js +5 -2
- package/lib/common/promise-util.js.map +1 -1
- package/lib/common/promise-util.spec.js +17 -1
- package/lib/common/promise-util.spec.js.map +1 -1
- package/lib/common/quick-pick-service.d.ts +5 -0
- package/lib/common/quick-pick-service.d.ts.map +1 -1
- package/lib/common/quick-pick-service.js +2 -1
- package/lib/common/quick-pick-service.js.map +1 -1
- package/lib/common/reference.spec.js +2 -1
- package/lib/common/reference.spec.js.map +1 -1
- package/lib/common/resource.js +1 -1
- package/lib/common/resource.js.map +1 -1
- package/lib/common/selection-service.spec.js +2 -1
- package/lib/common/selection-service.spec.js.map +1 -1
- package/lib/common/selection.js +2 -1
- package/lib/common/selection.js.map +1 -1
- package/lib/common/stream.d.ts.map +1 -1
- package/lib/common/stream.js +2 -1
- package/lib/common/stream.js.map +1 -1
- package/lib/common/strings.d.ts.map +1 -1
- package/lib/common/strings.js +1 -2
- package/lib/common/strings.js.map +1 -1
- package/lib/common/ternary-search-tree.js +2 -2
- package/lib/common/ternary-search-tree.js.map +1 -1
- package/lib/common/ternary-search-tree.spec.js +12 -0
- package/lib/common/ternary-search-tree.spec.js.map +1 -1
- package/lib/common/test/mock-resource-provider.js +1 -1
- package/lib/common/test/mock-resource-provider.js.map +1 -1
- package/lib/common/types.spec.js +2 -1
- package/lib/common/types.spec.js.map +1 -1
- package/lib/common/uri-command-handler.js +4 -3
- package/lib/common/uri-command-handler.js.map +1 -1
- package/lib/common/uri-command-handler.spec.js +3 -2
- package/lib/common/uri-command-handler.spec.js.map +1 -1
- package/lib/common/uri.spec.js +3 -2
- package/lib/common/uri.spec.js.map +1 -1
- package/lib/electron-browser/electron-clipboard-service.d.ts +1 -1
- package/lib/electron-browser/electron-clipboard-service.d.ts.map +1 -1
- package/lib/electron-browser/keyboard/electron-keyboard-module.d.ts +2 -0
- package/lib/electron-browser/keyboard/electron-keyboard-module.d.ts.map +1 -1
- package/lib/electron-browser/keyboard/electron-keyboard-module.js +8 -1
- package/lib/electron-browser/keyboard/electron-keyboard-module.js.map +1 -1
- package/lib/electron-browser/keyboard/electron-keyboard-module.spec.d.ts +2 -0
- package/lib/electron-browser/keyboard/electron-keyboard-module.spec.d.ts.map +1 -0
- package/lib/electron-browser/keyboard/electron-keyboard-module.spec.js +28 -0
- package/lib/electron-browser/keyboard/electron-keyboard-module.spec.js.map +1 -0
- package/lib/electron-browser/menu/electron-main-menu-factory.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-main-menu-factory.js +3 -2
- package/lib/electron-browser/menu/electron-main-menu-factory.js.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.d.ts.map +1 -1
- package/lib/electron-browser/menu/electron-menu-contribution.js +3 -0
- package/lib/electron-browser/menu/electron-menu-contribution.js.map +1 -1
- package/lib/electron-browser/preload.js +1 -1
- package/lib/electron-browser/preload.js.map +1 -1
- package/lib/electron-browser/window/window-zoom-action-bar.js +2 -1
- package/lib/electron-browser/window/window-zoom-action-bar.js.map +1 -1
- package/lib/electron-common/electron-api.d.ts +6 -1
- package/lib/electron-common/electron-api.d.ts.map +1 -1
- package/lib/electron-common/electron-api.js +21 -0
- package/lib/electron-common/electron-api.js.map +1 -1
- package/lib/electron-common/electron-api.spec.d.ts +2 -0
- package/lib/electron-common/electron-api.spec.d.ts.map +1 -0
- package/lib/electron-common/electron-api.spec.js +40 -0
- package/lib/electron-common/electron-api.spec.js.map +1 -0
- package/lib/electron-main/electron-api-main.d.ts +0 -1
- package/lib/electron-main/electron-api-main.d.ts.map +1 -1
- package/lib/electron-main/electron-api-main.js +8 -18
- package/lib/electron-main/electron-api-main.js.map +1 -1
- package/lib/electron-main/electron-main-application.js +2 -2
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-node/hosting/electron-backend-hosting-module.spec.js +2 -1
- package/lib/electron-node/hosting/electron-backend-hosting-module.spec.js.map +1 -1
- package/lib/electron-node/keyboard/electron-keyboard-layout-provider.js +1 -1
- package/lib/electron-node/keyboard/electron-keyboard-layout-provider.js.map +1 -1
- package/lib/electron-node/token/electron-token-validator.js +2 -2
- package/lib/electron-node/token/electron-token-validator.js.map +1 -1
- package/lib/node/backend-application.d.ts +11 -5
- package/lib/node/backend-application.d.ts.map +1 -1
- package/lib/node/backend-application.js +34 -12
- package/lib/node/backend-application.js.map +1 -1
- package/lib/node/backend-application.spec.js +52 -3
- package/lib/node/backend-application.spec.js.map +1 -1
- package/lib/node/bundled-resource-provider.js +4 -4
- package/lib/node/bundled-resource-provider.js.map +1 -1
- package/lib/node/bundled-resource-provider.spec.js +5 -4
- package/lib/node/bundled-resource-provider.spec.js.map +1 -1
- package/lib/node/cli.d.ts +1 -1
- package/lib/node/cli.d.ts.map +1 -1
- package/lib/node/cli.js +2 -2
- package/lib/node/cli.js.map +1 -1
- package/lib/node/cli.spec.js +3 -2
- package/lib/node/cli.spec.js.map +1 -1
- package/lib/node/console-logger-server.js +1 -1
- package/lib/node/console-logger-server.js.map +1 -1
- package/lib/node/env-variables/env-variables-server.js +1 -1
- package/lib/node/env-variables/env-variables-server.js.map +1 -1
- package/lib/node/environment-utils.spec.js +2 -1
- package/lib/node/environment-utils.spec.js.map +1 -1
- package/lib/node/file-uri.spec.js +4 -3
- package/lib/node/file-uri.spec.js.map +1 -1
- package/lib/node/filesystem-locking.js +1 -1
- package/lib/node/filesystem-locking.js.map +1 -1
- package/lib/node/hosting/browser-connection-token.js +2 -2
- package/lib/node/hosting/browser-connection-token.js.map +1 -1
- package/lib/node/i18n/localization-contribution.js +1 -1
- package/lib/node/i18n/localization-contribution.js.map +1 -1
- package/lib/node/key-store-server.js +1 -1
- package/lib/node/key-store-server.js.map +1 -1
- package/lib/node/logger-cli-contribution.js +2 -2
- package/lib/node/logger-cli-contribution.js.map +1 -1
- package/lib/node/logger-cli-contribution.spec.js +17 -16
- package/lib/node/logger-cli-contribution.spec.js.map +1 -1
- package/lib/node/messaging/binary-message-pipe.d.ts.map +1 -1
- package/lib/node/messaging/binary-message-pipe.js +5 -3
- package/lib/node/messaging/binary-message-pipe.js.map +1 -1
- package/lib/node/messaging/binary-message-pipe.spec.d.ts +2 -0
- package/lib/node/messaging/binary-message-pipe.spec.d.ts.map +1 -0
- package/lib/node/messaging/binary-message-pipe.spec.js +71 -0
- package/lib/node/messaging/binary-message-pipe.spec.js.map +1 -0
- package/lib/node/messaging/ipc-connection-provider.js +2 -2
- package/lib/node/messaging/ipc-connection-provider.js.map +1 -1
- package/lib/node/process-utils.d.ts +61 -0
- package/lib/node/process-utils.d.ts.map +1 -1
- package/lib/node/process-utils.js +157 -4
- package/lib/node/process-utils.js.map +1 -1
- package/lib/node/process-utils.slow-spec.d.ts +2 -0
- package/lib/node/process-utils.slow-spec.d.ts.map +1 -0
- package/lib/node/process-utils.slow-spec.js +106 -0
- package/lib/node/process-utils.slow-spec.js.map +1 -0
- package/lib/node/process-utils.spec.js +139 -1
- package/lib/node/process-utils.spec.js.map +1 -1
- package/lib/node/request/backend-request-facade.spec.js +2 -1
- package/lib/node/request/backend-request-facade.spec.js.map +1 -1
- package/lib/node/setting-service.spec.js +2 -1
- package/lib/node/setting-service.spec.js.map +1 -1
- package/lib/node/test/exiting-backend.d.ts +18 -0
- package/lib/node/test/exiting-backend.d.ts.map +1 -0
- package/lib/node/test/exiting-backend.js +71 -0
- package/lib/node/test/exiting-backend.js.map +1 -0
- package/package.json +16 -16
- package/src/browser/color-application-contribution.spec.ts +108 -0
- package/src/browser/color-application-contribution.ts +16 -4
- package/src/browser/color-registry.ts +13 -0
- package/src/browser/common-commands.ts +15 -0
- package/src/browser/common-frontend-contribution.ts +46 -2
- package/src/browser/components/card.tsx +1 -1
- package/src/browser/context-key-service.ts +15 -0
- package/src/browser/frontend-application-module.ts +3 -0
- package/src/browser/keybinding.spec.ts +895 -34
- package/src/browser/keybinding.ts +470 -85
- package/src/browser/keyboard/browser-keyboard-frontend-contribution.ts +1 -1
- package/src/browser/keyboard/browser-keyboard-layout-provider.spec.ts +52 -1
- package/src/browser/keyboard/browser-keyboard-layout-provider.ts +5 -5
- package/src/browser/keyboard/keyboard-layout-service.spec.ts +673 -15
- package/src/browser/keyboard/keyboard-layout-service.ts +362 -106
- package/src/browser/keyboard/keys.spec.ts +206 -1
- package/src/browser/label-provider.ts +3 -1
- package/src/browser/markdown-rendering/markdown-renderer.ts +1 -1
- package/src/browser/menu/action-menu-node.spec.ts +60 -0
- package/src/browser/menu/action-menu-node.ts +8 -14
- package/src/browser/menu/browser-menu-plugin.ts +1 -1
- package/src/browser/preferences/preference-validation-service.spec.ts +1 -1
- package/src/browser/quick-input/quick-command-service.spec.ts +159 -0
- package/src/browser/quick-input/quick-command-service.ts +36 -9
- package/src/browser/quick-input/quick-help-service.ts +1 -1
- package/src/browser/shell/index.ts +1 -0
- package/src/browser/shell/shell-layout-restorer.spec.ts +10 -0
- package/src/browser/shell/shell-layout-restorer.ts +5 -0
- package/src/browser/shell/side-panel-handler.spec.ts +94 -0
- package/src/browser/shell/side-panel-handler.ts +75 -1
- package/src/browser/shell/side-panel-item-visibility.spec.ts +91 -0
- package/src/browser/shell/side-panel-item-visibility.ts +115 -0
- package/src/browser/shell/tab-bars.spec.ts +96 -1
- package/src/browser/shell/tab-bars.ts +36 -13
- package/src/browser/style/hover-service.css +0 -2
- package/src/browser/test/jsdom.ts +11 -0
- package/src/browser/tree/tree-compression/compressed-tree-model.spec.ts +57 -0
- package/src/browser/tree/tree-compression/compressed-tree-model.ts +11 -2
- package/src/browser/tree/tree-container.spec.ts +1 -1
- package/src/browser/tree/tree-iterator.ts +1 -1
- package/src/browser/tree/tree-model.ts +2 -2
- package/src/browser/tree/tree-selection-state.ts +40 -1
- package/src/browser/tree/tree-widget.spec.tsx +20 -0
- package/src/browser/tree/tree-widget.tsx +4 -5
- package/src/browser/view-container.ts +2 -1
- package/src/browser/widgets/select-component.spec.ts +77 -0
- package/src/browser/widgets/select-component.tsx +6 -10
- package/src/common/cancellation.ts +1 -1
- package/src/common/core-preferences.ts +5 -5
- package/src/common/disposable.spec.ts +1 -1
- package/src/common/event.ts +1 -2
- package/src/common/glob.ts +13 -30
- package/src/common/json-schema.ts +1 -1
- package/src/common/keyboard/keyboard-layout-provider.ts +8 -0
- package/src/common/keys.ts +312 -27
- package/src/common/message-rpc/channel.spec.ts +1 -1
- package/src/common/messaging/proxy-factory.ts +2 -2
- package/src/common/promise-util.spec.ts +18 -2
- package/src/common/promise-util.ts +5 -2
- package/src/common/quick-pick-service.ts +5 -0
- package/src/common/stream.ts +4 -3
- package/src/common/strings.ts +2 -5
- package/src/common/ternary-search-tree.spec.ts +14 -0
- package/src/common/ternary-search-tree.ts +3 -3
- package/src/common/uri-command-handler.ts +2 -2
- package/src/electron-browser/electron-clipboard-service.ts +1 -1
- package/src/electron-browser/keyboard/electron-keyboard-module.spec.ts +29 -0
- package/src/electron-browser/keyboard/electron-keyboard-module.ts +9 -2
- package/src/electron-browser/menu/electron-main-menu-factory.ts +3 -3
- package/src/electron-browser/menu/electron-menu-contribution.ts +4 -0
- package/src/electron-browser/preload.ts +2 -2
- package/src/electron-common/electron-api.spec.ts +42 -0
- package/src/electron-common/electron-api.ts +24 -1
- package/src/electron-main/electron-api-main.ts +7 -17
- package/src/node/backend-application.spec.ts +68 -2
- package/src/node/backend-application.ts +28 -6
- package/src/node/cli.ts +1 -1
- package/src/node/logger-cli-contribution.spec.ts +1 -1
- package/src/node/messaging/binary-message-pipe.spec.ts +81 -0
- package/src/node/messaging/binary-message-pipe.ts +5 -4
- package/src/node/process-utils.slow-spec.ts +122 -0
- package/src/node/process-utils.spec.ts +162 -0
- package/src/node/process-utils.ts +166 -3
- package/src/node/test/exiting-backend.ts +75 -0
|
@@ -18,7 +18,11 @@ import { enableJSDOM } from './test/jsdom';
|
|
|
18
18
|
let disableJSDOM = enableJSDOM();
|
|
19
19
|
|
|
20
20
|
import { FrontendApplicationConfigProvider } from './frontend-application-config-provider';
|
|
21
|
-
|
|
21
|
+
try {
|
|
22
|
+
FrontendApplicationConfigProvider.get();
|
|
23
|
+
} catch {
|
|
24
|
+
FrontendApplicationConfigProvider.set({});
|
|
25
|
+
}
|
|
22
26
|
|
|
23
27
|
import { Container, injectable, ContainerModule } from 'inversify';
|
|
24
28
|
import { bindContributionProvider } from '../common/contribution-provider';
|
|
@@ -26,7 +30,7 @@ import { KeyboardLayoutProvider, NativeKeyboardLayout, KeyboardLayoutChangeNotif
|
|
|
26
30
|
import { ILogger } from '../common/logger';
|
|
27
31
|
import { KeybindingRegistry, KeybindingContext, KeybindingContribution, KeybindingScope } from './keybinding';
|
|
28
32
|
import { Keybinding } from '../common/keybinding';
|
|
29
|
-
import { KeyCode, Key, KeyModifier, KeySequence } from './keyboard/keys';
|
|
33
|
+
import { KeyCode, Key, KeyModifier, KeySequence, NormalizedKeyboardInput } from './keyboard/keys';
|
|
30
34
|
import { KeyboardLayoutService } from './keyboard/keyboard-layout-service';
|
|
31
35
|
import { CommandRegistry, CommandService, CommandContribution, Command } from '../common/command';
|
|
32
36
|
import { LabelParser } from './label-parser';
|
|
@@ -46,15 +50,53 @@ disableJSDOM();
|
|
|
46
50
|
|
|
47
51
|
const expect = chai.expect;
|
|
48
52
|
|
|
53
|
+
function testKeyboardEvent(input: Partial<KeyboardEvent> = {}): KeyboardEvent {
|
|
54
|
+
let defaultPrevented = false;
|
|
55
|
+
return {
|
|
56
|
+
key: input.key,
|
|
57
|
+
code: input.code,
|
|
58
|
+
keyCode: input.keyCode,
|
|
59
|
+
ctrlKey: input.ctrlKey,
|
|
60
|
+
shiftKey: input.shiftKey,
|
|
61
|
+
altKey: input.altKey,
|
|
62
|
+
metaKey: input.metaKey,
|
|
63
|
+
repeat: input.repeat,
|
|
64
|
+
isComposing: input.isComposing,
|
|
65
|
+
location: input.location,
|
|
66
|
+
timeStamp: input.timeStamp,
|
|
67
|
+
target: input.target,
|
|
68
|
+
get defaultPrevented(): boolean { return defaultPrevented; },
|
|
69
|
+
preventDefault(): void { defaultPrevented = true; },
|
|
70
|
+
stopPropagation(): void { }
|
|
71
|
+
} as KeyboardEvent;
|
|
72
|
+
}
|
|
73
|
+
|
|
49
74
|
let keybindingRegistry: KeybindingRegistry;
|
|
50
75
|
let commandRegistry: CommandRegistry;
|
|
51
76
|
let testContainer: Container;
|
|
52
77
|
|
|
53
78
|
let stub: sinon.SinonStub;
|
|
79
|
+
const preferenceChanged = new Emitter<{ preferenceName: string }>();
|
|
80
|
+
const corePreferences = {
|
|
81
|
+
'keyboard.dispatch': 'code',
|
|
82
|
+
onPreferenceChanged: preferenceChanged.event
|
|
83
|
+
} as unknown as CorePreferences;
|
|
84
|
+
|
|
85
|
+
const RUSSIAN_LAYOUT: NativeKeyboardLayout = {
|
|
86
|
+
info: { id: 'ru', lang: 'ru' },
|
|
87
|
+
mapping: {
|
|
88
|
+
KeyA: { value: 'ф', withShift: 'Ф', withAltGr: '', withShiftAltGr: '' },
|
|
89
|
+
KeyC: { value: 'с', withShift: 'С', withAltGr: '', withShiftAltGr: '' },
|
|
90
|
+
KeyE: { value: 'у', withShift: 'У', withAltGr: '€', withShiftAltGr: '' },
|
|
91
|
+
KeyV: { value: 'м', withShift: 'М', withAltGr: '', withShiftAltGr: '' },
|
|
92
|
+
KeyS: { value: 'ы', withShift: 'Ы', withAltGr: '', withShiftAltGr: '' },
|
|
93
|
+
Digit8: { value: '8', withShift: '*', withAltGr: '', withShiftAltGr: '' },
|
|
94
|
+
BracketLeft: { value: 'х', withShift: 'Х', withAltGr: '', withShiftAltGr: '' },
|
|
95
|
+
Comma: { value: 'б', withShift: 'Б', withAltGr: '', withShiftAltGr: '' }
|
|
96
|
+
}
|
|
97
|
+
};
|
|
54
98
|
|
|
55
99
|
before(async () => {
|
|
56
|
-
disableJSDOM = enableJSDOM();
|
|
57
|
-
|
|
58
100
|
testContainer = new Container();
|
|
59
101
|
const module = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
60
102
|
|
|
@@ -63,7 +105,14 @@ before(async () => {
|
|
|
63
105
|
|
|
64
106
|
bind(KeyboardLayoutService).toSelf().inSingletonScope();
|
|
65
107
|
bind(MockKeyboardLayoutProvider).toSelf().inSingletonScope();
|
|
66
|
-
bind(KeyboardLayoutProvider).
|
|
108
|
+
bind(KeyboardLayoutProvider).toDynamicValue(ctx => {
|
|
109
|
+
const provider = ctx.container.get(MockKeyboardLayoutProvider);
|
|
110
|
+
return new Proxy(provider, {
|
|
111
|
+
get: (target, property) => property === 'then' ? undefined
|
|
112
|
+
: property === 'layoutSource' ? 'navigator.keyboard'
|
|
113
|
+
: property in target ? Reflect.get(target, property) : () => undefined
|
|
114
|
+
});
|
|
115
|
+
});
|
|
67
116
|
bind(MockKeyboardLayoutChangeNotifier).toSelf().inSingletonScope();
|
|
68
117
|
bind(KeyboardLayoutChangeNotifier).toService(MockKeyboardLayoutChangeNotifier);
|
|
69
118
|
|
|
@@ -87,7 +136,10 @@ before(async () => {
|
|
|
87
136
|
}
|
|
88
137
|
});
|
|
89
138
|
|
|
90
|
-
bind(StatusBar).toConstantValue({
|
|
139
|
+
bind(StatusBar).toConstantValue({
|
|
140
|
+
setElement: () => Promise.resolve(),
|
|
141
|
+
removeElement: () => Promise.resolve()
|
|
142
|
+
} as unknown as StatusBar);
|
|
91
143
|
bind(MarkdownRendererImpl).toSelf().inSingletonScope();
|
|
92
144
|
bind(MarkdownRenderer).toService(MarkdownRendererImpl);
|
|
93
145
|
bind(MarkdownRendererFactory).toFactory(({ container }) => () => container.get(MarkdownRenderer));
|
|
@@ -96,7 +148,7 @@ before(async () => {
|
|
|
96
148
|
bind(LabelParser).toSelf().inSingletonScope();
|
|
97
149
|
bind(ContextKeyService).to(MockContextKeyService).inSingletonScope();
|
|
98
150
|
bind(FrontendApplicationStateService).toSelf().inSingletonScope();
|
|
99
|
-
bind(CorePreferences).toConstantValue(
|
|
151
|
+
bind(CorePreferences).toConstantValue(corePreferences);
|
|
100
152
|
bindPreferenceService(bind);
|
|
101
153
|
});
|
|
102
154
|
|
|
@@ -107,18 +159,22 @@ before(async () => {
|
|
|
107
159
|
|
|
108
160
|
});
|
|
109
161
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
162
|
+
beforeEach(async function (): Promise<void> {
|
|
163
|
+
if (this.currentTest?.file?.endsWith('keybinding.spec.js')) {
|
|
164
|
+
disableJSDOM();
|
|
165
|
+
disableJSDOM = enableJSDOM();
|
|
166
|
+
}
|
|
115
167
|
stub = sinon.stub(os, 'isOSX').value(false);
|
|
116
168
|
keybindingRegistry = testContainer.get<KeybindingRegistry>(KeybindingRegistry);
|
|
169
|
+
(corePreferences as unknown as Record<string, unknown>)['keyboard.dispatch'] = 'code';
|
|
117
170
|
await keybindingRegistry.onStart();
|
|
118
171
|
});
|
|
119
172
|
|
|
120
|
-
afterEach(()
|
|
173
|
+
afterEach(function (): void {
|
|
121
174
|
stub.restore();
|
|
175
|
+
if (this.currentTest?.file?.endsWith('keybinding.spec.js')) {
|
|
176
|
+
disableJSDOM();
|
|
177
|
+
}
|
|
122
178
|
});
|
|
123
179
|
|
|
124
180
|
describe('keybindings', () => {
|
|
@@ -353,7 +409,7 @@ describe('keybindings', () => {
|
|
|
353
409
|
expect(match && match.kind).to.be.equal('full');
|
|
354
410
|
|
|
355
411
|
match = keybindingRegistry.matchKeybinding([KeyCode.createKeyCode({ first: Key.KEY_C, modifiers: [KeyModifier.CtrlCmd] })]);
|
|
356
|
-
const keyCode = match && KeyCode.parse(match.binding.keybinding);
|
|
412
|
+
const keyCode = match && KeyCode.parse(match.runtime.binding.keybinding);
|
|
357
413
|
expect(keyCode?.key).to.be.equal(validKeyCode.key);
|
|
358
414
|
});
|
|
359
415
|
|
|
@@ -423,23 +479,23 @@ describe('keybindings', () => {
|
|
|
423
479
|
keybindingRegistry.setKeymap(KeybindingScope.WORKSPACE, [workspaceBinding]);
|
|
424
480
|
// now WORKSPACE bindings are overriding the other scopes
|
|
425
481
|
|
|
426
|
-
let match = keybindingRegistry.matchKeybinding(
|
|
482
|
+
let match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(workspaceBinding));
|
|
427
483
|
expect(match?.kind).to.be.equal('full');
|
|
428
|
-
expect(match?.binding?.command).to.be.equal(workspaceBinding.command);
|
|
484
|
+
expect(match?.runtime.binding?.command).to.be.equal(workspaceBinding.command);
|
|
429
485
|
|
|
430
486
|
keybindingRegistry.resetKeybindingsForScope(KeybindingScope.WORKSPACE);
|
|
431
487
|
// now it should find USER bindings
|
|
432
488
|
|
|
433
|
-
match = keybindingRegistry.matchKeybinding(
|
|
489
|
+
match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(userBinding));
|
|
434
490
|
expect(match?.kind).to.be.equal('full');
|
|
435
|
-
expect(match?.binding?.command).to.be.equal(userBinding.command);
|
|
491
|
+
expect(match?.runtime.binding?.command).to.be.equal(userBinding.command);
|
|
436
492
|
|
|
437
493
|
keybindingRegistry.resetKeybindingsForScope(KeybindingScope.USER);
|
|
438
494
|
// and finally it should fallback to DEFAULT bindings.
|
|
439
495
|
|
|
440
|
-
match = keybindingRegistry.matchKeybinding(
|
|
496
|
+
match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(defaultBinding));
|
|
441
497
|
expect(match?.kind).to.be.equal('full');
|
|
442
|
-
expect(match?.binding?.command).to.be.equal(defaultBinding.command);
|
|
498
|
+
expect(match?.runtime.binding?.command).to.be.equal(defaultBinding.command);
|
|
443
499
|
|
|
444
500
|
keybindingRegistry.resetKeybindingsForScope(KeybindingScope.DEFAULT);
|
|
445
501
|
// now the registry should be empty
|
|
@@ -462,18 +518,777 @@ describe('keybindings', () => {
|
|
|
462
518
|
};
|
|
463
519
|
|
|
464
520
|
keybindingRegistry.setKeymap(KeybindingScope.DEFAULT, [defaultBinding]);
|
|
465
|
-
let match = keybindingRegistry.matchKeybinding(
|
|
521
|
+
let match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(defaultBinding));
|
|
466
522
|
expect(match?.kind).to.be.equal('full');
|
|
467
|
-
expect(match?.binding?.command).to.be.equal(defaultBinding.command);
|
|
523
|
+
expect(match?.runtime.binding?.command).to.be.equal(defaultBinding.command);
|
|
468
524
|
|
|
469
525
|
keybindingRegistry.setKeymap(KeybindingScope.USER, [disableDefaultBinding]);
|
|
470
|
-
match = keybindingRegistry.matchKeybinding(
|
|
526
|
+
match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(defaultBinding));
|
|
471
527
|
expect(match).to.be.undefined;
|
|
472
528
|
|
|
473
529
|
keybindingRegistry.resetKeybindingsForScope(KeybindingScope.USER);
|
|
474
|
-
match = keybindingRegistry.matchKeybinding(
|
|
530
|
+
match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(defaultBinding));
|
|
475
531
|
expect(match?.kind).to.be.equal('full');
|
|
476
|
-
expect(match?.binding?.command).to.be.equal(defaultBinding.command);
|
|
532
|
+
expect(match?.runtime.binding?.command).to.be.equal(defaultBinding.command);
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
it('should dispatch already-handled compatibility events to capture listeners', () => {
|
|
536
|
+
const target = document.createElement('iframe');
|
|
537
|
+
document.body.appendChild(target);
|
|
538
|
+
const captured = sinon.spy();
|
|
539
|
+
document.addEventListener('keydown', captured, true);
|
|
540
|
+
const match = sinon.spy(keybindingRegistry, 'matchKeybinding');
|
|
541
|
+
|
|
542
|
+
keybindingRegistry.dispatchKeyDown({ key: 'a', code: 'KeyA' }, target, true);
|
|
543
|
+
|
|
544
|
+
expect(captured.calledOnce).to.be.true;
|
|
545
|
+
expect(captured.firstCall.args[0].defaultPrevented).to.be.false;
|
|
546
|
+
expect(match.called).to.be.false;
|
|
547
|
+
document.removeEventListener('keydown', captured, true);
|
|
548
|
+
target.remove();
|
|
549
|
+
});
|
|
550
|
+
|
|
551
|
+
it('should dispatch normalized keyboard data directly', () => {
|
|
552
|
+
const match = sinon.spy(keybindingRegistry, 'matchKeybinding');
|
|
553
|
+
|
|
554
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
555
|
+
key: 'a',
|
|
556
|
+
code: 'KeyA',
|
|
557
|
+
keyCode: 65,
|
|
558
|
+
ctrlKey: true
|
|
559
|
+
}, new EventTarget());
|
|
560
|
+
|
|
561
|
+
expect(match.calledOnce).to.be.true;
|
|
562
|
+
expect(match.firstCall.args[0][0].dispatchString()).to.equal('ctrl+a');
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
it('should dispatch a DOM keydown for dispatched commands without executing them twice', async () => {
|
|
566
|
+
const target = document.createElement('div');
|
|
567
|
+
document.body.appendChild(target);
|
|
568
|
+
const captured = sinon.spy();
|
|
569
|
+
const run = (event: KeyboardEvent) => keybindingRegistry.run(event);
|
|
570
|
+
document.addEventListener('keydown', captured, true);
|
|
571
|
+
document.addEventListener('keydown', run, true);
|
|
572
|
+
const match = sinon.spy(keybindingRegistry, 'matchKeybinding');
|
|
573
|
+
const execute = sinon.spy();
|
|
574
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND.id, { execute });
|
|
575
|
+
|
|
576
|
+
try {
|
|
577
|
+
keybindingRegistry.dispatchCommand(TEST_COMMAND.id, target);
|
|
578
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
579
|
+
|
|
580
|
+
expect(captured.calledOnce).to.be.true;
|
|
581
|
+
expect(captured.firstCall.args[0].ctrlKey).to.be.true;
|
|
582
|
+
expect(execute.calledOnce).to.be.true;
|
|
583
|
+
expect(match.calledOnce).to.be.true;
|
|
584
|
+
} finally {
|
|
585
|
+
handler.dispose();
|
|
586
|
+
document.removeEventListener('keydown', captured, true);
|
|
587
|
+
document.removeEventListener('keydown', run, true);
|
|
588
|
+
target.remove();
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
it('should preserve authored modifiers when dispatching commands through normalized Windows layout modifier data', async () => {
|
|
593
|
+
const windows = sinon.stub(os, 'isWindows').value(true);
|
|
594
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
595
|
+
const dispatch = sinon.spy(keybindingRegistry, 'dispatchNormalizedKeyDown');
|
|
596
|
+
const target = document.createElement('div');
|
|
597
|
+
const cases = [
|
|
598
|
+
{ keybinding: '[', ctrlKey: false, altKey: false },
|
|
599
|
+
{ keybinding: 'ctrl+[', ctrlKey: true, altKey: false, inactive: true },
|
|
600
|
+
{ keybinding: 'alt+[', ctrlKey: false, altKey: true, inactive: true },
|
|
601
|
+
{ keybinding: 'ctrl+alt+[', ctrlKey: true, altKey: true, inactive: true }
|
|
602
|
+
];
|
|
603
|
+
|
|
604
|
+
try {
|
|
605
|
+
for (const testCase of cases) {
|
|
606
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: testCase.keybinding };
|
|
607
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
608
|
+
const execute = sinon.spy();
|
|
609
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
610
|
+
dispatch.resetHistory();
|
|
611
|
+
try {
|
|
612
|
+
keybindingRegistry.dispatchCommand(TEST_COMMAND_SHADOW.id, target);
|
|
613
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
614
|
+
|
|
615
|
+
if (testCase.inactive) {
|
|
616
|
+
// Windows reports AltGr as Ctrl+Alt, so neither command Ctrl nor Alt can accompany an AltGraph character.
|
|
617
|
+
expect(keybindingRegistry.isKeybindingInactive(binding)).to.be.true;
|
|
618
|
+
expect(dispatch.called).to.be.false;
|
|
619
|
+
expect(execute.called).to.be.false;
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
expect(dispatch.calledOnce).to.be.true;
|
|
623
|
+
expect(dispatch.firstCall.args[0]).to.include({
|
|
624
|
+
key: '[',
|
|
625
|
+
code: 'Digit8',
|
|
626
|
+
keyCode: 56,
|
|
627
|
+
ctrlKey: testCase.ctrlKey,
|
|
628
|
+
altKey: testCase.altKey,
|
|
629
|
+
altGraph: true
|
|
630
|
+
});
|
|
631
|
+
expect(execute.calledOnce).to.be.true;
|
|
632
|
+
} finally {
|
|
633
|
+
handler.dispose();
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
} finally {
|
|
637
|
+
windows.restore();
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
it('should interpret native and transported AltGraph input identically', () => {
|
|
642
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
643
|
+
const native = keybindingRegistry.getKeyCodeInterpretations({
|
|
644
|
+
key: '[',
|
|
645
|
+
code: 'Digit8',
|
|
646
|
+
keyCode: 56,
|
|
647
|
+
ctrlKey: true,
|
|
648
|
+
getModifierState: modifier => modifier === 'AltGraph'
|
|
649
|
+
});
|
|
650
|
+
const transported = keybindingRegistry.getKeyCodeInterpretations({
|
|
651
|
+
key: '[',
|
|
652
|
+
code: 'Digit8',
|
|
653
|
+
keyCode: 56,
|
|
654
|
+
ctrlKey: true,
|
|
655
|
+
altGraph: true
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
expect(transported.map(code => code.dispatchString())).to.deep.equal(native.map(code => code.dispatchString()));
|
|
659
|
+
});
|
|
660
|
+
|
|
661
|
+
it('should log normalized keyboard troubleshooting data when enabled', () => {
|
|
662
|
+
const logger = (keybindingRegistry as unknown as { logger: ILogger }).logger;
|
|
663
|
+
const info = sinon.spy(logger, 'info');
|
|
664
|
+
keybindingRegistry.toggleKeyboardShortcutsTroubleshooting();
|
|
665
|
+
|
|
666
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
667
|
+
key: '[',
|
|
668
|
+
code: 'Digit8',
|
|
669
|
+
keyCode: 56,
|
|
670
|
+
getModifierState: modifier => modifier === 'AltGraph',
|
|
671
|
+
timeStamp: 42
|
|
672
|
+
}, new EventTarget());
|
|
673
|
+
|
|
674
|
+
expect(info.calledTwice).to.be.true;
|
|
675
|
+
expect(info.secondCall.args[1].input).to.include({
|
|
676
|
+
key: '[',
|
|
677
|
+
code: 'Digit8',
|
|
678
|
+
altGraph: true,
|
|
679
|
+
timeStamp: 42
|
|
680
|
+
});
|
|
681
|
+
expect(info.secondCall.args[1].layout.source).to.equal('navigator.keyboard');
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
it('should skip composing normalized keyboard data', () => {
|
|
685
|
+
const match = sinon.spy(keybindingRegistry, 'matchKeybinding');
|
|
686
|
+
|
|
687
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
688
|
+
key: 'a',
|
|
689
|
+
code: 'KeyA',
|
|
690
|
+
keyCode: 65,
|
|
691
|
+
isComposing: true
|
|
692
|
+
}, new EventTarget());
|
|
693
|
+
|
|
694
|
+
expect(match.called).to.be.false;
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
it('should exclude inactive bindings and reactivate them after a layout change', () => {
|
|
698
|
+
const binding = { command: TEST_COMMAND.id, keybinding: 'ctrl+[' };
|
|
699
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
700
|
+
expect(keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(binding))?.kind).to.equal('full');
|
|
701
|
+
|
|
702
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
703
|
+
notifier.emitter.fire({
|
|
704
|
+
info: { id: 'missing-bracket', lang: 'en' },
|
|
705
|
+
mapping: { KeyA: { value: 'a', withShift: 'A', withAltGr: '', withShiftAltGr: '' } }
|
|
706
|
+
});
|
|
707
|
+
expect(keybindingRegistry.getKeybindingsForCommand(TEST_COMMAND.id).some(candidate => candidate.keybinding === 'ctrl+[')).to.be.true;
|
|
708
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.a('string');
|
|
709
|
+
expect(keybindingRegistry.matchKeybinding(KeySequence.parse('ctrl+['))).to.be.undefined;
|
|
710
|
+
expect(keybindingRegistry.containsKeybindingInScope({ command: TEST_COMMAND2.id, keybinding: 'ctrl+[' })).to.be.false;
|
|
711
|
+
|
|
712
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
713
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.undefined;
|
|
714
|
+
expect(keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(binding))?.kind).to.equal('full');
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
it('should keep default Latin-letter bindings active on a non-Latin layout', async () => {
|
|
718
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+c' };
|
|
719
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
720
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
721
|
+
notifier.emitter.fire(RUSSIAN_LAYOUT);
|
|
722
|
+
const execute = sinon.spy();
|
|
723
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
724
|
+
|
|
725
|
+
try {
|
|
726
|
+
expect(keybindingRegistry.isKeybindingInactive(binding)).to.be.false;
|
|
727
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
728
|
+
key: 'с', code: 'KeyC', ctrlKey: true
|
|
729
|
+
}, new EventTarget());
|
|
730
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
731
|
+
|
|
732
|
+
expect(execute.calledOnce).to.be.true;
|
|
733
|
+
} finally {
|
|
734
|
+
handler.dispose();
|
|
735
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
it('should dispatch a shifted Latin-letter binding on a non-Latin layout', async () => {
|
|
740
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+shift+a' };
|
|
741
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
742
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
743
|
+
notifier.emitter.fire(RUSSIAN_LAYOUT);
|
|
744
|
+
const execute = sinon.spy();
|
|
745
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
746
|
+
|
|
747
|
+
try {
|
|
748
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
749
|
+
key: 'Ф', code: 'KeyA', ctrlKey: true, shiftKey: true
|
|
750
|
+
}, new EventTarget());
|
|
751
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
752
|
+
|
|
753
|
+
expect(execute.calledOnce).to.be.true;
|
|
754
|
+
} finally {
|
|
755
|
+
handler.dispose();
|
|
756
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
|
|
760
|
+
it('should dispatch a Shift+punctuation binding from input that reports the base character', async () => {
|
|
761
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [{ command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+shift+`' }]);
|
|
762
|
+
const execute = sinon.spy();
|
|
763
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
764
|
+
|
|
765
|
+
try {
|
|
766
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
767
|
+
key: '`', code: 'Backquote', ctrlKey: true, shiftKey: true
|
|
768
|
+
}, new EventTarget());
|
|
769
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
770
|
+
|
|
771
|
+
expect(execute.calledOnce).to.be.true;
|
|
772
|
+
} finally {
|
|
773
|
+
handler.dispose();
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
it('should keep punctuation bindings inactive on a non-Latin layout', () => {
|
|
778
|
+
const binding = { command: TEST_COMMAND.id, keybinding: 'ctrl+[' };
|
|
779
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
780
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
781
|
+
notifier.emitter.fire(RUSSIAN_LAYOUT);
|
|
782
|
+
|
|
783
|
+
try {
|
|
784
|
+
expect(keybindingRegistry.isKeybindingInactive(binding)).to.be.true;
|
|
785
|
+
} finally {
|
|
786
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
it('should execute an authored Shift command modifier on a non-US logical character', async () => {
|
|
791
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
792
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+shift+ü' };
|
|
793
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
794
|
+
const execute = sinon.spy();
|
|
795
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
796
|
+
|
|
797
|
+
try {
|
|
798
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
799
|
+
key: 'Ü', code: 'BracketLeft', ctrlKey: true, shiftKey: true
|
|
800
|
+
}, new EventTarget());
|
|
801
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
802
|
+
|
|
803
|
+
expect(execute.calledOnce).to.be.true;
|
|
804
|
+
} finally {
|
|
805
|
+
handler.dispose();
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
it('should mark an unmatchable Shift plus AltGraph character binding inactive', async () => {
|
|
810
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
811
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+shift+[char:0x7B]' };
|
|
812
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
813
|
+
const execute = sinon.spy();
|
|
814
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
815
|
+
|
|
816
|
+
try {
|
|
817
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.a('string');
|
|
818
|
+
keybindingRegistry.dispatchNormalizedKeyDown({
|
|
819
|
+
key: '{', code: 'Digit7', ctrlKey: true, shiftKey: true, altGraph: true
|
|
820
|
+
}, new EventTarget());
|
|
821
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
822
|
+
|
|
823
|
+
expect(execute.called).to.be.false;
|
|
824
|
+
} finally {
|
|
825
|
+
handler.dispose();
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
|
|
829
|
+
it('should mark command Alt plus AltGraph character bindings inactive on macOS and Windows', async () => {
|
|
830
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
831
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: 'alt+[' };
|
|
832
|
+
const execute = sinon.spy();
|
|
833
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
834
|
+
const windows = sinon.stub(os, 'isWindows').value(false);
|
|
835
|
+
const dispatch = async (input: NormalizedKeyboardInput) => {
|
|
836
|
+
keybindingRegistry.dispatchNormalizedKeyDown(input, new EventTarget());
|
|
837
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
try {
|
|
841
|
+
stub.value(true);
|
|
842
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-mac.json'));
|
|
843
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
844
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.a('string');
|
|
845
|
+
expect(keybindingRegistry.acceleratorForCommand(TEST_COMMAND_SHADOW.id, undefined, 'physical')).to.deep.equal([]);
|
|
846
|
+
await dispatch({ key: '[', code: 'Digit5', altKey: true });
|
|
847
|
+
expect(execute.called).to.be.false;
|
|
848
|
+
|
|
849
|
+
stub.value(false);
|
|
850
|
+
windows.value(true);
|
|
851
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
852
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
853
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.a('string');
|
|
854
|
+
await dispatch({ key: '[', code: 'Digit8', ctrlKey: true, altKey: true });
|
|
855
|
+
expect(execute.called).to.be.false;
|
|
856
|
+
|
|
857
|
+
windows.value(false);
|
|
858
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
859
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
860
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.undefined;
|
|
861
|
+
await dispatch({ key: '[', code: 'Digit8', altKey: true, altGraph: true });
|
|
862
|
+
expect(execute.calledOnce).to.be.true;
|
|
863
|
+
} finally {
|
|
864
|
+
windows.restore();
|
|
865
|
+
handler.dispose();
|
|
866
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
it('should mark command Ctrl plus AltGraph character bindings inactive on Windows', async () => {
|
|
871
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
872
|
+
const binding = { command: TEST_COMMAND_SHADOW.id, keybinding: 'ctrl+[' };
|
|
873
|
+
const typed = { command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND, keybinding: '[' };
|
|
874
|
+
const execute = sinon.spy();
|
|
875
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
876
|
+
const windows = sinon.stub(os, 'isWindows').value(true);
|
|
877
|
+
const match = sinon.spy(keybindingRegistry, 'matchKeybinding');
|
|
878
|
+
const dispatch = async (input: NormalizedKeyboardInput) => {
|
|
879
|
+
keybindingRegistry.dispatchNormalizedKeyDown(input, new EventTarget());
|
|
880
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
try {
|
|
884
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
885
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding, typed]);
|
|
886
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.a('string');
|
|
887
|
+
expect(keybindingRegistry.acceleratorForCommand(TEST_COMMAND_SHADOW.id, undefined, 'physical')).to.deep.equal([]);
|
|
888
|
+
// Chromium reports Ctrl+AltGr+8 on Windows exactly like AltGr+8, so the input types `[`.
|
|
889
|
+
await dispatch({ key: '[', code: 'Digit8', ctrlKey: true, altKey: true, altGraph: true });
|
|
890
|
+
expect(execute.called).to.be.false;
|
|
891
|
+
const fullMatches = match.returnValues.filter(result => result?.kind === 'full').map(result => result!.runtime.binding.keybinding);
|
|
892
|
+
expect(fullMatches).to.deep.equal(['[']);
|
|
893
|
+
|
|
894
|
+
windows.value(false);
|
|
895
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
896
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
897
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.undefined;
|
|
898
|
+
await dispatch({ key: '[', code: 'Digit8', ctrlKey: true, altGraph: true });
|
|
899
|
+
expect(execute.calledOnce).to.be.true;
|
|
900
|
+
} finally {
|
|
901
|
+
windows.restore();
|
|
902
|
+
handler.dispose();
|
|
903
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
it('should route Windows Ctrl+Alt candidates through the registry with and without reported AltGraph', () => {
|
|
908
|
+
const windows = sinon.stub(os, 'isWindows').value(true);
|
|
909
|
+
try {
|
|
910
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
911
|
+
const match = sinon.spy(keybindingRegistry, 'matchKeybinding');
|
|
912
|
+
const logicalBinding = {
|
|
913
|
+
command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND,
|
|
914
|
+
keybinding: '[',
|
|
915
|
+
resolved: [new KeyCode({ key: Key.DIGIT8, character: '[', layoutModifiers: 'altGraph' })]
|
|
916
|
+
};
|
|
917
|
+
for (const altGraph of [true, false]) {
|
|
918
|
+
const input = { key: '[', code: 'Digit8', ctrlKey: true, altKey: true, altGraph };
|
|
919
|
+
match.resetHistory();
|
|
920
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [logicalBinding]);
|
|
921
|
+
keybindingRegistry.dispatchNormalizedKeyDown(input, new EventTarget());
|
|
922
|
+
|
|
923
|
+
expect(match.callCount).to.equal(2);
|
|
924
|
+
expect(match.secondCall.returnValue?.kind).to.equal('full');
|
|
925
|
+
expect(match.secondCall.returnValue?.runtime.binding.keybinding).to.equal('[');
|
|
926
|
+
|
|
927
|
+
match.resetHistory();
|
|
928
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [
|
|
929
|
+
logicalBinding,
|
|
930
|
+
{ command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND, keybinding: 'ctrl+alt+8' }
|
|
931
|
+
]);
|
|
932
|
+
keybindingRegistry.dispatchNormalizedKeyDown(input, new EventTarget());
|
|
933
|
+
|
|
934
|
+
expect(match.callCount).to.equal(2);
|
|
935
|
+
expect(match.firstCall.returnValue?.runtime.binding.keybinding).to.equal('ctrl+alt+8');
|
|
936
|
+
}
|
|
937
|
+
} finally {
|
|
938
|
+
windows.restore();
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
it('should prefer a command chord prefix over a layout modifier full match', () => {
|
|
943
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations').returns([
|
|
944
|
+
new KeyCode({ key: Key.KEY_A, ctrl: true, interpretation: 'commandModifiers' }),
|
|
945
|
+
new KeyCode({ key: Key.DIGIT8, ctrl: true, layoutModifiers: 'altGraph', interpretation: 'layoutModifiers' })
|
|
946
|
+
]);
|
|
947
|
+
const commandChord = {
|
|
948
|
+
command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND,
|
|
949
|
+
keybinding: 'ctrl+a b'
|
|
950
|
+
};
|
|
951
|
+
const layoutFull = {
|
|
952
|
+
command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND,
|
|
953
|
+
keybinding: 'ctrl+['
|
|
954
|
+
};
|
|
955
|
+
keybindingRegistry.resolveKeybinding(commandChord).splice(0, 2, ...KeySequence.parse('ctrl+a b'));
|
|
956
|
+
keybindingRegistry.resolveKeybinding(layoutFull).splice(0, 1,
|
|
957
|
+
new KeyCode({ key: Key.DIGIT8, ctrl: true, character: '[', layoutModifiers: 'altGraph' }));
|
|
958
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [commandChord, layoutFull]);
|
|
959
|
+
|
|
960
|
+
const event = testKeyboardEvent({ key: '[', code: 'Digit8' });
|
|
961
|
+
keybindingRegistry.run(event);
|
|
962
|
+
|
|
963
|
+
expect(event.defaultPrevented).to.be.true;
|
|
964
|
+
expect((keybindingRegistry as unknown as { keySequenceCandidates: KeySequence[] }).keySequenceCandidates).to.have.length(1);
|
|
965
|
+
expect((keybindingRegistry as unknown as { keySequenceCandidates: KeySequence[] }).keySequenceCandidates[0][0].interpretation).to.equal('commandModifiers');
|
|
966
|
+
interpretations.restore();
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
it('should retain alternative interpretation prefixes across a chord', () => {
|
|
970
|
+
const commandPrefix = new KeyCode({ key: Key.KEY_A, ctrl: true, interpretation: 'commandModifiers' });
|
|
971
|
+
const layoutPrefix = new KeyCode({ key: Key.DIGIT8, ctrl: true, layoutModifiers: 'altGraph', interpretation: 'layoutModifiers' });
|
|
972
|
+
const layoutSecond = new KeyCode({ key: Key.KEY_C, interpretation: 'layoutModifiers' });
|
|
973
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations');
|
|
974
|
+
interpretations.onFirstCall().returns([commandPrefix, layoutPrefix]);
|
|
975
|
+
interpretations.onSecondCall().returns([
|
|
976
|
+
new KeyCode({ key: Key.KEY_X, interpretation: 'commandModifiers' }),
|
|
977
|
+
layoutSecond
|
|
978
|
+
]);
|
|
979
|
+
const commandBinding = {
|
|
980
|
+
command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND,
|
|
981
|
+
keybinding: 'ctrl+a b'
|
|
982
|
+
};
|
|
983
|
+
const layoutBinding = {
|
|
984
|
+
command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND,
|
|
985
|
+
keybinding: 'ctrl+[ c'
|
|
986
|
+
};
|
|
987
|
+
keybindingRegistry.resolveKeybinding(commandBinding).splice(0, 2, commandPrefix, new KeyCode({ key: Key.KEY_B }));
|
|
988
|
+
keybindingRegistry.resolveKeybinding(layoutBinding).splice(0, 2, layoutPrefix, layoutSecond);
|
|
989
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [commandBinding, layoutBinding]);
|
|
990
|
+
|
|
991
|
+
keybindingRegistry.run(testKeyboardEvent({ key: '[', code: 'Digit8' }));
|
|
992
|
+
expect((keybindingRegistry as unknown as { keySequenceCandidates: KeySequence[] }).keySequenceCandidates).to.have.length(2);
|
|
993
|
+
const second = testKeyboardEvent({ key: 'c', code: 'KeyC' });
|
|
994
|
+
keybindingRegistry.run(second);
|
|
995
|
+
|
|
996
|
+
expect(second.defaultPrevented).to.be.false;
|
|
997
|
+
expect((keybindingRegistry as unknown as { keySequenceCandidates: KeySequence[] }).keySequenceCandidates).to.deep.equal([[]]);
|
|
998
|
+
interpretations.restore();
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
it('should decline equal-priority full matches from different interpretations', () => {
|
|
1002
|
+
const first = new KeyCode({ key: Key.KEY_A, ctrl: true, interpretation: 'commandModifiers' });
|
|
1003
|
+
const second = new KeyCode({ key: Key.KEY_B, ctrl: true, interpretation: 'commandModifiers' });
|
|
1004
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations').returns([first, second]);
|
|
1005
|
+
const troubleshooting = sinon.spy(keybindingRegistry as unknown as {
|
|
1006
|
+
logKeyboardTroubleshooting: (input: unknown, keyCode: KeyCode, match: unknown, skipped?: string) => void
|
|
1007
|
+
}, 'logKeyboardTroubleshooting');
|
|
1008
|
+
const logger = (keybindingRegistry as unknown as { logger: ILogger }).logger;
|
|
1009
|
+
const warning = sinon.spy(logger, 'warn');
|
|
1010
|
+
const firstBinding = { command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND, keybinding: 'ctrl+a' };
|
|
1011
|
+
const secondBinding = { command: KeybindingRegistry.PASSTHROUGH_PSEUDO_COMMAND, keybinding: 'ctrl+b' };
|
|
1012
|
+
keybindingRegistry.resolveKeybinding(firstBinding).splice(0, 1, first);
|
|
1013
|
+
keybindingRegistry.resolveKeybinding(secondBinding).splice(0, 1, second);
|
|
1014
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [firstBinding, secondBinding]);
|
|
1015
|
+
|
|
1016
|
+
keybindingRegistry.run(testKeyboardEvent({ key: 'a', code: 'KeyA' }));
|
|
1017
|
+
|
|
1018
|
+
expect(troubleshooting.lastCall.args[3]).to.equal('ambiguous');
|
|
1019
|
+
expect(troubleshooting.lastCall.args[2]).to.be.undefined;
|
|
1020
|
+
expect(warning.calledOnce).to.be.true;
|
|
1021
|
+
keybindingRegistry.run(testKeyboardEvent({ key: 'a', code: 'KeyA' }));
|
|
1022
|
+
expect(warning.calledOnce).to.be.true;
|
|
1023
|
+
interpretations.restore();
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
it('should canonicalize layout modifier input for recorder persistence', () => {
|
|
1027
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations').returns([
|
|
1028
|
+
new KeyCode({ key: Key.DIGIT8, ctrl: true, alt: true, interpretation: 'commandModifiers' }),
|
|
1029
|
+
new KeyCode({ key: Key.DIGIT8, ctrl: true, character: '[', layoutModifiers: 'altGraph', interpretation: 'layoutModifiers' })
|
|
1030
|
+
]);
|
|
1031
|
+
|
|
1032
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({ key: '[', code: 'Digit8' })?.toString()).to.equal('ctrl+[');
|
|
1033
|
+
interpretations.restore();
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
it('should record the Latin fallback letter on a non-Latin layout', () => {
|
|
1037
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
1038
|
+
notifier.emitter.fire(RUSSIAN_LAYOUT);
|
|
1039
|
+
|
|
1040
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({
|
|
1041
|
+
key: 'с', code: 'KeyC', ctrlKey: true
|
|
1042
|
+
})?.toAuthoredKeybindingString()).to.equal('ctrl+c');
|
|
1043
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({
|
|
1044
|
+
key: 'С', code: 'KeyC', ctrlKey: true, shiftKey: true
|
|
1045
|
+
})?.toAuthoredKeybindingString()).to.equal('shift+ctrl+c');
|
|
1046
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({
|
|
1047
|
+
key: '€', code: 'KeyE', ctrlKey: true, altGraph: true
|
|
1048
|
+
})?.toAuthoredKeybindingString()).to.equal('ctrl+€');
|
|
1049
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({
|
|
1050
|
+
key: 'у', code: 'KeyE', ctrlKey: true
|
|
1051
|
+
})?.toAuthoredKeybindingString()).to.equal('ctrl+e');
|
|
1052
|
+
|
|
1053
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
1054
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({
|
|
1055
|
+
key: 'c', code: 'KeyC', ctrlKey: true
|
|
1056
|
+
})?.toAuthoredKeybindingString()).to.equal('ctrl+c');
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
it('should record legacy Windows AltGraph input as its logical character', () => {
|
|
1060
|
+
const windows = sinon.stub(os, 'isWindows').value(true);
|
|
1061
|
+
try {
|
|
1062
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
1063
|
+
|
|
1064
|
+
for (const altGraph of [true, false]) {
|
|
1065
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({
|
|
1066
|
+
key: '[', code: 'Digit8', ctrlKey: true, altKey: true, altGraph
|
|
1067
|
+
})?.toString()).to.equal('[');
|
|
1068
|
+
}
|
|
1069
|
+
} finally {
|
|
1070
|
+
windows.restore();
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
it('should retain command Shift when layout modifier Shift is not the logical binding', () => {
|
|
1075
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations').returns([
|
|
1076
|
+
new KeyCode({ key: Key.KEY_P, ctrl: true, character: 'P', layoutModifiers: 'shift', interpretation: 'layoutModifiers' })
|
|
1077
|
+
]);
|
|
1078
|
+
|
|
1079
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({ key: 'P', code: 'KeyP' })?.toString()).to.equal('shift+ctrl+p');
|
|
1080
|
+
interpretations.restore();
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
it('should persist a parseable logical character produced by Shift', () => {
|
|
1084
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations').returns([
|
|
1085
|
+
new KeyCode({ key: Key.DIGIT7, character: '/', layoutModifiers: 'shift', interpretation: 'layoutModifiers' })
|
|
1086
|
+
]);
|
|
1087
|
+
const resolve = sinon.stub(testContainer.get(KeyboardLayoutService), 'resolveKeyCode').callsFake(code => code.key === Key.SLASH
|
|
1088
|
+
? new KeyCode({ key: Key.DIGIT7, character: '/', layoutModifiers: 'shift' })
|
|
1089
|
+
: code);
|
|
1090
|
+
|
|
1091
|
+
expect(keybindingRegistry.authoredKeyCodeForKeyboardInput({ key: '/', code: 'Digit7' })?.toString()).to.equal('/');
|
|
1092
|
+
resolve.restore();
|
|
1093
|
+
interpretations.restore();
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
it('should record newly authorable printable characters logically', () => {
|
|
1097
|
+
const layoutCode = new KeyCode({ key: Key.SLASH, ctrl: true, character: '?', layoutModifiers: 'shift', interpretation: 'layoutModifiers' });
|
|
1098
|
+
const interpretations = sinon.stub(keybindingRegistry, 'getKeyCodeInterpretations').returns([layoutCode]);
|
|
1099
|
+
|
|
1100
|
+
const recorded = keybindingRegistry.authoredKeyCodeForKeyboardInput({ key: '?', code: 'Slash' });
|
|
1101
|
+
expect(recorded?.toString()).to.equal('ctrl+?');
|
|
1102
|
+
expect(keybindingRegistry.resolveKeybinding({ command: TEST_COMMAND.id, keybinding: recorded!.toString() })[0].dispatchString())
|
|
1103
|
+
.to.equal(layoutCode.dispatchString());
|
|
1104
|
+
interpretations.restore();
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
it('should record logical characters, physical non-printables, and ignore modifier-only input', () => {
|
|
1108
|
+
const registry = Object.create(KeybindingRegistry.prototype) as KeybindingRegistry;
|
|
1109
|
+
registry.authoredKeyCodeForKeyboardInput = input => {
|
|
1110
|
+
if (input.code === 'ControlLeft') {
|
|
1111
|
+
return new KeyCode({ ctrl: true });
|
|
1112
|
+
}
|
|
1113
|
+
if (input.code === 'F1') {
|
|
1114
|
+
return new KeyCode({ key: Key.F1, ctrl: true });
|
|
1115
|
+
}
|
|
1116
|
+
if (input.code === 'Delete') {
|
|
1117
|
+
return new KeyCode({ key: Key.DELETE, ctrl: true });
|
|
1118
|
+
}
|
|
1119
|
+
if (input.code === 'KeyP') {
|
|
1120
|
+
return new KeyCode({ key: Key.KEY_P, ctrl: true, shift: true, character: 'P' });
|
|
1121
|
+
}
|
|
1122
|
+
return new KeyCode({ key: input.code === 'Equal' ? Key.EQUAL : Key.BRACKET_LEFT, ctrl: true, character: input.key });
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
expect(registry.authoredKeybindingStringForKeyboardInput({ key: '[', code: 'Digit8', ctrlKey: true })).to.equal('ctrl+[');
|
|
1126
|
+
expect(registry.authoredKeybindingStringForKeyboardInput({ key: '+', code: 'Equal', ctrlKey: true })).to.equal('ctrl+[char:0x2B]');
|
|
1127
|
+
expect(registry.authoredKeybindingStringForKeyboardInput({ key: 'F1', code: 'F1', ctrlKey: true })).to.equal('ctrl+f1');
|
|
1128
|
+
expect(registry.authoredKeybindingStringForKeyboardInput({ key: 'Delete', code: 'Delete', ctrlKey: true })).to.equal('ctrl+delete');
|
|
1129
|
+
const shifted = registry.authoredKeybindingStringForKeyboardInput({ key: 'P', code: 'KeyP', ctrlKey: true, shiftKey: true });
|
|
1130
|
+
expect(shifted).to.equal('shift+ctrl+p');
|
|
1131
|
+
expect(KeyCode.parse(shifted!).dispatchString()).to.equal('shift+ctrl+p');
|
|
1132
|
+
expect(registry.authoredKeybindingStringForKeyboardInput({ key: 'Control', code: 'ControlLeft', ctrlKey: true })).to.be.undefined;
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
it('should record Space and numpad keys by name', () => {
|
|
1136
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: ' ', code: 'Space', ctrlKey: true, shiftKey: true }))
|
|
1137
|
+
.to.equal('shift+ctrl+space');
|
|
1138
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: '+', code: 'NumpadAdd', ctrlKey: true })).to.equal('ctrl+add');
|
|
1139
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: '-', code: 'NumpadSubtract', ctrlKey: true })).to.equal('ctrl+subtract');
|
|
1140
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: '.', code: 'NumpadDecimal', ctrlKey: true })).to.equal('ctrl+decimal');
|
|
1141
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: '1', code: 'Numpad1', ctrlKey: true })).to.equal('ctrl+1');
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
it('should dispatch and record Option bindings as command modifiers on macOS', async () => {
|
|
1145
|
+
stub.value(true);
|
|
1146
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
1147
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-mac.json'));
|
|
1148
|
+
const execute = sinon.spy();
|
|
1149
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
1150
|
+
try {
|
|
1151
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [{ command: TEST_COMMAND_SHADOW.id, keybinding: 'shift+alt+p' }]);
|
|
1152
|
+
keybindingRegistry.run(testKeyboardEvent({ key: '∏', code: 'KeyP', shiftKey: true, altKey: true }));
|
|
1153
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
1154
|
+
|
|
1155
|
+
expect(execute.calledOnce).to.be.true;
|
|
1156
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: '∏', code: 'KeyP', shiftKey: true, altKey: true }))
|
|
1157
|
+
.to.equal('shift+alt+p');
|
|
1158
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'π', code: 'KeyP', altKey: true })).to.equal('alt+p');
|
|
1159
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'P', code: 'KeyP', shiftKey: true })).to.equal('shift+p');
|
|
1160
|
+
} finally {
|
|
1161
|
+
handler.dispose();
|
|
1162
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
it('should dispatch and record dead Option keys as their base character on macOS', async () => {
|
|
1167
|
+
stub.value(true);
|
|
1168
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
1169
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-mac.json'));
|
|
1170
|
+
const execute = sinon.spy();
|
|
1171
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
1172
|
+
try {
|
|
1173
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [{ command: TEST_COMMAND_SHADOW.id, keybinding: 'alt+e' }]);
|
|
1174
|
+
keybindingRegistry.run(testKeyboardEvent({ key: 'Dead', code: 'KeyE', altKey: true }));
|
|
1175
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
1176
|
+
|
|
1177
|
+
expect(execute.calledOnce).to.be.true;
|
|
1178
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'Dead', code: 'KeyE', altKey: true })).to.equal('alt+e');
|
|
1179
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'Dead', code: 'KeyE', altKey: true, shiftKey: true }))
|
|
1180
|
+
.to.equal('shift+alt+e');
|
|
1181
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'Dead', code: 'KeyE', altKey: true, metaKey: true }))
|
|
1182
|
+
.to.equal('meta+alt+e');
|
|
1183
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'F1', code: 'F1', altKey: true })).to.equal('alt+f1');
|
|
1184
|
+
|
|
1185
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [{ command: TEST_COMMAND_SHADOW.id, keybinding: 'shift+alt+e' }]);
|
|
1186
|
+
keybindingRegistry.run(testKeyboardEvent({ key: 'Dead', code: 'KeyE', altKey: true, shiftKey: true }));
|
|
1187
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
1188
|
+
expect(execute.calledTwice).to.be.true;
|
|
1189
|
+
} finally {
|
|
1190
|
+
handler.dispose();
|
|
1191
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
it('should record Caps Lock input with the layout layer case', async () => {
|
|
1196
|
+
const notifier = testContainer.get(MockKeyboardLayoutChangeNotifier);
|
|
1197
|
+
const execute = sinon.spy();
|
|
1198
|
+
const handler = commandRegistry.registerHandler(TEST_COMMAND_SHADOW.id, { execute });
|
|
1199
|
+
try {
|
|
1200
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'p', code: 'KeyP', ctrlKey: true, shiftKey: true }))
|
|
1201
|
+
.to.equal('shift+ctrl+p');
|
|
1202
|
+
|
|
1203
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-pc.json'));
|
|
1204
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'ü', code: 'BracketLeft', ctrlKey: true, shiftKey: true }))
|
|
1205
|
+
.to.equal('ctrl+Ü');
|
|
1206
|
+
const recorded = keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'Ü', code: 'BracketLeft', ctrlKey: true });
|
|
1207
|
+
expect(recorded).to.equal('ctrl+ü');
|
|
1208
|
+
|
|
1209
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [{ command: TEST_COMMAND_SHADOW.id, keybinding: recorded! }]);
|
|
1210
|
+
keybindingRegistry.dispatchNormalizedKeyDown({ key: 'ü', code: 'BracketLeft', ctrlKey: true }, new EventTarget());
|
|
1211
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
1212
|
+
expect(execute.calledOnce).to.be.true;
|
|
1213
|
+
|
|
1214
|
+
notifier.emitter.fire({
|
|
1215
|
+
info: { id: 'altgraph-letters', lang: 'pl' },
|
|
1216
|
+
mapping: { KeyL: { value: 'l', withShift: 'L', withAltGr: 'ł', withShiftAltGr: 'Ł' } }
|
|
1217
|
+
});
|
|
1218
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'Ł', code: 'KeyL', ctrlKey: true, altGraph: true }))
|
|
1219
|
+
.to.equal('ctrl+ł');
|
|
1220
|
+
|
|
1221
|
+
stub.value(true);
|
|
1222
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/de-German-mac.json'));
|
|
1223
|
+
expect(keybindingRegistry.authoredKeybindingStringForKeyboardInput({ key: 'Å', code: 'KeyA', altKey: true })).to.equal('alt+a');
|
|
1224
|
+
} finally {
|
|
1225
|
+
handler.dispose();
|
|
1226
|
+
notifier.emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
1227
|
+
}
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1230
|
+
it('should classify interpretation shadowing separately from canonical collisions', () => {
|
|
1231
|
+
const logical = {
|
|
1232
|
+
command: TEST_COMMAND.id,
|
|
1233
|
+
keybinding: 'ctrl+[',
|
|
1234
|
+
resolved: [new KeyCode({ key: Key.DIGIT8, ctrl: true, character: '[', layoutModifiers: 'altGraph' })]
|
|
1235
|
+
};
|
|
1236
|
+
const command = { command: TEST_COMMAND2.id, keybinding: 'ctrl+alt+8' };
|
|
1237
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [logical, command]);
|
|
1238
|
+
|
|
1239
|
+
const diagnostics = keybindingRegistry.getKeybindingCollisionDiagnostics(logical);
|
|
1240
|
+
expect(diagnostics.shadowedBy.map(binding => binding.command)).to.include(TEST_COMMAND2.id);
|
|
1241
|
+
expect(diagnostics.authored.full).to.be.empty;
|
|
1242
|
+
expect(diagnostics.layoutDerived.full).to.be.empty;
|
|
1243
|
+
expect(keybindingRegistry.containsKeybindingInScope(logical)).to.be.false;
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
it('should keep shifted printable bindings symmetric in keyCode dispatch mode', () => {
|
|
1247
|
+
(corePreferences as unknown as Record<string, unknown>)['keyboard.dispatch'] = 'keyCode';
|
|
1248
|
+
const commandPalette = { command: TEST_COMMAND.id, keybinding: 'ctrl+shift+p' };
|
|
1249
|
+
const shiftedPrintable = { command: TEST_COMMAND2.id, keybinding: 'shift+/' };
|
|
1250
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [commandPalette, shiftedPrintable]);
|
|
1251
|
+
|
|
1252
|
+
expect(keybindingRegistry.matchKeybinding(KeySequence.parse('ctrl+shift+p'))?.runtime.binding.command).to.equal(TEST_COMMAND.id);
|
|
1253
|
+
expect(keybindingRegistry.matchKeybinding(KeySequence.parse('shift+/'))?.runtime.binding.command).to.equal(TEST_COMMAND2.id);
|
|
1254
|
+
});
|
|
1255
|
+
|
|
1256
|
+
it('should mark character-only bindings inactive in keyCode dispatch mode', () => {
|
|
1257
|
+
(corePreferences as unknown as Record<string, unknown>)['keyboard.dispatch'] = 'keyCode';
|
|
1258
|
+
const characterOnly = { command: TEST_COMMAND.id, keybinding: 'ctrl+ü' };
|
|
1259
|
+
const positional = { command: TEST_COMMAND2.id, keybinding: 'ctrl+[' };
|
|
1260
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [characterOnly, positional]);
|
|
1261
|
+
|
|
1262
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(characterOnly)).to.be.a('string');
|
|
1263
|
+
expect(keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(characterOnly))).to.be.undefined;
|
|
1264
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(positional)).to.be.undefined;
|
|
1265
|
+
expect(keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(positional))?.kind).to.equal('full');
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
it('should require resolved sequences for logical matching in code dispatch mode', () => {
|
|
1269
|
+
testContainer.get(MockKeyboardLayoutChangeNotifier).emitter.fire(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
1270
|
+
const binding = { command: TEST_COMMAND.id, keybinding: 'ctrl+shift+a' };
|
|
1271
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
1272
|
+
|
|
1273
|
+
expect(KeySequence.parse('ctrl+shift+a')[0].dispatchString()).to.equal('shift+ctrl+a');
|
|
1274
|
+
expect(keybindingRegistry.resolveKeybinding(binding)[0].dispatchString()).to.equal('ctrl+a@shift');
|
|
1275
|
+
expect(keybindingRegistry.matchKeybinding(KeySequence.parse('ctrl+shift+a'))).to.be.undefined;
|
|
1276
|
+
expect(keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(binding))?.kind).to.equal('full');
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
it('should invalidate resolved bindings when keyboard dispatch changes', () => {
|
|
1280
|
+
const binding = { command: TEST_COMMAND.id, keybinding: 'ctrl+[' };
|
|
1281
|
+
keybindingRegistry.setKeymap(KeybindingScope.USER, [binding]);
|
|
1282
|
+
expect(keybindingRegistry.getKeybindingInactiveReason(binding)).to.be.undefined;
|
|
1283
|
+
const changed = sinon.spy();
|
|
1284
|
+
keybindingRegistry.onKeybindingsChanged(changed);
|
|
1285
|
+
|
|
1286
|
+
(corePreferences as unknown as Record<string, unknown>)['keyboard.dispatch'] = 'keyCode';
|
|
1287
|
+
preferenceChanged.fire({ preferenceName: 'keyboard.dispatch' });
|
|
1288
|
+
|
|
1289
|
+
expect(changed.calledOnce).to.be.true;
|
|
1290
|
+
expect(keybindingRegistry.resolveKeybinding(binding)[0].dispatchString()).to.equal('ctrl+[');
|
|
1291
|
+
expect(keybindingRegistry.matchKeybinding(KeySequence.parse('ctrl+['))?.kind).to.equal('full');
|
|
477
1292
|
});
|
|
478
1293
|
|
|
479
1294
|
it('should prioritize bindings that use local context keys', () => {
|
|
@@ -519,11 +1334,11 @@ describe('keybindings', () => {
|
|
|
519
1334
|
});
|
|
520
1335
|
Object.defineProperty(mockEvent, 'target', { value: targetElement });
|
|
521
1336
|
|
|
522
|
-
const match = keybindingRegistry.matchKeybinding(
|
|
1337
|
+
const match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(localBinding), mockEvent);
|
|
523
1338
|
|
|
524
1339
|
// The localBinding should be selected because it uses a local context key
|
|
525
1340
|
expect(match?.kind).to.be.equal('full');
|
|
526
|
-
expect(match?.binding?.command).to.be.equal('test.local-command');
|
|
1341
|
+
expect(match?.runtime.binding?.command).to.be.equal('test.local-command');
|
|
527
1342
|
|
|
528
1343
|
disable();
|
|
529
1344
|
});
|
|
@@ -566,11 +1381,11 @@ describe('keybindings', () => {
|
|
|
566
1381
|
});
|
|
567
1382
|
Object.defineProperty(mockEvent, 'target', { value: targetElement });
|
|
568
1383
|
|
|
569
|
-
const match = keybindingRegistry.matchKeybinding(
|
|
1384
|
+
const match = keybindingRegistry.matchKeybinding(keybindingRegistry.resolveKeybinding(secondBinding), mockEvent);
|
|
570
1385
|
|
|
571
1386
|
// Should fall back to first enabled binding in priority order (secondBinding was registered later, so it wins)
|
|
572
1387
|
expect(match?.kind).to.be.equal('full');
|
|
573
|
-
expect(match?.binding?.command).to.be.equal('test.second-command');
|
|
1388
|
+
expect(match?.runtime.binding?.command).to.be.equal('test.second-command');
|
|
574
1389
|
|
|
575
1390
|
disable();
|
|
576
1391
|
});
|
|
@@ -593,6 +1408,55 @@ describe('acceleratorForKeyCode', () => {
|
|
|
593
1408
|
expect(accelerator).to.equal('⌘V');
|
|
594
1409
|
});
|
|
595
1410
|
|
|
1411
|
+
it('separates logical labels from physical layout modifier realizations', () => {
|
|
1412
|
+
const logicalBracket = new KeyCode({
|
|
1413
|
+
key: Key.DIGIT8,
|
|
1414
|
+
ctrl: true,
|
|
1415
|
+
character: '[',
|
|
1416
|
+
layoutModifiers: 'altGraph'
|
|
1417
|
+
});
|
|
1418
|
+
const logicalSlash = new KeyCode({
|
|
1419
|
+
key: Key.DIGIT7,
|
|
1420
|
+
character: '/',
|
|
1421
|
+
layoutModifiers: 'shift'
|
|
1422
|
+
});
|
|
1423
|
+
|
|
1424
|
+
expect(keybindingRegistry.componentsForKeyCode(logicalBracket)).to.deep.equal(['Ctrl', '[']);
|
|
1425
|
+
expect(keybindingRegistry.componentsForKeyCode(logicalBracket, false, 'physical')).to.deep.equal(['Ctrl', 'AltGr', '8']);
|
|
1426
|
+
expect(keybindingRegistry.acceleratorForKeyCode(logicalBracket, '+', true, 'physical')).to.equal('Ctrl+AltGr+8');
|
|
1427
|
+
expect(keybindingRegistry.componentsForKeyCode(logicalSlash)).to.deep.equal(['/']);
|
|
1428
|
+
expect(keybindingRegistry.componentsForKeyCode(logicalSlash, false, 'physical')).to.deep.equal(['Shift', '7']);
|
|
1429
|
+
expect(keybindingRegistry.acceleratorForKeyCode(logicalSlash, '+', true, 'physical')).to.equal('Shift+7');
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
it('keeps command Shift in physical realizations', () => {
|
|
1433
|
+
const commandShift = new KeyCode({ key: Key.TAB, ctrl: true, shift: true });
|
|
1434
|
+
expect(keybindingRegistry.componentsForKeyCode(commandShift, false, 'physical')).to.deep.equal(['Ctrl', 'Shift', 'Tab']);
|
|
1435
|
+
|
|
1436
|
+
const shiftedLetter = new KeyCode({ key: Key.KEY_P, ctrl: true, character: 'P', layoutModifiers: 'shift' });
|
|
1437
|
+
expect(keybindingRegistry.componentsForKeyCode(shiftedLetter)).to.deep.equal(['Ctrl', 'Shift', 'P']);
|
|
1438
|
+
|
|
1439
|
+
const unresolvedCharacter = new KeyCode({ ctrl: true, character: '§', supportedByLayout: false });
|
|
1440
|
+
expect(keybindingRegistry.componentsForKeyCode(unresolvedCharacter)).to.deep.equal(['Ctrl', '§']);
|
|
1441
|
+
});
|
|
1442
|
+
|
|
1443
|
+
it('deduplicates command Alt and layout modifier Option on macOS', () => {
|
|
1444
|
+
stub.value(true);
|
|
1445
|
+
const commandAndLayoutOption = new KeyCode({
|
|
1446
|
+
key: Key.DIGIT6,
|
|
1447
|
+
meta: true,
|
|
1448
|
+
ctrl: true,
|
|
1449
|
+
alt: true,
|
|
1450
|
+
layoutModifiers: 'altGraph'
|
|
1451
|
+
});
|
|
1452
|
+
const layoutOption = new KeyCode({ key: Key.DIGIT6, layoutModifiers: 'altGraph' });
|
|
1453
|
+
|
|
1454
|
+
expect(keybindingRegistry.componentsForKeyCode(commandAndLayoutOption, false, 'physical')).to.deep.equal(['⌘', '⌃', '⌥', '6']);
|
|
1455
|
+
expect(keybindingRegistry.componentsForKeyCode(commandAndLayoutOption, true, 'physical')).to.deep.equal(['Cmd', 'Ctrl', 'Alt', '6']);
|
|
1456
|
+
expect(keybindingRegistry.componentsForKeyCode(layoutOption, false, 'physical')).to.deep.equal(['⌥', '6']);
|
|
1457
|
+
expect(keybindingRegistry.componentsForKeyCode(layoutOption, true, 'physical')).to.deep.equal(['Option', '6']);
|
|
1458
|
+
});
|
|
1459
|
+
|
|
596
1460
|
it('uses ASCII names with the separator on macOS Electron (asciiOnly)', () => {
|
|
597
1461
|
stub.value(true);
|
|
598
1462
|
const accelerator = keybindingRegistry.acceleratorForKeyCode(metaV, '+', true);
|
|
@@ -655,16 +1519,13 @@ class MockContextKeyService extends ContextKeyServiceDummyImpl {
|
|
|
655
1519
|
@injectable()
|
|
656
1520
|
class MockKeyboardLayoutProvider implements KeyboardLayoutProvider {
|
|
657
1521
|
getNativeLayout(): Promise<NativeKeyboardLayout> {
|
|
658
|
-
return Promise.resolve(
|
|
659
|
-
info: { id: 'mock', lang: 'en' },
|
|
660
|
-
mapping: {}
|
|
661
|
-
});
|
|
1522
|
+
return Promise.resolve(require('../../src/common/keyboard/layouts/en-US-pc.json'));
|
|
662
1523
|
}
|
|
663
1524
|
}
|
|
664
1525
|
|
|
665
1526
|
@injectable()
|
|
666
1527
|
class MockKeyboardLayoutChangeNotifier implements KeyboardLayoutChangeNotifier {
|
|
667
|
-
|
|
1528
|
+
readonly emitter = new Emitter<NativeKeyboardLayout>();
|
|
668
1529
|
get onDidChangeNativeLayout(): Event<NativeKeyboardLayout> {
|
|
669
1530
|
return this.emitter.event;
|
|
670
1531
|
}
|