mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46: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:
@@ -83,8 +83,7 @@ export interface IConfigurationService {
|
||||
updateValue(key: string, value: any, target: ConfigurationTarget): Promise<void>;
|
||||
updateValue(key: string, value: any, overrides: IConfigurationOverrides, target: ConfigurationTarget, donotNotifyError?: boolean): Promise<void>;
|
||||
|
||||
reloadConfiguration(): Promise<void>;
|
||||
reloadConfiguration(folder: IWorkspaceFolder): Promise<void>;
|
||||
reloadConfiguration(folder?: IWorkspaceFolder): Promise<void>;
|
||||
|
||||
inspect<T>(key: string, overrides?: IConfigurationOverrides): {
|
||||
default: T,
|
||||
@@ -280,3 +279,16 @@ export function overrideIdentifierFromKey(key: string): string {
|
||||
export function keyFromOverrideIdentifier(overrideIdentifier: string): string {
|
||||
return `[${overrideIdentifier}]`;
|
||||
}
|
||||
|
||||
export function getMigratedSettingValue<T>(configurationService: IConfigurationService, currentSettingName: string, legacySettingName: string): T {
|
||||
const setting = configurationService.inspect<T>(currentSettingName);
|
||||
const legacySetting = configurationService.inspect<T>(legacySettingName);
|
||||
|
||||
if (typeof setting.user !== 'undefined' || typeof setting.workspace !== 'undefined' || typeof setting.workspaceFolder !== 'undefined') {
|
||||
return setting.value;
|
||||
} else if (typeof legacySetting.user !== 'undefined' || typeof legacySetting.workspace !== 'undefined' || typeof legacySetting.workspaceFolder !== 'undefined') {
|
||||
return legacySetting.value;
|
||||
} else {
|
||||
return setting.default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ export class Configuration {
|
||||
private _freeze: boolean = true) {
|
||||
}
|
||||
|
||||
getValue(section: string | undefined, overrides: IConfigurationOverrides, workspace: Workspace | null): any {
|
||||
getValue(section: string | undefined, overrides: IConfigurationOverrides, workspace: Workspace | undefined): any {
|
||||
const consolidateConfigurationModel = this.getConsolidateConfigurationModel(overrides, workspace);
|
||||
return consolidateConfigurationModel.getValue(section);
|
||||
}
|
||||
@@ -320,7 +320,7 @@ export class Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
inspect<C>(key: string, overrides: IConfigurationOverrides, workspace: Workspace | null): {
|
||||
inspect<C>(key: string, overrides: IConfigurationOverrides, workspace: Workspace | undefined): {
|
||||
default: C,
|
||||
user: C,
|
||||
workspace?: C,
|
||||
@@ -336,12 +336,12 @@ export class Configuration {
|
||||
user: overrides.overrideIdentifier ? this._userConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._userConfiguration.freeze().getValue(key),
|
||||
workspace: workspace ? overrides.overrideIdentifier ? this._workspaceConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._workspaceConfiguration.freeze().getValue(key) : undefined, //Check on workspace exists or not because _workspaceConfiguration is never null
|
||||
workspaceFolder: folderConfigurationModel ? overrides.overrideIdentifier ? folderConfigurationModel.freeze().override(overrides.overrideIdentifier).getValue(key) : folderConfigurationModel.freeze().getValue(key) : undefined,
|
||||
memory: overrides.overrideIdentifier ? memoryConfigurationModel.freeze().override(overrides.overrideIdentifier).getValue(key) : memoryConfigurationModel.freeze().getValue(key),
|
||||
memory: overrides.overrideIdentifier ? memoryConfigurationModel.override(overrides.overrideIdentifier).getValue(key) : memoryConfigurationModel.getValue(key),
|
||||
value: consolidateConfigurationModel.getValue(key)
|
||||
};
|
||||
}
|
||||
|
||||
keys(workspace: Workspace | null): {
|
||||
keys(workspace: Workspace | undefined): {
|
||||
default: string[];
|
||||
user: string[];
|
||||
workspace: string[];
|
||||
@@ -400,12 +400,12 @@ export class Configuration {
|
||||
return this._folderConfigurations;
|
||||
}
|
||||
|
||||
private getConsolidateConfigurationModel(overrides: IConfigurationOverrides, workspace: Workspace | null): ConfigurationModel {
|
||||
private getConsolidateConfigurationModel(overrides: IConfigurationOverrides, workspace: Workspace | undefined): ConfigurationModel {
|
||||
let configurationModel = this.getConsolidatedConfigurationModelForResource(overrides, workspace);
|
||||
return overrides.overrideIdentifier ? configurationModel.override(overrides.overrideIdentifier) : configurationModel;
|
||||
}
|
||||
|
||||
private getConsolidatedConfigurationModelForResource({ resource }: IConfigurationOverrides, workspace: Workspace | null): ConfigurationModel {
|
||||
private getConsolidatedConfigurationModelForResource({ resource }: IConfigurationOverrides, workspace: Workspace | undefined): ConfigurationModel {
|
||||
let consolidateConfiguration = this.getWorkspaceConsolidatedConfiguration();
|
||||
|
||||
if (workspace && resource) {
|
||||
@@ -450,7 +450,7 @@ export class Configuration {
|
||||
return folderConsolidatedConfiguration;
|
||||
}
|
||||
|
||||
private getFolderConfigurationModelForResource(resource: URI | null | undefined, workspace: Workspace | null): ConfigurationModel | null {
|
||||
private getFolderConfigurationModelForResource(resource: URI | null | undefined, workspace: Workspace | undefined): ConfigurationModel | null {
|
||||
if (workspace && resource) {
|
||||
const root = workspace.getFolder(resource);
|
||||
if (root) {
|
||||
@@ -486,7 +486,7 @@ export class Configuration {
|
||||
};
|
||||
}
|
||||
|
||||
allKeys(workspace: Workspace): string[] {
|
||||
allKeys(workspace: Workspace | undefined): string[] {
|
||||
let keys = this.keys(workspace);
|
||||
let all = [...keys.default];
|
||||
const addKeys = (keys) => {
|
||||
|
||||
@@ -55,7 +55,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
getValue(arg1?: any, arg2?: any): any {
|
||||
const section = typeof arg1 === 'string' ? arg1 : undefined;
|
||||
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
|
||||
return this.configuration.getValue(section, overrides, null);
|
||||
return this.configuration.getValue(section, overrides, undefined);
|
||||
}
|
||||
|
||||
updateValue(key: string, value: any): Promise<void>;
|
||||
@@ -73,7 +73,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
workspaceFolder?: T
|
||||
value: T
|
||||
} {
|
||||
return this.configuration.inspect<T>(key, {}, null);
|
||||
return this.configuration.inspect<T>(key, {}, undefined);
|
||||
}
|
||||
|
||||
keys(): {
|
||||
@@ -82,7 +82,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
workspace: string[];
|
||||
workspaceFolder: string[];
|
||||
} {
|
||||
return this.configuration.keys(null);
|
||||
return this.configuration.keys(undefined);
|
||||
}
|
||||
|
||||
reloadConfiguration(folder?: IWorkspaceFolder): Promise<void> {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent, ConfigurationModelParser } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { ConfigurationModel, DefaultConfigurationModel, ConfigurationChangeEvent, ConfigurationModelParser, Configuration } from 'vs/platform/configuration/common/configurationModels';
|
||||
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -466,4 +466,30 @@ suite('ConfigurationChangeEvent', () => {
|
||||
assert.ok(actual.affectsConfiguration('[markdown]', URI.file('file2')));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('Configuration', () => {
|
||||
|
||||
test('Test update value', () => {
|
||||
const parser = new ConfigurationModelParser('test');
|
||||
parser.parse(JSON.stringify({ 'a': 1 }));
|
||||
const testObject: Configuration = new Configuration(parser.configurationModel, new ConfigurationModel());
|
||||
|
||||
testObject.updateValue('a', 2);
|
||||
|
||||
assert.equal(testObject.getValue('a', {}, undefined), 2);
|
||||
});
|
||||
|
||||
test('Test update value after inspect', () => {
|
||||
const parser = new ConfigurationModelParser('test');
|
||||
parser.parse(JSON.stringify({ 'a': 1 }));
|
||||
const testObject: Configuration = new Configuration(parser.configurationModel, new ConfigurationModel());
|
||||
|
||||
testObject.inspect('a', {}, undefined);
|
||||
testObject.updateValue('a', 2);
|
||||
|
||||
assert.equal(testObject.getValue('a', {}, undefined), 2);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as fs from 'fs';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
|
||||
Reference in New Issue
Block a user