Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make easy adoptions of async configuation resolver service #120326

Merged
merged 3 commits into from Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostDebugService.ts
Expand Up @@ -384,7 +384,7 @@ export abstract class ExtHostDebugServiceBase implements IExtHostDebugService, E
}
};
}
return this._variableResolver.resolveAny(ws, config);
return this._variableResolver.resolveAnyAsync(ws, config);
}

protected createDebugAdapter(adapter: IAdapterDescriptor, session: ExtHostDebugSession): AbstractDebugAdapter | undefined {
Expand Down
Expand Up @@ -137,11 +137,13 @@ export const openNewSearchEditor =

const seedSearchStringFromSelection = _args.location === 'new' || configurationService.getValue<IEditorOptions>('editor').find!.seedSearchStringFromSelection;
const args: OpenSearchEditorArgs = { query: seedSearchStringFromSelection ? selected : undefined };
Object.entries(_args).forEach(([name, value]) => {
for (const entry of Object.entries(_args)) {
const name = entry[0];
const value = entry[1];
if (value !== undefined) {
(args as any)[name as any] = (typeof value === 'string') ? configurationResolverService.resolve(lastActiveWorkspaceRoot, value) : value;
(args as any)[name as any] = (typeof value === 'string') ? await configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, value) : value;
}
});
}
const existing = editorService.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE).find(id => id.editor.getTypeId() === SearchEditorInput.ID);
let editor: SearchEditor;
if (existing && args.location === 'reuse') {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Expand Up @@ -76,7 +76,7 @@ async function getCwdForSplit(configHelper: ITerminalConfigHelper, instance: ITe
}

export const terminalSendSequenceCommand = (accessor: ServicesAccessor, args: { text?: string } | undefined) => {
accessor.get(ITerminalService).doWithActiveInstance(t => {
accessor.get(ITerminalService).doWithActiveInstance(async t => {
if (!args?.text) {
return;
}
Expand All @@ -85,7 +85,7 @@ export const terminalSendSequenceCommand = (accessor: ServicesAccessor, args: {
const historyService = accessor.get(IHistoryService);
const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(Schemas.file);
const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? withNullAsUndefined(workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
const resolvedText = configurationResolverService.resolve(lastActiveWorkspaceRoot, args.text);
const resolvedText = await configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, args.text);
t.sendText(resolvedText, false);
});
};
Expand Down
Expand Up @@ -376,16 +376,16 @@ export class TerminalProcessManager extends Disposable implements ITerminalProce
shellLaunchConfig.executable = defaultConfig.shell;
shellLaunchConfig.args = defaultConfig.args;
} else {
shellLaunchConfig.executable = this._configurationResolverService.resolve(lastActiveWorkspace, shellLaunchConfig.executable);
shellLaunchConfig.executable = await this._configurationResolverService.resolveAsync(lastActiveWorkspace, shellLaunchConfig.executable);
if (shellLaunchConfig.args) {
if (Array.isArray(shellLaunchConfig.args)) {
const resolvedArgs: string[] = [];
for (const arg of shellLaunchConfig.args) {
resolvedArgs.push(this._configurationResolverService.resolve(lastActiveWorkspace, arg));
resolvedArgs.push(await this._configurationResolverService.resolveAsync(lastActiveWorkspace, arg));
}
shellLaunchConfig.args = resolvedArgs;
} else {
shellLaunchConfig.args = this._configurationResolverService.resolve(lastActiveWorkspace, shellLaunchConfig.args);
shellLaunchConfig.args = await this._configurationResolverService.resolveAsync(lastActiveWorkspace, shellLaunchConfig.args);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/terminal/node/terminalProfiles.ts
Expand Up @@ -100,7 +100,7 @@ async function transformToTerminalProfiles(entries: IterableIterator<[string, IT
const paths = originalPaths.slice();

for (let i = 0; i < paths.length; i++) {
paths[i] = variableResolver?.resolve(workspaceFolder, paths[i]) || paths[i];
paths[i] = await variableResolver?.resolveAsync(workspaceFolder, paths[i]) || paths[i];
}
const validatedProfile = await validateProfilePaths(profileName, paths, statProvider, args, profile.overrideName, profile.isAutoDetected, logService);
if (validatedProfile) {
Expand Down