From 14732d4924d27c0d22d8e91640a22e5198044e19 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 26 Jan 2022 08:57:55 -0800 Subject: [PATCH] Fix cwd setting in workspace file Fixes #136099 Co-Authored-By: Megan Rogge --- .../workbench/contrib/terminal/browser/terminalActions.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts index 4120a3d9551a8..3a2151ca84944 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalActions.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalActions.ts @@ -1742,6 +1742,7 @@ export function registerTerminalActions() { const workspaceContextService = accessor.get(IWorkspaceContextService); const commandService = accessor.get(ICommandService); const configurationService = accessor.get(IConfigurationService); + const configurationResolverService = accessor.get(IConfigurationResolverService); const folders = workspaceContextService.getWorkspace().folders; if (eventOrOptions && eventOrOptions instanceof MouseEvent && (eventOrOptions.altKey || eventOrOptions.ctrlKey)) { await terminalService.createTerminal({ location: { splitActiveTerminal: true } }); @@ -1768,13 +1769,14 @@ export function registerTerminalActions() { eventOrOptions.cwd = workspace.uri; const cwdConfig = configurationService.getValue(TerminalSettingId.Cwd, { resource: workspace.uri }); if (typeof cwdConfig === 'string' && cwdConfig.length > 0) { - if (isAbsolute(cwdConfig) || cwdConfig.startsWith(AbstractVariableResolverService.VARIABLE_LHS)) { + const resolvedCwdConfig = await configurationResolverService.resolveAsync(workspace, cwdConfig); + if (isAbsolute(resolvedCwdConfig) || resolvedCwdConfig.startsWith(AbstractVariableResolverService.VARIABLE_LHS)) { eventOrOptions.cwd = URI.from({ scheme: workspace.uri.scheme, - path: cwdConfig + path: resolvedCwdConfig }); } else { - eventOrOptions.cwd = URI.joinPath(workspace.uri, cwdConfig); + eventOrOptions.cwd = URI.joinPath(workspace.uri, resolvedCwdConfig); } } instance = await terminalService.createTerminal(eventOrOptions);