mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 02:32:35 -05:00
Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c (#8525)
* Merge from vscode a5cf1da01d5db3d2557132be8d30f89c38019f6c * remove files we don't want * fix hygiene * update distro * update distro * fix hygiene * fix strict nulls * distro * distro * fix tests * fix tests * add another edit * fix viewlet icon * fix azure dialog * fix some padding * fix more padding issues
This commit is contained in:
@@ -11,7 +11,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
import { Keybinding, ResolvedKeybinding, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
|
||||
import { KeybindingParser } from 'vs/base/common/keybindingParser';
|
||||
import { OS, OperatingSystem, isWeb } from 'vs/base/common/platform';
|
||||
import { OS, OperatingSystem } from 'vs/base/common/platform';
|
||||
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';
|
||||
@@ -19,7 +19,7 @@ import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/commo
|
||||
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 { IKeyboardEvent, IUserFriendlyKeybinding, KeybindingSource, IKeybindingService, IKeybindingEvent } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IKeyboardEvent, IUserFriendlyKeybinding, KeybindingSource, IKeybindingService, IKeybindingEvent, KeybindingsSchemaContribution } 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';
|
||||
@@ -43,8 +43,10 @@ import * as objects from 'vs/base/common/objects';
|
||||
import { IKeymapService } from 'vs/workbench/services/keybinding/common/keymapInfo';
|
||||
import { getDispatchConfig } from 'vs/workbench/services/keybinding/common/dispatchConfig';
|
||||
import { isArray } from 'vs/base/common/types';
|
||||
import { INavigatorWithKeyboard } from 'vs/workbench/services/keybinding/browser/navigatorKeyboard';
|
||||
import { INavigatorWithKeyboard, IKeyboard } from 'vs/workbench/services/keybinding/browser/navigatorKeyboard';
|
||||
import { ScanCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE } from 'vs/base/common/scanCode';
|
||||
import { flatten } from 'vs/base/common/arrays';
|
||||
import { BrowserFeatures, KeyboardSupport } from 'vs/base/browser/canIUse';
|
||||
|
||||
interface ContributedKeyBinding {
|
||||
command: string;
|
||||
@@ -146,6 +148,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
private _keyboardMapper: IKeyboardMapper;
|
||||
private _cachedResolver: KeybindingResolver | null;
|
||||
private userKeybindings: UserKeybindings;
|
||||
private readonly _contributions: KeybindingsSchemaContribution[] = [];
|
||||
|
||||
constructor(
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@@ -161,7 +164,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
) {
|
||||
super(contextKeyService, commandService, telemetryService, notificationService);
|
||||
|
||||
updateSchema();
|
||||
this.updateSchema();
|
||||
|
||||
let dispatchConfig = getDispatchConfig(configurationService);
|
||||
configurationService.onDidChangeConfiguration((e) => {
|
||||
@@ -190,13 +193,6 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
}
|
||||
});
|
||||
this._register(this.userKeybindings.onDidChange(() => {
|
||||
type CustomKeybindingsChangedClassification = {
|
||||
keyCount: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true }
|
||||
};
|
||||
|
||||
this._telemetryService.publicLog2<{ keyCount: number }, CustomKeybindingsChangedClassification>('customKeybindingsChanged', {
|
||||
keyCount: this.userKeybindings.keybindings.length
|
||||
});
|
||||
this.updateResolver({
|
||||
source: KeybindingSource.User,
|
||||
keybindings: this.userKeybindings.keybindings
|
||||
@@ -214,8 +210,8 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
this.updateResolver({ source: KeybindingSource.Default });
|
||||
});
|
||||
|
||||
updateSchema();
|
||||
this._register(extensionService.onDidRegisterExtensions(() => updateSchema()));
|
||||
this.updateSchema();
|
||||
this._register(extensionService.onDidRegisterExtensions(() => this.updateSchema()));
|
||||
|
||||
this._register(dom.addDisposableListener(window, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||
let keyEvent = new StandardKeyboardEvent(e);
|
||||
@@ -226,6 +222,28 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
}));
|
||||
|
||||
let data = this.keymapService.getCurrentKeyboardLayout();
|
||||
/* __GDPR__FRAGMENT__
|
||||
"IKeyboardLayoutInfo" : {
|
||||
"name" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"id": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"text": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
/* __GDPR__FRAGMENT__
|
||||
"IKeyboardLayoutInfo" : {
|
||||
"model" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"layout": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"variant": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"options": { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"rules": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
/* __GDPR__FRAGMENT__
|
||||
"IKeyboardLayoutInfo" : {
|
||||
"id" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" },
|
||||
"lang": { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
|
||||
}
|
||||
*/
|
||||
/* __GDPR__
|
||||
"keyboardLayout" : {
|
||||
"currentKeyboardLayout": { "${inline}": [ "${IKeyboardLayoutInfo}" ] }
|
||||
@@ -236,16 +254,16 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
});
|
||||
|
||||
this._register(browser.onDidChangeFullscreen(() => {
|
||||
const keyboard = (<INavigatorWithKeyboard>navigator).keyboard;
|
||||
const keyboard: IKeyboard | null = (<INavigatorWithKeyboard>navigator).keyboard;
|
||||
|
||||
if (!keyboard) {
|
||||
if (BrowserFeatures.keyboard === KeyboardSupport.None) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (browser.isFullscreen()) {
|
||||
keyboard.lock(['Escape']);
|
||||
keyboard?.lock(['Escape']);
|
||||
} else {
|
||||
keyboard.unlock();
|
||||
keyboard?.unlock();
|
||||
}
|
||||
|
||||
// update resolver which will bring back all unbound keyboard shortcuts
|
||||
@@ -254,6 +272,18 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
}));
|
||||
}
|
||||
|
||||
public registerSchemaContribution(contribution: KeybindingsSchemaContribution): void {
|
||||
this._contributions.push(contribution);
|
||||
if (contribution.onDidChange) {
|
||||
this._register(contribution.onDidChange(() => this.updateSchema()));
|
||||
}
|
||||
this.updateSchema();
|
||||
}
|
||||
|
||||
private updateSchema() {
|
||||
updateSchema(flatten(this._contributions.map(x => x.getSchemaAdditions())));
|
||||
}
|
||||
|
||||
public _dumpDebugInfo(): string {
|
||||
const layoutInfo = JSON.stringify(this.keymapService.getCurrentKeyboardLayout(), null, '\t');
|
||||
const mapperInfo = this._keyboardMapper.dumpDebugInfo();
|
||||
@@ -337,15 +367,11 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
}
|
||||
|
||||
private _assertBrowserConflicts(kb: Keybinding, commandId: string): boolean {
|
||||
if (!isWeb) {
|
||||
if (BrowserFeatures.keyboard === KeyboardSupport.Always) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (browser.isStandalone) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (browser.isFullscreen() && (<any>navigator).keyboard) {
|
||||
if (BrowserFeatures.keyboard === KeyboardSupport.FullScreen && browser.isFullscreen()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -503,7 +529,7 @@ export class WorkbenchKeybindingService extends AbstractKeybindingService {
|
||||
);
|
||||
}
|
||||
|
||||
private static _getDefaultKeybindings(defaultKeybindings: ResolvedKeybindingItem[]): string {
|
||||
private static _getDefaultKeybindings(defaultKeybindings: readonly ResolvedKeybindingItem[]): string {
|
||||
let out = new OutputBuilder();
|
||||
out.writeLine('[');
|
||||
|
||||
@@ -653,7 +679,7 @@ let schema: IJSONSchema = {
|
||||
let schemaRegistry = Registry.as<IJSONContributionRegistry>(Extensions.JSONContribution);
|
||||
schemaRegistry.registerSchema(schemaId, schema);
|
||||
|
||||
function updateSchema() {
|
||||
function updateSchema(additionalContributions: readonly IJSONSchema[]) {
|
||||
commandsSchemas.length = 0;
|
||||
commandsEnum.length = 0;
|
||||
commandsEnumDescriptions.length = 0;
|
||||
@@ -707,6 +733,9 @@ function updateSchema() {
|
||||
for (const commandId of menuCommands.keys()) {
|
||||
addKnownCommand(commandId);
|
||||
}
|
||||
|
||||
commandsSchemas.push(...additionalContributions);
|
||||
schemaRegistry.notifySchemaChanged(schemaId);
|
||||
}
|
||||
|
||||
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigExtensions.Configuration);
|
||||
|
||||
@@ -19,7 +19,7 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { parse } from 'vs/base/common/json';
|
||||
import { parse, getNodeType } from 'vs/base/common/json';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -335,6 +335,10 @@ export class BrowserKeyboardMapperFactoryBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (standardKeyboardEvent.browserEvent.key === 'Dead' || standardKeyboardEvent.browserEvent.isComposing) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const mapping = currentKeymap.mapping[standardKeyboardEvent.code];
|
||||
|
||||
if (!mapping) {
|
||||
@@ -482,9 +486,13 @@ class UserKeyboardLayout extends Disposable {
|
||||
try {
|
||||
const content = await this.fileService.readFile(this.keyboardLayoutResource);
|
||||
const value = parse(content.value.toString());
|
||||
const layoutInfo = value.layout;
|
||||
const mappings = value.rawMapping;
|
||||
this._keyboardLayout = KeymapInfo.createKeyboardLayoutFromDebugInfo(layoutInfo, mappings, true);
|
||||
if (getNodeType(value) === 'object') {
|
||||
const layoutInfo = value.layout;
|
||||
const mappings = value.rawMapping;
|
||||
this._keyboardLayout = KeymapInfo.createKeyboardLayoutFromDebugInfo(layoutInfo, mappings, true);
|
||||
} else {
|
||||
this._keyboardLayout = null;
|
||||
}
|
||||
} catch (e) {
|
||||
this._keyboardLayout = null;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ export class KeybindingsEditingService extends Disposable implements IKeybinding
|
||||
|
||||
private parse(model: ITextModel): { result: IUserFriendlyKeybinding[], parseErrors: json.ParseError[] } {
|
||||
const parseErrors: json.ParseError[] = [];
|
||||
const result = json.parse(model.getValue(), parseErrors);
|
||||
const result = json.parse(model.getValue(), parseErrors, { allowTrailingComma: true, allowEmptyContent: true });
|
||||
return { result, parseErrors };
|
||||
}
|
||||
|
||||
|
||||
@@ -38,19 +38,20 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor
|
||||
import { KeybindingsEditingService } from 'vs/workbench/services/keybinding/common/keybindingEditing';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { TextModelResolverService } from 'vs/workbench/services/textmodelResolver/common/textModelResolverService';
|
||||
import { IUntitledEditorService, UntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { TestBackupFileService, TestContextService, TestEditorGroupsService, TestEditorService, TestLifecycleService, TestTextFileService, TestTextResourcePropertiesService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IUntitledTextEditorService, UntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { TestBackupFileService, TestContextService, TestEditorGroupsService, TestEditorService, TestLifecycleService, TestTextFileService, TestTextResourcePropertiesService, TestWorkingCopyService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { WorkbenchEnvironmentService } from 'vs/workbench/services/environment/node/environmentService';
|
||||
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
|
||||
class TestEnvironmentService extends WorkbenchEnvironmentService {
|
||||
class TestEnvironmentService extends NativeWorkbenchEnvironmentService {
|
||||
|
||||
constructor(private _appSettingsHome: URI) {
|
||||
super(parseArgs(process.argv, OPTIONS) as IWindowConfiguration, process.execPath, 0);
|
||||
@@ -67,7 +68,7 @@ interface Modifiers {
|
||||
shiftKey?: boolean;
|
||||
}
|
||||
|
||||
suite('KeybindingsEditing', () => {
|
||||
suite.skip('KeybindingsEditing', () => {
|
||||
|
||||
let instantiationService: TestInstantiationService;
|
||||
let testObject: KeybindingsEditingService;
|
||||
@@ -93,6 +94,7 @@ suite('KeybindingsEditing', () => {
|
||||
instantiationService.stub(IContextKeyService, <IContextKeyService>instantiationService.createInstance(MockContextKeyService));
|
||||
instantiationService.stub(IEditorGroupsService, new TestEditorGroupsService());
|
||||
instantiationService.stub(IEditorService, new TestEditorService());
|
||||
instantiationService.stub(IWorkingCopyService, new TestWorkingCopyService());
|
||||
instantiationService.stub(ITelemetryService, NullTelemetryService);
|
||||
instantiationService.stub(IModeService, ModeServiceImpl);
|
||||
instantiationService.stub(ILogService, new NullLogService());
|
||||
@@ -103,7 +105,7 @@ suite('KeybindingsEditing', () => {
|
||||
fileService.registerProvider(Schemas.file, diskFileSystemProvider);
|
||||
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(environmentService.appSettingsHome, environmentService.backupHome, diskFileSystemProvider, environmentService));
|
||||
instantiationService.stub(IFileService, fileService);
|
||||
instantiationService.stub(IUntitledEditorService, instantiationService.createInstance(UntitledEditorService));
|
||||
instantiationService.stub(IUntitledTextEditorService, instantiationService.createInstance(UntitledTextEditorService));
|
||||
instantiationService.stub(ITextFileService, instantiationService.createInstance(TestTextFileService));
|
||||
instantiationService.stub(ITextModelService, <ITextModelService>instantiationService.createInstance(TextModelResolverService));
|
||||
instantiationService.stub(IBackupFileService, new TestBackupFileService());
|
||||
|
||||
Reference in New Issue
Block a user