mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from master
This commit is contained in:
@@ -2,24 +2,21 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ResolvedKeybinding, KeyCode, KeyMod, KeyChord, Keybinding, createKeybinding, createSimpleKeybinding, SimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { AbstractKeybindingService } from 'vs/platform/keybinding/common/abstractKeybindingService';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { KeyChord, KeyCode, KeyMod, Keybinding, ResolvedKeybinding, SimpleKeybinding, createKeybinding, createSimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { IContext, ContextKeyExpr, IContextKeyService, IContextKeyServiceTarget } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import { ContextKeyExpr, IContext, IContextKeyService, IContextKeyServiceTarget } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { AbstractKeybindingService } from 'vs/platform/keybinding/common/abstractKeybindingService';
|
||||
import { IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { INotification, INotificationService, IPromptChoice, IPromptOptions, NoOpNotification } from 'vs/platform/notification/common/notification';
|
||||
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { INotificationService, NoOpNotification, INotification, IPromptChoice } from 'vs/platform/notification/common/notification';
|
||||
|
||||
function createContext(ctx: any) {
|
||||
return {
|
||||
@@ -86,11 +83,11 @@ suite('AbstractKeybindingService', () => {
|
||||
}
|
||||
|
||||
let createTestKeybindingService: (items: ResolvedKeybindingItem[], contextValue?: any) => TestKeybindingService = null;
|
||||
let currentContextValue: IContext = null;
|
||||
let currentContextValue: IContext | null = null;
|
||||
let executeCommandCalls: { commandId: string; args: any[]; }[] = null;
|
||||
let showMessageCalls: { sev: Severity, message: any; }[] = null;
|
||||
let statusMessageCalls: string[] = null;
|
||||
let statusMessageCallsDisposed: string[] = null;
|
||||
let statusMessageCalls: string[] | null = null;
|
||||
let statusMessageCallsDisposed: string[] | null = null;
|
||||
|
||||
setup(() => {
|
||||
executeCommandCalls = [];
|
||||
@@ -116,12 +113,12 @@ suite('AbstractKeybindingService', () => {
|
||||
let commandService: ICommandService = {
|
||||
_serviceBrand: undefined,
|
||||
onWillExecuteCommand: () => ({ dispose: () => { } }),
|
||||
executeCommand: (commandId: string, ...args: any[]): TPromise<any> => {
|
||||
executeCommand: (commandId: string, ...args: any[]): Promise<any> => {
|
||||
executeCommandCalls.push({
|
||||
commandId: commandId,
|
||||
args: args
|
||||
});
|
||||
return TPromise.as(void 0);
|
||||
return Promise.resolve(void 0);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -143,7 +140,7 @@ suite('AbstractKeybindingService', () => {
|
||||
showMessageCalls.push({ sev: Severity.Error, message });
|
||||
return new NoOpNotification();
|
||||
},
|
||||
prompt(severity: Severity, message: string, choices: IPromptChoice[], onCancel?: () => void) {
|
||||
prompt(severity: Severity, message: string, choices: IPromptChoice[], options?: IPromptOptions) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
};
|
||||
@@ -176,7 +173,7 @@ suite('AbstractKeybindingService', () => {
|
||||
statusMessageCallsDisposed = null;
|
||||
});
|
||||
|
||||
function kbItem(keybinding: number, command: string, when: ContextKeyExpr = null): ResolvedKeybindingItem {
|
||||
function kbItem(keybinding: number, command: string, when: ContextKeyExpr | null = null): ResolvedKeybindingItem {
|
||||
const resolvedKeybinding = (keybinding !== 0 ? new USLayoutResolvedKeybinding(createKeybinding(keybinding, OS), OS) : null);
|
||||
return new ResolvedKeybindingItem(
|
||||
resolvedKeybinding,
|
||||
|
||||
@@ -2,12 +2,10 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { KeyCode, KeyMod, KeyChord, createKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { KeyChord, KeyCode, KeyMod, createKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { OperatingSystem } from 'vs/base/common/platform';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
|
||||
suite('KeybindingLabels', () => {
|
||||
|
||||
|
||||
@@ -2,15 +2,13 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { KeyCode, KeyMod, KeyChord, createKeybinding, KeybindingType, SimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { KeyChord, KeyCode, KeyMod, KeybindingType, SimpleKeybinding, createKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import { ContextKeyAndExpr, ContextKeyExpr, IContext } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
|
||||
function createContext(ctx: any) {
|
||||
return {
|
||||
@@ -192,7 +190,7 @@ suite('KeybindingResolver', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test('contextIsEntirelyIncluded', function () {
|
||||
test('contextIsEntirelyIncluded', () => {
|
||||
let assertIsIncluded = (a: ContextKeyExpr[], b: ContextKeyExpr[]) => {
|
||||
let tmpA = new ContextKeyAndExpr(a).normalize();
|
||||
let tmpB = new ContextKeyAndExpr(b).normalize();
|
||||
|
||||
@@ -2,27 +2,26 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import { ResolvedKeybinding, Keybinding, SimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IKeybindingService, IKeybindingEvent, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IContextKey, IContextKeyService, IContextKeyServiceTarget, ContextKeyExpr, IContextKeyChangeEvent } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IResolveResult } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { Keybinding, ResolvedKeybinding, SimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import { ContextKeyExpr, IContextKey, IContextKeyChangeEvent, IContextKeyService, IContextKeyServiceTarget } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IKeybindingEvent, IKeybindingService, IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IResolveResult } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
|
||||
class MockKeybindingContextKey<T> implements IContextKey<T> {
|
||||
private _defaultValue: T;
|
||||
private _value: T;
|
||||
private _defaultValue: T | undefined;
|
||||
private _value: T | undefined;
|
||||
|
||||
constructor(defaultValue: T) {
|
||||
constructor(defaultValue: T | undefined) {
|
||||
this._defaultValue = defaultValue;
|
||||
this._value = this._defaultValue;
|
||||
}
|
||||
|
||||
public set(value: T): void {
|
||||
public set(value: T | undefined): void {
|
||||
this._value = value;
|
||||
}
|
||||
|
||||
@@ -30,7 +29,7 @@ class MockKeybindingContextKey<T> implements IContextKey<T> {
|
||||
this._value = this._defaultValue;
|
||||
}
|
||||
|
||||
public get(): T {
|
||||
public get(): T | undefined {
|
||||
return this._value;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +42,7 @@ export class MockContextKeyService implements IContextKeyService {
|
||||
public dispose(): void {
|
||||
//
|
||||
}
|
||||
public createKey<T>(key: string, defaultValue: T): IContextKey<T> {
|
||||
public createKey<T>(key: string, defaultValue: T | undefined): IContextKey<T> {
|
||||
let ret = new MockKeybindingContextKey(defaultValue);
|
||||
this._keys.set(key, ret);
|
||||
return ret;
|
||||
@@ -75,7 +74,7 @@ export class MockKeybindingService implements IKeybindingService {
|
||||
}
|
||||
|
||||
public getDefaultKeybindingsContent(): string {
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
public getDefaultKeybindings(): ResolvedKeybindingItem[] {
|
||||
@@ -109,7 +108,7 @@ export class MockKeybindingService implements IKeybindingService {
|
||||
return [];
|
||||
}
|
||||
|
||||
public lookupKeybinding(commandId: string): ResolvedKeybinding {
|
||||
public lookupKeybinding(commandId: string): ResolvedKeybinding | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -117,11 +116,15 @@ export class MockKeybindingService implements IKeybindingService {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public softDispatch(keybinding: IKeyboardEvent, target: IContextKeyServiceTarget): IResolveResult {
|
||||
public softDispatch(keybinding: IKeyboardEvent, target: IContextKeyServiceTarget): IResolveResult | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
dispatchEvent(e: IKeyboardEvent, target: IContextKeyServiceTarget): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
mightProducePrintableCharacter(e: IKeyboardEvent): boolean {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user