mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3
This commit is contained in:
@@ -11,11 +11,11 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { Keybinding, ResolvedKeybinding, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingParser } from 'vs/base/common/keybindingParser';
|
||||
import { OS, OperatingSystem } from 'vs/base/common/platform';
|
||||
import { OS, OperatingSystem, isMacintosh } from 'vs/base/common/platform';
|
||||
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { Extensions as ConfigExtensions, IConfigurationNode, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ContextKeyExpr, IContextKeyService, ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { AbstractKeybindingService } from 'vs/platform/keybinding/common/abstractKeybindingService';
|
||||
@@ -161,6 +161,18 @@ const NUMPAD_PRINTABLE_SCANCODES = [
|
||||
ScanCode.NumpadDecimal
|
||||
];
|
||||
|
||||
const otherMacNumpadMapping = new Map<ScanCode, KeyCode>();
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad1, KeyCode.KEY_1);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad2, KeyCode.KEY_2);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad3, KeyCode.KEY_3);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad4, KeyCode.KEY_4);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad5, KeyCode.KEY_5);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad6, KeyCode.KEY_6);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad7, KeyCode.KEY_7);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad8, KeyCode.KEY_8);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad9, KeyCode.KEY_9);
|
||||
otherMacNumpadMapping.set(ScanCode.Numpad0, KeyCode.KEY_0);
|
||||
|
||||
export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
|
||||
private _keyboardMapper: IKeyboardMapper;
|
||||
@@ -510,7 +522,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
|
||||
let commandAction = MenuRegistry.getCommand(command);
|
||||
let precondition = commandAction && commandAction.precondition;
|
||||
let fullWhen: ContextKeyExpr | undefined;
|
||||
let fullWhen: ContextKeyExpression | undefined;
|
||||
if (when && precondition) {
|
||||
fullWhen = ContextKeyExpr.and(precondition, ContextKeyExpr.deserialize(when));
|
||||
} else if (when) {
|
||||
@@ -589,6 +601,10 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
// NumLock is on or this is /, *, -, + on the numpad
|
||||
return true;
|
||||
}
|
||||
if (isMacintosh && event.keyCode === otherMacNumpadMapping.get(code)) {
|
||||
// on macOS, the numpad keys can also map to keys 1 - 0.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { SimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingParser } from 'vs/base/common/keybindingParser';
|
||||
import { ScanCodeBinding } from 'vs/base/common/scanCode';
|
||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ContextKeyExpr, ContextKeyExpression } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IUserFriendlyKeybinding } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface IUserKeybindingItem {
|
||||
parts: (SimpleKeybinding | ScanCodeBinding)[];
|
||||
command: string | null;
|
||||
commandArgs?: any;
|
||||
when: ContextKeyExpr | undefined;
|
||||
when: ContextKeyExpression | undefined;
|
||||
}
|
||||
|
||||
export class KeybindingIO {
|
||||
|
||||
@@ -12,8 +12,8 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { TestStorageService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
|
||||
class TestKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
|
||||
constructor(notificationService: INotificationService, storageService: IStorageService, commandService: ICommandService) {
|
||||
|
||||
@@ -38,7 +38,7 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
|
||||
import { KeybindingsEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService';
|
||||
import { TestBackupFileService, TestContextService, TestEditorGroupsService, TestEditorService, TestLifecycleService, TestTextResourcePropertiesService, TestWorkingCopyService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestBackupFileService, TestEditorGroupsService, TestEditorService, TestLifecycleService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
|
||||
@@ -54,11 +54,12 @@ import { IFilesConfigurationService, FilesConfigurationService } from 'vs/workbe
|
||||
import { WorkingCopyFileService, IWorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { UndoRedoService } from 'vs/platform/undoRedo/common/undoRedoService';
|
||||
import { TestTextResourcePropertiesService, TestContextService, TestWorkingCopyService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
|
||||
class TestEnvironmentService extends NativeWorkbenchEnvironmentService {
|
||||
|
||||
constructor(private _appSettingsHome: URI) {
|
||||
super(TestWindowConfiguration, TestWindowConfiguration.execPath, TestWindowConfiguration.windowId);
|
||||
super(TestWindowConfiguration, TestWindowConfiguration.execPath);
|
||||
}
|
||||
|
||||
get appSettingsHome() { return this._appSettingsHome; }
|
||||
|
||||
Reference in New Issue
Block a user