Merge from vscode 31e03b8ffbb218a87e3941f2b63a249f061fe0e4 (#4986)

This commit is contained in:
Anthony Dresser
2019-04-10 16:29:23 -07:00
committed by GitHub
parent 18c54f41bd
commit 8315dacda4
320 changed files with 5540 additions and 3822 deletions

View File

@@ -10,7 +10,7 @@ import * as Types from 'vs/base/common/types';
import { Schemas } from 'vs/base/common/network';
import { toResource } from 'vs/workbench/common/editor';
import { IStringDictionary, forEach, fromMap } from 'vs/base/common/collections';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IWorkspaceFolder, IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
@@ -19,22 +19,21 @@ import { AbstractVariableResolverService } from 'vs/workbench/services/configura
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { IQuickInputService, IInputOptions, IQuickPickItem, IPickOptions } from 'vs/platform/quickinput/common/quickInput';
import { ConfiguredInput, IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { IWindowService } from 'vs/platform/windows/common/windows';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ConfiguredInput } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { IProcessEnvironment } from 'vs/base/common/platform';
export class ConfigurationResolverService extends AbstractVariableResolverService {
export abstract class BaseConfigurationResolverService extends AbstractVariableResolverService {
static INPUT_OR_COMMAND_VARIABLES_PATTERN = /\${((input|command):(.*?))}/g;
constructor(
@IWindowService windowService: IWindowService,
@IEditorService editorService: IEditorService,
@IEnvironmentService environmentService: IEnvironmentService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@ICommandService private readonly commandService: ICommandService,
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IQuickInputService private readonly quickInputService: IQuickInputService
envVariables: IProcessEnvironment,
editorService: IEditorService,
environmentService: IWorkbenchEnvironmentService,
private readonly configurationService: IConfigurationService,
private readonly commandService: ICommandService,
private readonly workspaceContextService: IWorkspaceContextService,
private readonly quickInputService: IQuickInputService
) {
super({
getFolderUri: (folderName: string): uri | undefined => {
@@ -83,7 +82,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
}
return undefined;
}
}, windowService.getConfiguration().userEnv);
}, envVariables);
}
public resolveWithInteractionReplace(folder: IWorkspaceFolder | undefined, config: any, section?: string, variables?: IStringDictionary<string>): Promise<any> {
@@ -200,7 +199,7 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
private findVariables(object: any, variables: string[]) {
if (typeof object === 'string') {
let matches;
while ((matches = ConfigurationResolverService.INPUT_OR_COMMAND_VARIABLES_PATTERN.exec(object)) !== null) {
while ((matches = BaseConfigurationResolverService.INPUT_OR_COMMAND_VARIABLES_PATTERN.exec(object)) !== null) {
if (matches.length === 4) {
const command = matches[1];
if (variables.indexOf(command) < 0) {
@@ -293,4 +292,16 @@ export class ConfigurationResolverService extends AbstractVariableResolverServic
}
}
registerSingleton(IConfigurationResolverService, ConfigurationResolverService, true);
export class ConfigurationResolverService extends BaseConfigurationResolverService {
constructor(
@IEditorService editorService: IEditorService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IConfigurationService configurationService: IConfigurationService,
@ICommandService commandService: ICommandService,
@IWorkspaceContextService workspaceContextService: IWorkspaceContextService,
@IQuickInputService quickInputService: IQuickInputService
) {
super(environmentService.configuration.userEnv, editorService, environmentService, configurationService, commandService, workspaceContextService, quickInputService);
}
}