mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
Merge from vscode 6268feb42ba4f2e2fa15484e88c9af60d254998c (#6530)
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution';
|
||||
|
||||
KeyboardLayoutContribution.INSTANCE.registerKeyboardLayout({
|
||||
layout: { id: 'com.apple.keylayout.Dvorak', localizedName: 'Dvorak', lang: 'en' },
|
||||
secondaryLayouts: [],
|
||||
mapping: {
|
||||
KeyA: ['a', 'A', 'å', 'Å', 0],
|
||||
KeyB: ['x', 'X', '≈', '˛', 0],
|
||||
KeyC: ['j', 'J', '∆', 'Ô', 0],
|
||||
KeyD: ['e', 'E', '´', '´', 4],
|
||||
KeyE: ['.', '>', '≥', '˘', 0],
|
||||
KeyF: ['u', 'U', '¨', '¨', 4],
|
||||
KeyG: ['i', 'I', 'ˆ', 'ˆ', 4],
|
||||
KeyH: ['d', 'D', '∂', 'Î', 0],
|
||||
KeyI: ['c', 'C', 'ç', 'Ç', 0],
|
||||
KeyJ: ['h', 'H', '˙', 'Ó', 0],
|
||||
KeyK: ['t', 'T', '†', 'ˇ', 0],
|
||||
KeyL: ['n', 'N', '˜', '˜', 4],
|
||||
KeyM: ['m', 'M', 'µ', 'Â', 0],
|
||||
KeyN: ['b', 'B', '∫', 'ı', 0],
|
||||
KeyO: ['r', 'R', '®', '‰', 0],
|
||||
KeyP: ['l', 'L', '¬', 'Ò', 0],
|
||||
KeyQ: ['\'', '"', 'æ', 'Æ', 0],
|
||||
KeyR: ['p', 'P', 'π', '∏', 0],
|
||||
KeyS: ['o', 'O', 'ø', 'Ø', 0],
|
||||
KeyT: ['y', 'Y', '¥', 'Á', 0],
|
||||
KeyU: ['g', 'G', '©', '˝', 0],
|
||||
KeyV: ['k', 'K', '˚', '', 0],
|
||||
KeyW: [',', '<', '≤', '¯', 0],
|
||||
KeyX: ['q', 'Q', 'œ', 'Œ', 0],
|
||||
KeyY: ['f', 'F', 'ƒ', 'Ï', 0],
|
||||
KeyZ: [';', ':', '…', 'Ú', 0],
|
||||
Digit1: ['1', '!', '¡', '⁄', 0],
|
||||
Digit2: ['2', '@', '™', '€', 0],
|
||||
Digit3: ['3', '#', '£', '‹', 0],
|
||||
Digit4: ['4', '$', '¢', '›', 0],
|
||||
Digit5: ['5', '%', '∞', 'fi', 0],
|
||||
Digit6: ['6', '^', '§', 'fl', 0],
|
||||
Digit7: ['7', '&', '¶', '‡', 0],
|
||||
Digit8: ['8', '*', '•', '°', 0],
|
||||
Digit9: ['9', '(', 'ª', '·', 0],
|
||||
Digit0: ['0', ')', 'º', '‚', 0],
|
||||
Enter: [],
|
||||
Escape: [],
|
||||
Backspace: [],
|
||||
Tab: [],
|
||||
Space: [' ', ' ', ' ', ' ', 0],
|
||||
Minus: ['[', '{', '“', '”', 0],
|
||||
Equal: [']', '}', '‘', '’', 0],
|
||||
BracketLeft: ['/', '?', '÷', '¿', 0],
|
||||
BracketRight: ['=', '+', '≠', '±', 0],
|
||||
Backslash: ['\\', '|', '«', '»', 0],
|
||||
Semicolon: ['s', 'S', 'ß', 'Í', 0],
|
||||
Quote: ['-', '_', '–', '—', 0],
|
||||
Backquote: ['`', '~', '`', '`', 4],
|
||||
Comma: ['w', 'W', '∑', '„', 0],
|
||||
Period: ['v', 'V', '√', '◊', 0],
|
||||
Slash: ['z', 'Z', 'Ω', '¸', 0],
|
||||
CapsLock: [],
|
||||
F1: [],
|
||||
F2: [],
|
||||
F3: [],
|
||||
F4: [],
|
||||
F5: [],
|
||||
F6: [],
|
||||
F7: [],
|
||||
F8: [],
|
||||
F9: [],
|
||||
F10: [],
|
||||
F11: [],
|
||||
F12: [],
|
||||
Insert: [],
|
||||
Home: [],
|
||||
PageUp: [],
|
||||
Delete: [],
|
||||
End: [],
|
||||
PageDown: [],
|
||||
ArrowRight: [],
|
||||
ArrowLeft: [],
|
||||
ArrowDown: [],
|
||||
ArrowUp: [],
|
||||
NumLock: [],
|
||||
NumpadDivide: ['/', '/', '/', '/', 0],
|
||||
NumpadMultiply: ['*', '*', '*', '*', 0],
|
||||
NumpadSubtract: ['-', '-', '-', '-', 0],
|
||||
NumpadAdd: ['+', '+', '+', '+', 0],
|
||||
NumpadEnter: [],
|
||||
Numpad1: ['1', '1', '1', '1', 0],
|
||||
Numpad2: ['2', '2', '2', '2', 0],
|
||||
Numpad3: ['3', '3', '3', '3', 0],
|
||||
Numpad4: ['4', '4', '4', '4', 0],
|
||||
Numpad5: ['5', '5', '5', '5', 0],
|
||||
Numpad6: ['6', '6', '6', '6', 0],
|
||||
Numpad7: ['7', '7', '7', '7', 0],
|
||||
Numpad8: ['8', '8', '8', '8', 0],
|
||||
Numpad9: ['9', '9', '9', '9', 0],
|
||||
Numpad0: ['0', '0', '0', '0', 0],
|
||||
NumpadDecimal: ['.', '.', '.', '.', 0],
|
||||
IntlBackslash: ['§', '±', '§', '±', 0],
|
||||
ContextMenu: [],
|
||||
NumpadEqual: ['=', '=', '=', '=', 0],
|
||||
F13: [],
|
||||
F14: [],
|
||||
F15: [],
|
||||
F16: [],
|
||||
F17: [],
|
||||
F18: [],
|
||||
F19: [],
|
||||
F20: [],
|
||||
AudioVolumeMute: [],
|
||||
AudioVolumeUp: ['', '=', '', '=', 0],
|
||||
AudioVolumeDown: [],
|
||||
NumpadComma: [],
|
||||
IntlRo: [],
|
||||
KanaMode: [],
|
||||
IntlYen: [],
|
||||
ControlLeft: [],
|
||||
ShiftLeft: [],
|
||||
AltLeft: [],
|
||||
MetaLeft: [],
|
||||
ControlRight: [],
|
||||
ShiftRight: [],
|
||||
AltRight: [],
|
||||
MetaRight: []
|
||||
}
|
||||
});
|
||||
@@ -18,5 +18,6 @@ import 'vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin';
|
||||
import 'vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin';
|
||||
import 'vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin';
|
||||
import 'vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin';
|
||||
import 'vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin';
|
||||
|
||||
export { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution';
|
||||
export { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution';
|
||||
|
||||
@@ -26,9 +26,9 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { Extensions as ConfigExtensions, IConfigurationRegistry, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { INavigatorWithKeyboard } from 'vs/workbench/services/keybinding/common/navigatorKeyboard';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { StorageScope, IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
||||
export class BrowserKeyboardMapperFactoryBase {
|
||||
// keyboard mapper
|
||||
@@ -71,9 +71,9 @@ export class BrowserKeyboardMapperFactoryBase {
|
||||
}
|
||||
|
||||
protected constructor(
|
||||
private _notificationService: INotificationService,
|
||||
private _storageService: IStorageService,
|
||||
private _commandService: ICommandService
|
||||
// private _notificationService: INotificationService,
|
||||
// private _storageService: IStorageService,
|
||||
// private _commandService: ICommandService
|
||||
) {
|
||||
this._keyboardMapper = null;
|
||||
this._initialized = false;
|
||||
@@ -178,32 +178,34 @@ export class BrowserKeyboardMapperFactoryBase {
|
||||
setActiveKeyMapping(keymap: IKeyboardMapping | null) {
|
||||
let matchedKeyboardLayout = this.getMatchedKeymapInfo(keymap);
|
||||
if (matchedKeyboardLayout) {
|
||||
let score = matchedKeyboardLayout.score;
|
||||
// let score = matchedKeyboardLayout.score;
|
||||
|
||||
if (keymap && score < 0) {
|
||||
const donotAskUpdateKey = 'missing.keyboardlayout.donotask';
|
||||
if (this._storageService.getBoolean(donotAskUpdateKey, StorageScope.GLOBAL)) {
|
||||
return;
|
||||
}
|
||||
// Due to https://bugs.chromium.org/p/chromium/issues/detail?id=977609, any key after a dead key will generate a wrong mapping,
|
||||
// we shoud avoid yielding the false error.
|
||||
// if (keymap && score < 0) {
|
||||
// const donotAskUpdateKey = 'missing.keyboardlayout.donotask';
|
||||
// if (this._storageService.getBoolean(donotAskUpdateKey, StorageScope.GLOBAL)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// the keyboard layout doesn't actually match the key event or the keymap from chromium
|
||||
this._notificationService.prompt(
|
||||
Severity.Info,
|
||||
nls.localize('missing.keyboardlayout', 'Fail to find matching keyboard layout'),
|
||||
[{
|
||||
label: nls.localize('keyboardLayoutMissing.configure', "Configure"),
|
||||
run: () => this._commandService.executeCommand('workbench.action.openKeyboardLayoutPicker')
|
||||
}, {
|
||||
label: nls.localize('neverAgain', "Don't Show Again"),
|
||||
isSecondary: true,
|
||||
run: () => this._storageService.store(donotAskUpdateKey, true, StorageScope.GLOBAL)
|
||||
}]
|
||||
);
|
||||
// // the keyboard layout doesn't actually match the key event or the keymap from chromium
|
||||
// this._notificationService.prompt(
|
||||
// Severity.Info,
|
||||
// nls.localize('missing.keyboardlayout', 'Fail to find matching keyboard layout'),
|
||||
// [{
|
||||
// label: nls.localize('keyboardLayoutMissing.configure', "Configure"),
|
||||
// run: () => this._commandService.executeCommand('workbench.action.openKeyboardLayoutPicker')
|
||||
// }, {
|
||||
// label: nls.localize('neverAgain', "Don't Show Again"),
|
||||
// isSecondary: true,
|
||||
// run: () => this._storageService.store(donotAskUpdateKey, true, StorageScope.GLOBAL)
|
||||
// }]
|
||||
// );
|
||||
|
||||
console.warn('Active keymap/keyevent does not match current keyboard layout', JSON.stringify(keymap), this._activeKeymapInfo ? JSON.stringify(this._activeKeymapInfo.layout) : '');
|
||||
// console.warn('Active keymap/keyevent does not match current keyboard layout', JSON.stringify(keymap), this._activeKeymapInfo ? JSON.stringify(this._activeKeymapInfo.layout) : '');
|
||||
|
||||
return;
|
||||
}
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (!this._activeKeymapInfo) {
|
||||
this._activeKeymapInfo = matchedKeyboardLayout.result;
|
||||
@@ -336,7 +338,7 @@ export class BrowserKeyboardMapperFactoryBase {
|
||||
}
|
||||
|
||||
if (mapping.value === '') {
|
||||
// we don't undetstand
|
||||
// The value is empty when the key is not a printable character, we skip validation.
|
||||
if (keyboardEvent.ctrlKey || keyboardEvent.metaKey) {
|
||||
setTimeout(() => {
|
||||
this._getBrowserKeyMapping().then((keymap: IKeyboardMapping) => {
|
||||
@@ -426,7 +428,8 @@ export class BrowserKeyboardMapperFactoryBase {
|
||||
|
||||
export class BrowserKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
|
||||
constructor(notificationService: INotificationService, storageService: IStorageService, commandService: ICommandService) {
|
||||
super(notificationService, storageService, commandService);
|
||||
// super(notificationService, storageService, commandService);
|
||||
super();
|
||||
|
||||
const platform = isWindows ? 'win' : isMacintosh ? 'darwin' : 'linux';
|
||||
|
||||
@@ -621,4 +624,4 @@ const keyboardConfiguration: IConfigurationNode = {
|
||||
}
|
||||
};
|
||||
|
||||
configurationRegistry.registerConfiguration(keyboardConfiguration);
|
||||
configurationRegistry.registerConfiguration(keyboardConfiguration);
|
||||
|
||||
@@ -17,7 +17,8 @@ import { TestNotificationService } from 'vs/platform/notification/test/common/te
|
||||
|
||||
class TestKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
|
||||
constructor(notificationService: INotificationService, storageService: IStorageService, commandService: ICommandService) {
|
||||
super(notificationService, storageService, commandService);
|
||||
// super(notificationService, storageService, commandService);
|
||||
super();
|
||||
|
||||
const keymapInfos: IKeymapInfo[] = KeyboardLayoutContribution.INSTANCE.layoutInfos;
|
||||
this._keymapInfos.push(...keymapInfos.map(info => (new KeymapInfo(info.layout, info.secondaryLayouts, info.mapping, info.isUserKeyboardLayout))));
|
||||
@@ -146,4 +147,4 @@ suite('keyboard layout loader', () => {
|
||||
instance.setUSKeyboardLayout();
|
||||
assert.equal(instance.activeKeyboardLayout!.isUSStandard, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user