mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Merge remote-tracking branch 'origin/master' into colourpicker
This commit is contained in:
@@ -449,12 +449,9 @@ export function createApiFactory(
|
||||
onDidChangeConfiguration: (listener: (_: any) => any, thisArgs?: any, disposables?: extHostTypes.Disposable[]) => {
|
||||
return extHostConfiguration.onDidChangeConfiguration(listener, thisArgs, disposables);
|
||||
},
|
||||
getConfiguration: (section?: string): vscode.WorkspaceConfiguration => {
|
||||
return extHostConfiguration.getConfiguration(section);
|
||||
getConfiguration: (section?: string, resource?: vscode.Uri): vscode.WorkspaceConfiguration => {
|
||||
return extHostConfiguration.getConfiguration(section, <URI>resource);
|
||||
},
|
||||
getConfiguration2: proposedApiFunction(extension, (section?: string, resource?: vscode.Uri): vscode.WorkspaceConfiguration => {
|
||||
return extHostConfiguration.getConfiguration2(section, <URI>resource);
|
||||
}),
|
||||
registerTaskProvider: (type: string, provider: vscode.TaskProvider) => {
|
||||
return extHostTask.registerTaskProvider(extension, provider);
|
||||
},
|
||||
@@ -484,11 +481,8 @@ export function createApiFactory(
|
||||
get activeDebugSession() {
|
||||
return extHostDebugService.activeDebugSession;
|
||||
},
|
||||
startDebugging: proposedApiFunction(extension, (folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) => {
|
||||
startDebugging(folder: vscode.WorkspaceFolder | undefined, nameOrConfig: string | vscode.DebugConfiguration) {
|
||||
return extHostDebugService.startDebugging(folder, nameOrConfig);
|
||||
}),
|
||||
startDebugSession(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration) {
|
||||
return extHostDebugService.startDebugSession(folder, config);
|
||||
},
|
||||
onDidStartDebugSession(listener, thisArg?, disposables?) {
|
||||
return extHostDebugService.onDidStartDebugSession(listener, thisArg, disposables);
|
||||
@@ -584,7 +578,8 @@ export function createApiFactory(
|
||||
TaskGroup: extHostTypes.TaskGroup,
|
||||
ProcessExecution: extHostTypes.ProcessExecution,
|
||||
ShellExecution: extHostTypes.ShellExecution,
|
||||
Task: extHostTypes.Task
|
||||
Task: extHostTypes.Task,
|
||||
ConfigurationTarget: extHostTypes.ConfigurationTarget
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ export abstract class MainThreadCommandsShape {
|
||||
}
|
||||
|
||||
export abstract class MainThreadConfigurationShape {
|
||||
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any): TPromise<void> { throw ni(); }
|
||||
$removeConfigurationOption(target: ConfigurationTarget, key: string): TPromise<void> { throw ni(); }
|
||||
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resource: URI): TPromise<void> { throw ni(); }
|
||||
$removeConfigurationOption(target: ConfigurationTarget, key: string, resource: URI): TPromise<void> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class MainThreadDiagnosticsShape {
|
||||
|
||||
@@ -195,8 +195,8 @@ export class ExtHostApiCommands {
|
||||
]
|
||||
});
|
||||
|
||||
this._register('vscode.startDebug', (configuration?: any) => {
|
||||
return this._commands.executeCommand('_workbench.startDebug', configuration);
|
||||
this._register('vscode.startDebug', (configuration?: any, folderUri?: URI) => {
|
||||
return this._commands.executeCommand('_workbench.startDebug', configuration, folderUri);
|
||||
}, {
|
||||
description: 'Start a debugging session.',
|
||||
args: [
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import Event, { Emitter } from 'vs/base/common/event';
|
||||
import { WorkspaceConfiguration, WorkspaceConfiguration2 } from 'vscode';
|
||||
import { WorkspaceConfiguration } from 'vscode';
|
||||
import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { ExtHostConfigurationShape, MainThreadConfigurationShape } from './extHost.protocol';
|
||||
import { ConfigurationTarget as ExtHostConfigurationTarget } from './extHostTypes';
|
||||
import { IConfigurationData, Configuration } from 'vs/platform/configuration/common/configuration';
|
||||
import { ConfigurationTarget } from 'vs/workbench/services/configuration/common/configurationEditing';
|
||||
|
||||
@@ -29,7 +30,7 @@ type ConfigurationInspect<T> = {
|
||||
defaultValue?: T;
|
||||
globalValue?: T;
|
||||
workspaceValue?: T;
|
||||
folderValue?: T;
|
||||
workspaceFolderValue?: T;
|
||||
};
|
||||
|
||||
export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
@@ -55,20 +56,26 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
this._onDidChangeConfiguration.fire(undefined);
|
||||
}
|
||||
|
||||
getConfiguration(section?: string): WorkspaceConfiguration {
|
||||
return this._getConfiguration(section, null, true);
|
||||
}
|
||||
|
||||
getConfiguration2(section?: string, resource?: URI): WorkspaceConfiguration2 {
|
||||
return this._getConfiguration(section, resource, false);
|
||||
}
|
||||
|
||||
private _getConfiguration(section: string, resource: URI, legacy: boolean): WorkspaceConfiguration {
|
||||
|
||||
getConfiguration(section?: string, resource?: URI): WorkspaceConfiguration {
|
||||
const config = section
|
||||
? lookUp(this._configuration.getValue(null, { resource }), section)
|
||||
: this._configuration.getValue(null, { resource });
|
||||
|
||||
function parseConfigurationTarget(arg: boolean | ExtHostConfigurationTarget): ConfigurationTarget {
|
||||
if (arg === void 0 || arg === null) {
|
||||
return ConfigurationTarget.WORKSPACE;
|
||||
}
|
||||
if (typeof arg === 'boolean') {
|
||||
return arg ? ConfigurationTarget.USER : ConfigurationTarget.WORKSPACE;
|
||||
}
|
||||
|
||||
switch (arg) {
|
||||
case ExtHostConfigurationTarget.Global: return ConfigurationTarget.USER;
|
||||
case ExtHostConfigurationTarget.Workspace: return ConfigurationTarget.WORKSPACE;
|
||||
case ExtHostConfigurationTarget.WorkspaceFolder: return ConfigurationTarget.FOLDER;
|
||||
}
|
||||
}
|
||||
|
||||
const result: WorkspaceConfiguration = {
|
||||
has(key: string): boolean {
|
||||
return typeof lookUp(config, key) !== 'undefined';
|
||||
@@ -80,29 +87,26 @@ export class ExtHostConfiguration extends ExtHostConfigurationShape {
|
||||
}
|
||||
return result;
|
||||
},
|
||||
update: (key: string, value: any, global: boolean = false) => {
|
||||
update: (key: string, value: any, arg: ExtHostConfigurationTarget | boolean) => {
|
||||
key = section ? `${section}.${key}` : key;
|
||||
const target = global ? ConfigurationTarget.USER : ConfigurationTarget.WORKSPACE;
|
||||
const target = parseConfigurationTarget(arg);
|
||||
if (value !== void 0) {
|
||||
return this._proxy.$updateConfigurationOption(target, key, value);
|
||||
return this._proxy.$updateConfigurationOption(target, key, value, resource);
|
||||
} else {
|
||||
return this._proxy.$removeConfigurationOption(target, key);
|
||||
return this._proxy.$removeConfigurationOption(target, key, resource);
|
||||
}
|
||||
},
|
||||
inspect: <T>(key: string): ConfigurationInspect<T> => {
|
||||
key = section ? `${section}.${key}` : key;
|
||||
const config = legacy ? this._configuration.lookupLegacy<T>(key) : this._configuration.lookup<T>(key, { resource });
|
||||
const config = this._configuration.lookup<T>(key, { resource });
|
||||
if (config) {
|
||||
const inspect: ConfigurationInspect<T> = {
|
||||
return {
|
||||
key,
|
||||
defaultValue: config.default,
|
||||
globalValue: config.user,
|
||||
workspaceValue: config.workspace,
|
||||
workspaceFolderValue: config.folder
|
||||
};
|
||||
if (!legacy) {
|
||||
inspect.folderValue = config.folder;
|
||||
}
|
||||
return inspect;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -1375,3 +1375,11 @@ export class ThemeColor {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
export enum ConfigurationTarget {
|
||||
Global = 1,
|
||||
|
||||
Workspace = 2,
|
||||
|
||||
WorkspaceFolder = 3
|
||||
}
|
||||
Reference in New Issue
Block a user