mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -21,6 +21,10 @@ export interface Modifiers {
|
||||
readonly metaKey: boolean;
|
||||
}
|
||||
|
||||
export interface KeyLabelProvider<T extends Modifiers> {
|
||||
(keybinding: T): string | null;
|
||||
}
|
||||
|
||||
export class ModifierLabelProvider {
|
||||
|
||||
public readonly modifierLabels: ModifierLabels[];
|
||||
@@ -32,11 +36,22 @@ export class ModifierLabelProvider {
|
||||
this.modifierLabels[OperatingSystem.Linux] = linux;
|
||||
}
|
||||
|
||||
public toLabel(firstPartMod: Modifiers | null, firstPartKey: string | null, chordPartMod: Modifiers | null, chordPartKey: string | null, OS: OperatingSystem): string | null {
|
||||
if (firstPartMod === null || firstPartKey === null) {
|
||||
public toLabel<T extends Modifiers>(OS: OperatingSystem, parts: T[], keyLabelProvider: KeyLabelProvider<T>): string | null {
|
||||
if (parts.length === 0) {
|
||||
return null;
|
||||
}
|
||||
return _asString(firstPartMod, firstPartKey, chordPartMod, chordPartKey, this.modifierLabels[OS]);
|
||||
|
||||
const result: string[] = [];
|
||||
for (let i = 0, len = parts.length; i < len; i++) {
|
||||
const part = parts[i];
|
||||
const keyLabel = keyLabelProvider(part);
|
||||
if (keyLabel === null) {
|
||||
// this keybinding cannot be expressed...
|
||||
return null;
|
||||
}
|
||||
result[i] = _simpleAsString(part, keyLabel, this.modifierLabels[OS]);
|
||||
}
|
||||
return result.join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +162,7 @@ function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabe
|
||||
return '';
|
||||
}
|
||||
|
||||
let result: string[] = [];
|
||||
const result: string[] = [];
|
||||
|
||||
// translate modifier keys: Ctrl-Shift-Alt-Meta
|
||||
if (modifiers.ctrlKey) {
|
||||
@@ -171,14 +186,3 @@ function _simpleAsString(modifiers: Modifiers, key: string, labels: ModifierLabe
|
||||
|
||||
return result.join(labels.separator);
|
||||
}
|
||||
|
||||
function _asString(firstPartMod: Modifiers, firstPartKey: string, chordPartMod: Modifiers | null, chordPartKey: string | null, labels: ModifierLabels): string {
|
||||
let result = _simpleAsString(firstPartMod, firstPartKey, labels);
|
||||
|
||||
if (chordPartMod !== null && chordPartKey !== null) {
|
||||
result += ' ';
|
||||
result += _simpleAsString(chordPartMod, chordPartKey, labels);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user