mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
first cut of WorkspaceConfiguration#update function, #1396
This commit is contained in:
@@ -10,6 +10,7 @@ import Event, {Emitter} from 'vs/base/common/event';
|
||||
import {WorkspaceConfiguration} from 'vscode';
|
||||
import {ExtHostConfigurationShape, MainContext, MainThreadConfigurationShape} from './extHost.protocol';
|
||||
import {IThreadService} from 'vs/workbench/services/thread/common/threadService';
|
||||
import {ConfigurationTarget, ConfigurationEditingResult} from 'vs/workbench/services/configuration/common/configurationEditing';
|
||||
|
||||
export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
|
||||
@@ -53,6 +54,14 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
result = defaultValue;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
update: (key: string, value: any, global: boolean) => {
|
||||
const target = global ? ConfigurationTarget.USER : ConfigurationTarget.WORKSPACE;
|
||||
return this._proxy.$updateConfigurationOption(target, key, value).then(value => {
|
||||
if (value !== ConfigurationEditingResult.OK) {
|
||||
throw new Error(ConfigurationEditingResult[value]);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user