Skip to content

Commit

Permalink
Make easy adoptions of async configuation resolver service (#120326)
Browse files Browse the repository at this point in the history
* Make easy adoptions of async configuation resolver service
Part of #108804

* Also adopt in exthostDebug

* Add another terminal adoption
  • Loading branch information
alexr00 authored Apr 6, 2021
1 parent 82c180b commit 0215117
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHostDebugService.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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, fsProvider, args, profile.overrideName, profile.isAutoDetected, logService);
if (validatedProfile) {
Expand Down

0 comments on commit 0215117

Please sign in to comment.