mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 18:48:33 -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:
@@ -15,14 +15,14 @@ import { Keybinding, ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingParser } from 'vs/base/common/keybindingParser';
|
||||
import { OS, OperatingSystem } from 'vs/base/common/platform';
|
||||
import { ConfigWatcher } from 'vs/base/node/config';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
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 { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { Extensions, IJSONContributionRegistry } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { AbstractKeybindingService } from 'vs/platform/keybinding/common/abstractKeybindingService';
|
||||
import { IKeybindingEvent, IKeyboardEvent, IUserFriendlyKeybinding, KeybindingSource } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IKeybindingEvent, IKeyboardEvent, IUserFriendlyKeybinding, KeybindingSource, IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { KeybindingResolver } from 'vs/platform/keybinding/common/keybindingResolver';
|
||||
import { IKeybindingItem, IKeybindingRule2, KeybindingWeight, KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem';
|
||||
@@ -38,6 +38,9 @@ import { MacLinuxFallbackKeyboardMapper } from 'vs/workbench/services/keybinding
|
||||
import { IMacLinuxKeyboardMapping, MacLinuxKeyboardMapper, macLinuxKeyboardMappingEquals } from 'vs/workbench/services/keybinding/common/macLinuxKeyboardMapper';
|
||||
import { IWindowsKeyboardMapping, WindowsKeyboardMapper, windowsKeyboardMappingEquals } from 'vs/workbench/services/keybinding/common/windowsKeyboardMapper';
|
||||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
||||
export class KeyboardMapperFactory {
|
||||
public static readonly INSTANCE = new KeyboardMapperFactory();
|
||||
@@ -235,7 +238,6 @@ let keybindingType: IJSONSchema = {
|
||||
};
|
||||
|
||||
const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint<ContributedKeyBinding | ContributedKeyBinding[]>({
|
||||
isDynamic: true,
|
||||
extensionPoint: 'keybindings',
|
||||
jsonSchema: {
|
||||
description: nls.localize('vscode.extension.contributes.keybindings', "Contributes keybindings."),
|
||||
@@ -268,7 +270,6 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
private userKeybindings: ConfigWatcher<IUserFriendlyKeybinding[]>;
|
||||
|
||||
constructor(
|
||||
windowElement: Window,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@ICommandService commandService: ICommandService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@@ -276,10 +277,13 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@IStatusbarService statusBarService: IStatusbarService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IWindowService private readonly windowService: IWindowService
|
||||
@IWindowService private readonly windowService: IWindowService,
|
||||
@IExtensionService extensionService: IExtensionService
|
||||
) {
|
||||
super(contextKeyService, commandService, telemetryService, notificationService, statusBarService);
|
||||
|
||||
updateSchema();
|
||||
|
||||
let dispatchConfig = getDispatchConfig(configurationService);
|
||||
configurationService.onDidChangeConfiguration((e) => {
|
||||
let newDispatchConfig = getDispatchConfig(configurationService);
|
||||
@@ -314,12 +318,15 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
this.updateResolver({ source: KeybindingSource.Default });
|
||||
});
|
||||
|
||||
updateSchema();
|
||||
this._register(extensionService.onDidRegisterExtensions(() => updateSchema()));
|
||||
|
||||
this._register(this.userKeybindings.onDidUpdateConfiguration(event => this.updateResolver({
|
||||
source: KeybindingSource.User,
|
||||
keybindings: event.config
|
||||
})));
|
||||
|
||||
this._register(dom.addDisposableListener(windowElement, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
this._register(dom.addDisposableListener(window, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
let keyEvent = new StandardKeyboardEvent(e);
|
||||
let shouldPreventDefault = this._dispatch(keyEvent, keyEvent.target);
|
||||
if (shouldPreventDefault) {
|
||||
@@ -339,7 +346,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
});
|
||||
}
|
||||
|
||||
public dumpDebugInfo(): string {
|
||||
public _dumpDebugInfo(): string {
|
||||
const layoutInfo = JSON.stringify(KeyboardMapperFactory.INSTANCE.getCurrentKeyboardLayout(), null, '\t');
|
||||
const mapperInfo = this._keyboardMapper.dumpDebugInfo();
|
||||
const rawMapping = JSON.stringify(KeyboardMapperFactory.INSTANCE.getRawKeyboardMapping(), null, '\t');
|
||||
@@ -405,13 +412,12 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
let result: ResolvedKeybindingItem[] = [], resultLen = 0;
|
||||
for (const item of items) {
|
||||
const when = (item.when ? item.when.normalize() : null);
|
||||
const firstPart = item.firstPart;
|
||||
const chordPart = item.chordPart;
|
||||
if (!firstPart) {
|
||||
const parts = item.parts;
|
||||
if (parts.length === 0) {
|
||||
// This might be a removal keybinding item in user settings => accept it
|
||||
result[resultLen++] = new ResolvedKeybindingItem(null, item.command, item.commandArgs, when, isDefault);
|
||||
} else {
|
||||
const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(firstPart, chordPart);
|
||||
const resolvedKeybindings = this._keyboardMapper.resolveUserBinding(parts);
|
||||
for (const resolvedKeybinding of resolvedKeybindings) {
|
||||
result[resultLen++] = new ResolvedKeybindingItem(resolvedKeybinding, item.command, item.commandArgs, when, isDefault);
|
||||
}
|
||||
@@ -436,7 +442,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
});
|
||||
}
|
||||
|
||||
return extraUserKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k, OS));
|
||||
return extraUserKeybindings.map((k) => KeybindingIO.readUserKeybindingItem(k));
|
||||
}
|
||||
|
||||
public resolveKeybinding(kb: Keybinding): ResolvedKeybinding[] {
|
||||
@@ -448,8 +454,8 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
}
|
||||
|
||||
public resolveUserBinding(userBinding: string): ResolvedKeybinding[] {
|
||||
const [firstPart, chordPart] = KeybindingParser.parseUserBinding(userBinding);
|
||||
return this._keyboardMapper.resolveUserBinding(firstPart, chordPart);
|
||||
const parts = KeybindingParser.parseUserBinding(userBinding);
|
||||
return this._keyboardMapper.resolveUserBinding(parts);
|
||||
}
|
||||
|
||||
private _handleKeybindingsExtensionPointUser(isBuiltin: boolean, keybindings: ContributedKeyBinding | ContributedKeyBinding[], collector: ExtensionMessageCollector, result: IKeybindingRule2[]): void {
|
||||
@@ -529,7 +535,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
|
||||
let lastIndex = defaultKeybindings.length - 1;
|
||||
defaultKeybindings.forEach((k, index) => {
|
||||
KeybindingIO.writeKeybindingItem(out, k, OS);
|
||||
KeybindingIO.writeKeybindingItem(out, k);
|
||||
if (index !== lastIndex) {
|
||||
out.writeLine(',');
|
||||
} else {
|
||||
@@ -569,10 +575,31 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
}
|
||||
|
||||
let schemaId = 'vscode://schemas/keybindings';
|
||||
let commandsSchemas: IJSONSchema[] = [];
|
||||
let commandsEnum: string[] = [];
|
||||
let commandsEnumDescriptions: (string | null | undefined)[] = [];
|
||||
let schema: IJSONSchema = {
|
||||
'id': schemaId,
|
||||
'type': 'array',
|
||||
'title': nls.localize('keybindings.json.title', "Keybindings configuration"),
|
||||
'definitions': {
|
||||
'editorGroupsSchema': {
|
||||
'type': 'array',
|
||||
'items': {
|
||||
'type': 'object',
|
||||
'properties': {
|
||||
'groups': {
|
||||
'$ref': '#/definitions/editorGroupsSchema',
|
||||
'default': [{}, {}]
|
||||
},
|
||||
'size': {
|
||||
'type': 'number',
|
||||
'default': 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
'items': {
|
||||
'required': ['key'],
|
||||
'type': 'object',
|
||||
@@ -584,6 +611,8 @@ let schema: IJSONSchema = {
|
||||
},
|
||||
'command': {
|
||||
'type': 'string',
|
||||
'enum': commandsEnum,
|
||||
'enumDescriptions': <any>commandsEnumDescriptions,
|
||||
'description': nls.localize('keybindings.json.command', "Name of the command to execute"),
|
||||
},
|
||||
'when': {
|
||||
@@ -593,13 +622,71 @@ let schema: IJSONSchema = {
|
||||
'args': {
|
||||
'description': nls.localize('keybindings.json.args', "Arguments to pass to the command to execute.")
|
||||
}
|
||||
}
|
||||
},
|
||||
'allOf': commandsSchemas
|
||||
}
|
||||
};
|
||||
|
||||
let schemaRegistry = Registry.as<IJSONContributionRegistry>(Extensions.JSONContribution);
|
||||
schemaRegistry.registerSchema(schemaId, schema);
|
||||
|
||||
function updateSchema() {
|
||||
commandsSchemas.length = 0;
|
||||
commandsEnum.length = 0;
|
||||
commandsEnumDescriptions.length = 0;
|
||||
|
||||
const knownCommands = new Set<string>();
|
||||
const addKnownCommand = (commandId: string, description?: string | null) => {
|
||||
if (!/^_/.test(commandId)) {
|
||||
if (!knownCommands.has(commandId)) {
|
||||
knownCommands.add(commandId);
|
||||
|
||||
commandsEnum.push(commandId);
|
||||
commandsEnumDescriptions.push(description);
|
||||
|
||||
// Also add the negative form for keybinding removal
|
||||
commandsEnum.push(`-${commandId}`);
|
||||
commandsEnumDescriptions.push(description);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const allCommands = CommandsRegistry.getCommands();
|
||||
for (let commandId in allCommands) {
|
||||
const commandDescription = allCommands[commandId].description;
|
||||
|
||||
addKnownCommand(commandId, commandDescription && commandDescription.description);
|
||||
|
||||
if (!commandDescription || !commandDescription.args || commandDescription.args.length !== 1 || !commandDescription.args[0].schema) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const argsSchema = commandDescription.args[0].schema;
|
||||
const argsRequired = Array.isArray(argsSchema.required) && argsSchema.required.length > 0;
|
||||
const addition = {
|
||||
'if': {
|
||||
'properties': {
|
||||
'command': { 'const': commandId }
|
||||
}
|
||||
},
|
||||
'then': {
|
||||
'required': (<string[]>[]).concat(argsRequired ? ['args'] : []),
|
||||
'properties': {
|
||||
'args': argsSchema
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
commandsSchemas.push(addition);
|
||||
}
|
||||
|
||||
const menuCommands = MenuRegistry.getCommands();
|
||||
for (let commandId in menuCommands) {
|
||||
addKnownCommand(commandId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration);
|
||||
const keyboardConfiguration: IConfigurationNode = {
|
||||
'id': 'keyboard',
|
||||
@@ -625,3 +712,5 @@ const keyboardConfiguration: IConfigurationNode = {
|
||||
};
|
||||
|
||||
configurationRegistry.registerConfiguration(keyboardConfiguration);
|
||||
|
||||
registerSingleton(IKeybindingService, WorkbenchKeybindingService);
|
||||
Reference in New Issue
Block a user