mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 18:48:33 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -74,6 +74,9 @@ export class NativeResolvedKeybinding extends ResolvedKeybinding {
|
||||
|
||||
constructor(mapper: MacLinuxKeyboardMapper, OS: OperatingSystem, firstPart: ScanCodeBinding, chordPart: ScanCodeBinding) {
|
||||
super();
|
||||
if (!firstPart) {
|
||||
throw new Error(`Invalid USLayoutResolvedKeybinding`);
|
||||
}
|
||||
this._mapper = mapper;
|
||||
this._OS = OS;
|
||||
this._firstPart = firstPart;
|
||||
|
||||
@@ -86,6 +86,9 @@ export class WindowsNativeResolvedKeybinding extends ResolvedKeybinding {
|
||||
|
||||
constructor(mapper: WindowsKeyboardMapper, firstPart: SimpleKeybinding, chordPart: SimpleKeybinding) {
|
||||
super();
|
||||
if (!firstPart) {
|
||||
throw new Error(`Invalid WindowsNativeResolvedKeybinding firstPart`);
|
||||
}
|
||||
this._mapper = mapper;
|
||||
this._firstPart = firstPart;
|
||||
this._chordPart = chordPart;
|
||||
|
||||
@@ -31,7 +31,7 @@ import { IKeyboardMapper, CachedKeyboardMapper } from 'vs/workbench/services/key
|
||||
import { WindowsKeyboardMapper, IWindowsKeyboardMapping, windowsKeyboardMappingEquals } from 'vs/workbench/services/keybinding/common/windowsKeyboardMapper';
|
||||
import { IMacLinuxKeyboardMapping, MacLinuxKeyboardMapper, macLinuxKeyboardMappingEquals } from 'vs/workbench/services/keybinding/common/macLinuxKeyboardMapper';
|
||||
import { MacLinuxFallbackKeyboardMapper } from 'vs/workbench/services/keybinding/common/macLinuxFallbackKeyboardMapper';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Extensions as ConfigExtensions, IConfigurationRegistry, IConfigurationNode } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
@@ -46,8 +46,8 @@ export class KeyboardMapperFactory {
|
||||
private _keyboardMapper: IKeyboardMapper;
|
||||
private _initialized: boolean;
|
||||
|
||||
private _onDidChangeKeyboardMapper: Emitter<void> = new Emitter<void>();
|
||||
public onDidChangeKeyboardMapper: Event<void> = this._onDidChangeKeyboardMapper.event;
|
||||
private readonly _onDidChangeKeyboardMapper: Emitter<void> = new Emitter<void>();
|
||||
public readonly onDidChangeKeyboardMapper: Event<void> = this._onDidChangeKeyboardMapper.event;
|
||||
|
||||
private constructor() {
|
||||
this._layoutInfo = null;
|
||||
@@ -415,7 +415,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
|
||||
/* __GDPR__
|
||||
"customKeybindingsChanged" : {
|
||||
"keyCount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
"keyCount" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "isMeasurement": true }
|
||||
}
|
||||
*/
|
||||
this._telemetryService.publicLog('customKeybindingsChanged', {
|
||||
@@ -567,10 +567,10 @@ let schema: IJSONSchema = {
|
||||
}
|
||||
};
|
||||
|
||||
let schemaRegistry = <IJSONContributionRegistry>Registry.as(Extensions.JSONContribution);
|
||||
let schemaRegistry = Registry.as<IJSONContributionRegistry>(Extensions.JSONContribution);
|
||||
schemaRegistry.registerSchema(schemaId, schema);
|
||||
|
||||
const configurationRegistry = <IConfigurationRegistry>Registry.as(ConfigExtensions.Configuration);
|
||||
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration);
|
||||
const keyboardConfiguration: IConfigurationNode = {
|
||||
'id': 'keyboard',
|
||||
'order': 15,
|
||||
|
||||
@@ -5,22 +5,23 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import assert = require('assert');
|
||||
import os = require('os');
|
||||
import path = require('path');
|
||||
import fs = require('fs');
|
||||
import * as assert from 'assert';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs';
|
||||
import * as json from 'vs/base/common/json';
|
||||
import { OS } from 'vs/base/common/platform';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { KeyCode, SimpleKeybinding, ChordKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import extfs = require('vs/base/node/extfs');
|
||||
import { TestTextFileService, TestEditorGroupService, TestLifecycleService, TestBackupFileService, TestContextService, TestTextResourceConfigurationService, TestHashService, TestEnvironmentService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import { TestTextFileService, TestEditorGroupService, TestLifecycleService, TestBackupFileService, TestContextService, TestTextResourceConfigurationService, TestHashService, TestEnvironmentService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { IWorkspaceContextService, Workspace, toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
|
||||
import uuid = require('vs/base/common/uuid');
|
||||
import * as uuid from 'vs/base/common/uuid';
|
||||
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
|
||||
import { FileService } from 'vs/workbench/services/files/node/fileService';
|
||||
import { FileService } from 'vs/workbench/services/files/electron-browser/fileService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
@@ -80,7 +81,16 @@ suite('Keybindings Editing', () => {
|
||||
instantiationService.stub(ITelemetryService, NullTelemetryService);
|
||||
instantiationService.stub(IModeService, ModeServiceImpl);
|
||||
instantiationService.stub(IModelService, instantiationService.createInstance(ModelServiceImpl));
|
||||
instantiationService.stub(IFileService, new FileService(new TestContextService(new Workspace(testDir, testDir, toWorkspaceFolders([{ path: testDir }]))), TestEnvironmentService, new TestTextResourceConfigurationService(), new TestConfigurationService(), lifecycleService, { disableWatcher: true }));
|
||||
instantiationService.stub(IFileService, new FileService(
|
||||
new TestContextService(new Workspace(testDir, testDir, toWorkspaceFolders([{ path: testDir }]))),
|
||||
TestEnvironmentService,
|
||||
new TestTextResourceConfigurationService(),
|
||||
new TestConfigurationService(),
|
||||
lifecycleService,
|
||||
new TestStorageService(),
|
||||
new TestNotificationService(),
|
||||
{ disableWatcher: true })
|
||||
);
|
||||
instantiationService.stub(IUntitledEditorService, instantiationService.createInstance(UntitledEditorService));
|
||||
instantiationService.stub(ITextFileService, instantiationService.createInstance(TestTextFileService));
|
||||
instantiationService.stub(ITextModelService, <ITextModelService>instantiationService.createInstance(TextModelResolverService));
|
||||
@@ -109,28 +119,28 @@ suite('Keybindings Editing', () => {
|
||||
fs.writeFileSync(keybindingsFile, ',,,,,,,,,,,,,,');
|
||||
return testObject.editKeybinding('alt+c', aResolvedKeybindingItem({ firstPart: { keyCode: KeyCode.Escape } }))
|
||||
.then(() => assert.fail('Should fail with parse errors'),
|
||||
error => assert.equal(error.message, 'Unable to write to the keybindings configuration file. Please open it to correct errors/warnings in the file and try again.'));
|
||||
error => assert.equal(error.message, 'Unable to write to the keybindings configuration file. Please open it to correct errors/warnings in the file and try again.'));
|
||||
});
|
||||
|
||||
test('errors cases - parse errors 2', () => {
|
||||
fs.writeFileSync(keybindingsFile, '[{"key": }]');
|
||||
return testObject.editKeybinding('alt+c', aResolvedKeybindingItem({ firstPart: { keyCode: KeyCode.Escape } }))
|
||||
.then(() => assert.fail('Should fail with parse errors'),
|
||||
error => assert.equal(error.message, 'Unable to write to the keybindings configuration file. Please open it to correct errors/warnings in the file and try again.'));
|
||||
error => assert.equal(error.message, 'Unable to write to the keybindings configuration file. Please open it to correct errors/warnings in the file and try again.'));
|
||||
});
|
||||
|
||||
test('errors cases - dirty', () => {
|
||||
instantiationService.stub(ITextFileService, 'isDirty', true);
|
||||
return testObject.editKeybinding('alt+c', aResolvedKeybindingItem({ firstPart: { keyCode: KeyCode.Escape } }))
|
||||
.then(() => assert.fail('Should fail with dirty error'),
|
||||
error => assert.equal(error.message, 'Unable to write because the keybindings configuration file is dirty. Please save it first and then try again.'));
|
||||
error => assert.equal(error.message, 'Unable to write because the keybindings configuration file is dirty. Please save it first and then try again.'));
|
||||
});
|
||||
|
||||
test('errors cases - did not find an array', () => {
|
||||
fs.writeFileSync(keybindingsFile, '{"key": "alt+c", "command": "hello"}');
|
||||
return testObject.editKeybinding('alt+c', aResolvedKeybindingItem({ firstPart: { keyCode: KeyCode.Escape } }))
|
||||
.then(() => assert.fail('Should fail with dirty error'),
|
||||
error => assert.equal(error.message, 'Unable to write to the keybindings configuration file. It has an object which is not of type Array. Please open the file to clean up and try again.'));
|
||||
error => assert.equal(error.message, 'Unable to write to the keybindings configuration file. It has an object which is not of type Array. Please open the file to clean up and try again.'));
|
||||
});
|
||||
|
||||
test('edit a default keybinding to an empty file', () => {
|
||||
@@ -62,20 +62,16 @@ export function readRawMapping<T>(file: string): TPromise<T> {
|
||||
});
|
||||
}
|
||||
|
||||
export function assertMapping(writeFileIfDifferent: boolean, mapper: IKeyboardMapper, file: string, done: (err?: any) => void): void {
|
||||
export function assertMapping(writeFileIfDifferent: boolean, mapper: IKeyboardMapper, file: string): TPromise<void> {
|
||||
const filePath = require.toUrl(`vs/workbench/services/keybinding/test/${file}`);
|
||||
|
||||
readFile(filePath).then((buff) => {
|
||||
return readFile(filePath).then((buff) => {
|
||||
let expected = buff.toString();
|
||||
const actual = mapper.dumpDebugInfo();
|
||||
if (actual !== expected && writeFileIfDifferent) {
|
||||
writeFile(filePath, actual);
|
||||
}
|
||||
try {
|
||||
assert.deepEqual(actual.split(/\r\n|\n/), expected.split(/\r\n|\n/));
|
||||
} catch (err) {
|
||||
return done(err);
|
||||
}
|
||||
done();
|
||||
}, done);
|
||||
|
||||
assert.deepEqual(actual.split(/\r\n|\n/), expected.split(/\r\n|\n/));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,15 +27,14 @@ suite('keyboardMapper - MAC de_ch', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'mac_de_ch', OperatingSystem.Macintosh).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'mac_de_ch', OperatingSystem.Macintosh).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'mac_de_ch.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'mac_de_ch.txt');
|
||||
});
|
||||
|
||||
function assertKeybindingTranslation(kb: number, expected: string | string[]): void {
|
||||
@@ -378,15 +377,14 @@ suite('keyboardMapper - MAC en_us', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(true, 'mac_en_us', OperatingSystem.Macintosh).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(true, 'mac_en_us', OperatingSystem.Macintosh).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'mac_en_us.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'mac_en_us.txt');
|
||||
});
|
||||
|
||||
test('resolveUserBinding Cmd+[Comma] Cmd+/', () => {
|
||||
@@ -457,15 +455,14 @@ suite('keyboardMapper - LINUX de_ch', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'linux_de_ch', OperatingSystem.Linux).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'linux_de_ch', OperatingSystem.Linux).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_de_ch.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_de_ch.txt');
|
||||
});
|
||||
|
||||
function assertKeybindingTranslation(kb: number, expected: string | string[]): void {
|
||||
@@ -808,15 +805,14 @@ suite('keyboardMapper - LINUX en_us', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(true, 'linux_en_us', OperatingSystem.Linux).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(true, 'linux_en_us', OperatingSystem.Linux).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_en_us.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_en_us.txt');
|
||||
});
|
||||
|
||||
function _assertResolveKeybinding(k: number, expected: IResolvedKeybinding[]): void {
|
||||
@@ -1328,15 +1324,14 @@ suite('keyboardMapper - LINUX ru', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'linux_ru', OperatingSystem.Linux).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'linux_ru', OperatingSystem.Linux).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_ru.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_ru.txt');
|
||||
});
|
||||
|
||||
function _assertResolveKeybinding(k: number, expected: IResolvedKeybinding[]): void {
|
||||
@@ -1363,15 +1358,14 @@ suite('keyboardMapper - LINUX en_uk', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'linux_en_uk', OperatingSystem.Linux).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'linux_en_uk', OperatingSystem.Linux).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_en_uk.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'linux_en_uk.txt');
|
||||
});
|
||||
|
||||
test('issue #24522: resolveKeyboardEvent Ctrl+Alt+[Minus]', () => {
|
||||
@@ -1402,15 +1396,14 @@ suite('keyboardMapper - MAC zh_hant', () => {
|
||||
|
||||
let mapper: MacLinuxKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'mac_zh_hant', OperatingSystem.Macintosh).then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'mac_zh_hant', OperatingSystem.Macintosh).then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'mac_zh_hant.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'mac_zh_hant.txt');
|
||||
});
|
||||
|
||||
function _assertResolveKeybinding(k: number, expected: IResolvedKeybinding[]): void {
|
||||
|
||||
@@ -28,15 +28,14 @@ suite('keyboardMapper - WINDOWS de_ch', () => {
|
||||
|
||||
let mapper: WindowsKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'win_de_ch').then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'win_de_ch').then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_de_ch.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_de_ch.txt');
|
||||
});
|
||||
|
||||
test('resolveKeybinding Ctrl+A', () => {
|
||||
@@ -321,15 +320,14 @@ suite('keyboardMapper - WINDOWS en_us', () => {
|
||||
|
||||
let mapper: WindowsKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(true, 'win_en_us').then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(true, 'win_en_us').then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_en_us.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_en_us.txt');
|
||||
});
|
||||
|
||||
test('resolveKeybinding Ctrl+K Ctrl+\\', () => {
|
||||
@@ -410,15 +408,14 @@ suite('keyboardMapper - WINDOWS por_ptb', () => {
|
||||
|
||||
let mapper: WindowsKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'win_por_ptb').then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'win_por_ptb').then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_por_ptb.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_por_ptb.txt');
|
||||
});
|
||||
|
||||
test('resolveKeyboardEvent Ctrl+[IntlRo]', () => {
|
||||
@@ -472,15 +469,14 @@ suite('keyboardMapper - WINDOWS ru', () => {
|
||||
|
||||
let mapper: WindowsKeyboardMapper;
|
||||
|
||||
suiteSetup((done) => {
|
||||
createKeyboardMapper(false, 'win_ru').then((_mapper) => {
|
||||
suiteSetup(() => {
|
||||
return createKeyboardMapper(false, 'win_ru').then((_mapper) => {
|
||||
mapper = _mapper;
|
||||
done();
|
||||
}, done);
|
||||
});
|
||||
});
|
||||
|
||||
test('mapping', (done) => {
|
||||
assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_ru.txt', done);
|
||||
test('mapping', () => {
|
||||
return assertMapping(WRITE_FILE_IF_DIFFERENT, mapper, 'win_ru.txt');
|
||||
});
|
||||
|
||||
test('issue ##24361: resolveKeybinding Ctrl+K Ctrl+K', () => {
|
||||
|
||||
Reference in New Issue
Block a user