mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -24,7 +24,7 @@ export function isConfigurationOverrides(thing: any): thing is IConfigurationOve
|
||||
|
||||
export interface IConfigurationOverrides {
|
||||
overrideIdentifier?: string | null;
|
||||
resource?: URI;
|
||||
resource?: URI | null;
|
||||
}
|
||||
|
||||
export const enum ConfigurationTarget {
|
||||
@@ -227,11 +227,11 @@ function doRemoveFromValueTree(valueTree: any, segments: string[]): void {
|
||||
export function getConfigurationValue<T>(config: any, settingPath: string, defaultValue?: T): T {
|
||||
function accessSetting(config: any, path: string[]): any {
|
||||
let current = config;
|
||||
for (let i = 0; i < path.length; i++) {
|
||||
for (const component of path) {
|
||||
if (typeof current !== 'object' || current === null) {
|
||||
return undefined;
|
||||
}
|
||||
current = current[path[i]];
|
||||
current = current[component];
|
||||
}
|
||||
return <T>current;
|
||||
}
|
||||
|
||||
@@ -204,10 +204,12 @@ export class ConfigurationModelParser {
|
||||
return this._parseErrors;
|
||||
}
|
||||
|
||||
public parse(content: string): void {
|
||||
const raw = this.parseContent(content);
|
||||
const configurationModel = this.parseRaw(raw);
|
||||
this._configurationModel = new ConfigurationModel(configurationModel.contents, configurationModel.keys, configurationModel.overrides);
|
||||
public parse(content: string | null | undefined): void {
|
||||
if (content) {
|
||||
const raw = this.parseContent(content);
|
||||
const configurationModel = this.parseRaw(raw);
|
||||
this._configurationModel = new ConfigurationModel(configurationModel.contents, configurationModel.keys, configurationModel.overrides);
|
||||
}
|
||||
}
|
||||
|
||||
protected parseContent(content: string): any {
|
||||
@@ -296,7 +298,7 @@ export class Configuration {
|
||||
}
|
||||
|
||||
updateValue(key: string, value: any, overrides: IConfigurationOverrides = {}): void {
|
||||
let memoryConfiguration: ConfigurationModel;
|
||||
let memoryConfiguration: ConfigurationModel | undefined;
|
||||
if (overrides.resource) {
|
||||
memoryConfiguration = this._memoryConfigurationByResource.get(overrides.resource);
|
||||
if (!memoryConfiguration) {
|
||||
@@ -307,7 +309,7 @@ export class Configuration {
|
||||
memoryConfiguration = this._memoryConfiguration;
|
||||
}
|
||||
|
||||
if (value === void 0) {
|
||||
if (value === undefined) {
|
||||
memoryConfiguration.removeValue(key);
|
||||
} else {
|
||||
memoryConfiguration.setValue(key, value);
|
||||
@@ -332,8 +334,8 @@ export class Configuration {
|
||||
return {
|
||||
default: overrides.overrideIdentifier ? this._defaultConfiguration.freeze().override(overrides.overrideIdentifier).getValue(key) : this._defaultConfiguration.freeze().getValue(key),
|
||||
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) : void 0, //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) : void 0,
|
||||
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),
|
||||
value: consolidateConfigurationModel.getValue(key)
|
||||
};
|
||||
@@ -448,11 +450,11 @@ export class Configuration {
|
||||
return folderConsolidatedConfiguration;
|
||||
}
|
||||
|
||||
private getFolderConfigurationModelForResource(resource: URI | undefined, workspace: Workspace | null): ConfigurationModel | null {
|
||||
private getFolderConfigurationModelForResource(resource: URI | null | undefined, workspace: Workspace | null): ConfigurationModel | null {
|
||||
if (workspace && resource) {
|
||||
const root = workspace.getFolder(resource);
|
||||
if (root) {
|
||||
return this._folderConfigurations.get(root.uri);
|
||||
return this._folderConfigurations.get(root.uri) || null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -476,7 +478,7 @@ export class Configuration {
|
||||
keys: this._workspaceConfiguration.keys
|
||||
},
|
||||
folders: this._folderConfigurations.keys().reduce((result, folder) => {
|
||||
const { contents, overrides, keys } = this._folderConfigurations.get(folder);
|
||||
const { contents, overrides, keys } = this._folderConfigurations.get(folder)!;
|
||||
result[folder.toString()] = { contents, overrides, keys };
|
||||
return result;
|
||||
}, Object.create({})),
|
||||
@@ -497,7 +499,7 @@ export class Configuration {
|
||||
addKeys(keys.user);
|
||||
addKeys(keys.workspace);
|
||||
for (const resource of this.folders.keys()) {
|
||||
addKeys(this.folders.get(resource).keys);
|
||||
addKeys(this.folders.get(resource)!.keys);
|
||||
}
|
||||
return all;
|
||||
}
|
||||
@@ -553,7 +555,7 @@ export class ConfigurationChangeEvent extends AbstractConfigurationChangeEvent i
|
||||
this._changedConfiguration = this._changedConfiguration.merge(arg1._changedConfiguration);
|
||||
for (const resource of arg1._changedConfigurationByResource.keys()) {
|
||||
let changedConfigurationByResource = this.getOrSetChangedConfigurationForResource(resource);
|
||||
changedConfigurationByResource = changedConfigurationByResource.merge(arg1._changedConfigurationByResource.get(resource));
|
||||
changedConfigurationByResource = changedConfigurationByResource.merge(arg1._changedConfigurationByResource.get(resource)!);
|
||||
this._changedConfigurationByResource.set(resource, changedConfigurationByResource);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
export const Extensions = {
|
||||
Configuration: 'base.contributions.configuration'
|
||||
@@ -25,13 +26,28 @@ export interface IConfigurationRegistry {
|
||||
/**
|
||||
* Register multiple configurations to the registry.
|
||||
*/
|
||||
registerConfigurations(configurations: IConfigurationNode[], defaultConfigurations: IDefaultConfigurationExtension[], validate?: boolean): void;
|
||||
registerConfigurations(configurations: IConfigurationNode[], validate?: boolean): void;
|
||||
|
||||
/**
|
||||
* Deregister multiple configurations from the registry.
|
||||
*/
|
||||
deregisterConfigurations(configurations: IConfigurationNode[]): void;
|
||||
|
||||
/**
|
||||
* Register multiple default configurations to the registry.
|
||||
*/
|
||||
registerDefaultConfigurations(defaultConfigurations: IDefaultConfigurationExtension[]): void;
|
||||
|
||||
/**
|
||||
* Deregister multiple default configurations from the registry.
|
||||
*/
|
||||
deregisterDefaultConfigurations(defaultConfigurations: IDefaultConfigurationExtension[]): void;
|
||||
|
||||
/**
|
||||
* Signal that the schema of a configuration setting has changes. It is currently only supported to change enumeration values.
|
||||
* Property or default value changes are not allowed.
|
||||
*/
|
||||
notifyConfigurationSchemaUpdated(configuration: IConfigurationNode): void;
|
||||
notifyConfigurationSchemaUpdated(...configurations: IConfigurationNode[]): void;
|
||||
|
||||
/**
|
||||
* Event that fires whenver a configuration has been
|
||||
@@ -43,7 +59,7 @@ export interface IConfigurationRegistry {
|
||||
* Event that fires whenver a configuration has been
|
||||
* registered.
|
||||
*/
|
||||
onDidRegisterConfiguration: Event<string[]>;
|
||||
onDidUpdateConfiguration: Event<string[]>;
|
||||
|
||||
/**
|
||||
* Returns all configuration nodes contributed to this registry.
|
||||
@@ -93,7 +109,7 @@ export interface IConfigurationNode {
|
||||
}
|
||||
|
||||
export interface IDefaultConfigurationExtension {
|
||||
id: string;
|
||||
id: ExtensionIdentifier;
|
||||
name: string;
|
||||
defaults: { [key: string]: {} };
|
||||
}
|
||||
@@ -108,21 +124,27 @@ const contributionRegistry = Registry.as<IJSONContributionRegistry>(JSONExtensio
|
||||
|
||||
class ConfigurationRegistry implements IConfigurationRegistry {
|
||||
|
||||
private configurationContributors: IConfigurationNode[];
|
||||
private configurationProperties: { [qualifiedKey: string]: IJSONSchema };
|
||||
private excludedConfigurationProperties: { [qualifiedKey: string]: IJSONSchema };
|
||||
private editorConfigurationSchema: IJSONSchema;
|
||||
private overrideIdentifiers: string[] = [];
|
||||
private readonly defaultOverridesConfigurationNode: IConfigurationNode;
|
||||
private readonly configurationContributors: IConfigurationNode[];
|
||||
private readonly configurationProperties: { [qualifiedKey: string]: IJSONSchema };
|
||||
private readonly excludedConfigurationProperties: { [qualifiedKey: string]: IJSONSchema };
|
||||
private readonly editorConfigurationSchema: IJSONSchema;
|
||||
private readonly overrideIdentifiers: string[] = [];
|
||||
private overridePropertyPattern: string;
|
||||
|
||||
private readonly _onDidSchemaChange: Emitter<void> = new Emitter<void>();
|
||||
private readonly _onDidSchemaChange = new Emitter<void>();
|
||||
readonly onDidSchemaChange: Event<void> = this._onDidSchemaChange.event;
|
||||
|
||||
private readonly _onDidRegisterConfiguration: Emitter<string[]> = new Emitter<string[]>();
|
||||
readonly onDidRegisterConfiguration: Event<string[]> = this._onDidRegisterConfiguration.event;
|
||||
private readonly _onDidUpdateConfiguration: Emitter<string[]> = new Emitter<string[]>();
|
||||
readonly onDidUpdateConfiguration: Event<string[]> = this._onDidUpdateConfiguration.event;
|
||||
|
||||
constructor() {
|
||||
this.configurationContributors = [];
|
||||
this.defaultOverridesConfigurationNode = {
|
||||
id: 'defaultOverrides',
|
||||
title: nls.localize('defaultConfigurations.title', "Default Configuration Overrides"),
|
||||
properties: {}
|
||||
};
|
||||
this.configurationContributors = [this.defaultOverridesConfigurationNode];
|
||||
this.editorConfigurationSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting' };
|
||||
this.configurationProperties = {};
|
||||
this.excludedConfigurationProperties = {};
|
||||
@@ -132,15 +154,10 @@ class ConfigurationRegistry implements IConfigurationRegistry {
|
||||
}
|
||||
|
||||
public registerConfiguration(configuration: IConfigurationNode, validate: boolean = true): void {
|
||||
this.registerConfigurations([configuration], [], validate);
|
||||
this.registerConfigurations([configuration], validate);
|
||||
}
|
||||
|
||||
public registerConfigurations(configurations: IConfigurationNode[], defaultConfigurations: IDefaultConfigurationExtension[], validate: boolean = true): void {
|
||||
const configurationNode = this.toConfiguration(defaultConfigurations);
|
||||
if (configurationNode) {
|
||||
configurations.push(configurationNode);
|
||||
}
|
||||
|
||||
public registerConfigurations(configurations: IConfigurationNode[], validate: boolean = true): void {
|
||||
const properties: string[] = [];
|
||||
configurations.forEach(configuration => {
|
||||
properties.push(...this.validateAndRegisterProperties(configuration, validate)); // fills in defaults
|
||||
@@ -149,38 +166,98 @@ class ConfigurationRegistry implements IConfigurationRegistry {
|
||||
this.updateSchemaForOverrideSettingsConfiguration(configuration);
|
||||
});
|
||||
|
||||
this._onDidRegisterConfiguration.fire(properties);
|
||||
this._onDidSchemaChange.fire();
|
||||
this._onDidUpdateConfiguration.fire(properties);
|
||||
}
|
||||
|
||||
public notifyConfigurationSchemaUpdated(configuration: IConfigurationNode) {
|
||||
contributionRegistry.notifySchemaChanged(editorConfigurationSchemaId);
|
||||
}
|
||||
public deregisterConfigurations(configurations: IConfigurationNode[]): void {
|
||||
const properties: string[] = [];
|
||||
const deregisterConfiguration = (configuration: IConfigurationNode) => {
|
||||
if (configuration.properties) {
|
||||
for (const key in configuration.properties) {
|
||||
properties.push(key);
|
||||
|
||||
public registerOverrideIdentifiers(overrideIdentifiers: string[]): void {
|
||||
this.overrideIdentifiers.push(...overrideIdentifiers);
|
||||
this.updateOverridePropertyPatternKey();
|
||||
}
|
||||
delete this.configurationProperties[key];
|
||||
delete this.editorConfigurationSchema.properties![key];
|
||||
|
||||
private toConfiguration(defaultConfigurations: IDefaultConfigurationExtension[]): IConfigurationNode | null {
|
||||
const configurationNode: IConfigurationNode = {
|
||||
id: 'defaultOverrides',
|
||||
title: nls.localize('defaultConfigurations.title', "Default Configuration Overrides"),
|
||||
properties: {}
|
||||
// Delete from schema
|
||||
delete allSettings.properties[key];
|
||||
switch (configuration.properties[key].scope) {
|
||||
case ConfigurationScope.APPLICATION:
|
||||
delete applicationSettings.properties[key];
|
||||
break;
|
||||
case ConfigurationScope.WINDOW:
|
||||
delete windowSettings.properties[key];
|
||||
break;
|
||||
case ConfigurationScope.RESOURCE:
|
||||
delete resourceSettings.properties[key];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (configuration.allOf) {
|
||||
configuration.allOf.forEach(node => deregisterConfiguration(node));
|
||||
}
|
||||
};
|
||||
for (const configuration of configurations) {
|
||||
deregisterConfiguration(configuration);
|
||||
const index = this.configurationContributors.indexOf(configuration);
|
||||
if (index !== -1) {
|
||||
this.configurationContributors.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
contributionRegistry.registerSchema(editorConfigurationSchemaId, this.editorConfigurationSchema);
|
||||
this._onDidSchemaChange.fire();
|
||||
this._onDidUpdateConfiguration.fire(properties);
|
||||
}
|
||||
|
||||
public registerDefaultConfigurations(defaultConfigurations: IDefaultConfigurationExtension[]): void {
|
||||
const properties: string[] = [];
|
||||
|
||||
for (const defaultConfiguration of defaultConfigurations) {
|
||||
for (const key in defaultConfiguration.defaults) {
|
||||
const defaultValue = defaultConfiguration.defaults[key];
|
||||
if (OVERRIDE_PROPERTY_PATTERN.test(key) && typeof defaultValue === 'object') {
|
||||
configurationNode.properties![key] = {
|
||||
const propertySchema: IConfigurationPropertySchema = {
|
||||
type: 'object',
|
||||
default: defaultValue,
|
||||
description: nls.localize('overrideSettings.description', "Configure editor settings to be overridden for {0} language.", key),
|
||||
$ref: editorConfigurationSchemaId
|
||||
};
|
||||
allSettings.properties[key] = propertySchema;
|
||||
this.defaultOverridesConfigurationNode.properties![key] = propertySchema;
|
||||
this.configurationProperties[key] = propertySchema;
|
||||
properties.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Object.keys(configurationNode.properties!).length ? configurationNode : null;
|
||||
|
||||
this._onDidSchemaChange.fire();
|
||||
this._onDidUpdateConfiguration.fire(properties);
|
||||
}
|
||||
|
||||
public deregisterDefaultConfigurations(defaultConfigurations: IDefaultConfigurationExtension[]): void {
|
||||
const properties: string[] = [];
|
||||
for (const defaultConfiguration of defaultConfigurations) {
|
||||
for (const key in defaultConfiguration.defaults) {
|
||||
properties.push(key);
|
||||
delete allSettings.properties[key];
|
||||
delete this.defaultOverridesConfigurationNode.properties![key];
|
||||
delete this.configurationProperties[key];
|
||||
}
|
||||
}
|
||||
this._onDidSchemaChange.fire();
|
||||
this._onDidUpdateConfiguration.fire(properties);
|
||||
}
|
||||
|
||||
public notifyConfigurationSchemaUpdated(...configurations: IConfigurationNode[]) {
|
||||
this._onDidSchemaChange.fire();
|
||||
}
|
||||
|
||||
public registerOverrideIdentifiers(overrideIdentifiers: string[]): void {
|
||||
this.overrideIdentifiers.push(...overrideIdentifiers);
|
||||
this.updateOverridePropertyPatternKey();
|
||||
}
|
||||
|
||||
private validateAndRegisterProperties(configuration: IConfigurationNode, validate: boolean = true, scope: ConfigurationScope = ConfigurationScope.WINDOW, overridable: boolean = false): string[] {
|
||||
@@ -208,7 +285,7 @@ class ConfigurationRegistry implements IConfigurationRegistry {
|
||||
}
|
||||
|
||||
if (OVERRIDE_PROPERTY_PATTERN.test(key)) {
|
||||
property.scope = void 0; // No scope for overridable properties `[${identifier}]`
|
||||
property.scope = undefined; // No scope for overridable properties `[${identifier}]`
|
||||
} else {
|
||||
property.scope = types.isUndefinedOrNull(property.scope) ? scope : property.scope;
|
||||
}
|
||||
@@ -272,7 +349,6 @@ class ConfigurationRegistry implements IConfigurationRegistry {
|
||||
}
|
||||
}
|
||||
register(configuration);
|
||||
this._onDidSchemaChange.fire();
|
||||
}
|
||||
|
||||
private updateSchemaForOverrideSettingsConfiguration(configuration: IConfigurationNode): void {
|
||||
@@ -360,7 +436,7 @@ export function validateProperty(property: string): string | null {
|
||||
if (OVERRIDE_PROPERTY_PATTERN.test(property)) {
|
||||
return nls.localize('config.property.languageDefault', "Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.", property);
|
||||
}
|
||||
if (configurationRegistry.getConfigurationProperties()[property] !== void 0) {
|
||||
if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {
|
||||
return nls.localize('config.property.duplicate', "Cannot register '{0}'. This property is already registered.", property);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -30,7 +30,7 @@ export class UserConfiguration extends Disposable {
|
||||
userConfigModelParser.parse(content);
|
||||
parseErrors = [...userConfigModelParser.errors];
|
||||
return userConfigModelParser;
|
||||
}, initCallback: () => c(void 0)
|
||||
}, initCallback: () => c(undefined)
|
||||
});
|
||||
this._register(this.userConfigModelWatcher);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
|
||||
// Listeners
|
||||
this._register(this.userConfiguration.onDidChangeConfiguration(userConfigurationModel => this.onDidChangeUserConfiguration(userConfigurationModel)));
|
||||
this._register(Registry.as<IConfigurationRegistry>(Extensions.Configuration).onDidRegisterConfiguration(configurationProperties => this.onDidRegisterConfiguration(configurationProperties)));
|
||||
this._register(Registry.as<IConfigurationRegistry>(Extensions.Configuration).onDidUpdateConfiguration(configurationProperties => this.onDidDefaultConfigurationChange(configurationProperties)));
|
||||
}
|
||||
|
||||
get configuration(): Configuration {
|
||||
@@ -53,7 +53,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
getValue<T>(overrides: IConfigurationOverrides): T;
|
||||
getValue<T>(section: string, overrides: IConfigurationOverrides): T;
|
||||
getValue(arg1?: any, arg2?: any): any {
|
||||
const section = typeof arg1 === 'string' ? arg1 : void 0;
|
||||
const section = typeof arg1 === 'string' ? arg1 : undefined;
|
||||
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
|
||||
return this.configuration.getValue(section, overrides, null);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
}
|
||||
|
||||
reloadConfiguration(folder?: IWorkspaceFolder): Promise<void> {
|
||||
return folder ? Promise.resolve(null) :
|
||||
return folder ? Promise.resolve(undefined) :
|
||||
this.userConfiguration.reload().then(userConfigurationModel => this.onDidChangeUserConfiguration(userConfigurationModel));
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ export class ConfigurationService extends Disposable implements IConfigurationSe
|
||||
}
|
||||
}
|
||||
|
||||
private onDidRegisterConfiguration(keys: string[]): void {
|
||||
private onDidDefaultConfigurationChange(keys: string[]): void {
|
||||
this._configuration.updateDefaultConfiguration(new DefaultConfigurationModel());
|
||||
this.trigger(keys, ConfigurationTarget.DEFAULT);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ suite('Configuration', () => {
|
||||
});
|
||||
|
||||
test('removeFromValueTree: remove a single segemented key when its value is undefined', () => {
|
||||
let target = { 'a': void 0 };
|
||||
let target = { 'a': undefined };
|
||||
|
||||
removeFromValueTree(target, 'a');
|
||||
|
||||
|
||||
@@ -331,12 +331,12 @@ suite('CustomConfigurationModel', () => {
|
||||
assert.deepEqual(testObject.configurationModel.contents, {});
|
||||
assert.deepEqual(testObject.configurationModel.keys, []);
|
||||
|
||||
testObject.parse(null);
|
||||
testObject.parse(null!);
|
||||
|
||||
assert.deepEqual(testObject.configurationModel.contents, {});
|
||||
assert.deepEqual(testObject.configurationModel.keys, []);
|
||||
|
||||
testObject.parse(undefined);
|
||||
testObject.parse(undefined!);
|
||||
|
||||
assert.deepEqual(testObject.configurationModel.contents, {});
|
||||
assert.deepEqual(testObject.configurationModel.keys, []);
|
||||
|
||||
@@ -20,7 +20,7 @@ export class TestConfigurationService implements IConfigurationService {
|
||||
|
||||
public getValue(arg1?: any, arg2?: any): any {
|
||||
let configuration;
|
||||
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : void 0;
|
||||
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : undefined;
|
||||
if (overrides) {
|
||||
if (overrides.resource) {
|
||||
configuration = this.configurationByRoot.findSubstr(overrides.resource.fsPath);
|
||||
@@ -34,10 +34,10 @@ export class TestConfigurationService implements IConfigurationService {
|
||||
}
|
||||
|
||||
public updateValue(key: string, overrides?: IConfigurationOverrides): Promise<void> {
|
||||
return Promise.resolve(void 0);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
public setUserConfiguration(key: any, value: any, root?: URI): Thenable<void> {
|
||||
public setUserConfiguration(key: any, value: any, root?: URI): Promise<void> {
|
||||
if (root) {
|
||||
const configForRoot = this.configurationByRoot.get(root.fsPath) || Object.create(null);
|
||||
configForRoot[key] = value;
|
||||
@@ -46,7 +46,7 @@ export class TestConfigurationService implements IConfigurationService {
|
||||
this.configuration[key] = value;
|
||||
}
|
||||
|
||||
return Promise.resolve(void 0);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
public onDidChangeConfiguration() {
|
||||
|
||||
@@ -207,14 +207,14 @@ suite('ConfigurationService - Node', () => {
|
||||
const r = await testFile('config', 'config.json');
|
||||
const service = new ConfigurationService(new SettingsTestEnvironmentService(parseArgs(process.argv), process.execPath, r.testFile));
|
||||
let res = service.inspect('something.missing');
|
||||
assert.strictEqual(res.value, void 0);
|
||||
assert.strictEqual(res.default, void 0);
|
||||
assert.strictEqual(res.user, void 0);
|
||||
assert.strictEqual(res.value, undefined);
|
||||
assert.strictEqual(res.default, undefined);
|
||||
assert.strictEqual(res.user, undefined);
|
||||
|
||||
res = service.inspect('lookup.service.testSetting');
|
||||
assert.strictEqual(res.default, 'isSet');
|
||||
assert.strictEqual(res.value, 'isSet');
|
||||
assert.strictEqual(res.user, void 0);
|
||||
assert.strictEqual(res.user, undefined);
|
||||
|
||||
fs.writeFileSync(r.testFile, '{ "lookup.service.testSetting": "bar" }');
|
||||
|
||||
@@ -245,7 +245,7 @@ suite('ConfigurationService - Node', () => {
|
||||
let res = service.inspect('lookup.service.testNullSetting');
|
||||
assert.strictEqual(res.default, null);
|
||||
assert.strictEqual(res.value, null);
|
||||
assert.strictEqual(res.user, void 0);
|
||||
assert.strictEqual(res.user, undefined);
|
||||
|
||||
fs.writeFileSync(r.testFile, '{ "lookup.service.testNullSetting": null }');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user