Skip to content

Commit

Permalink
Fix cwd setting in workspace file
Browse files Browse the repository at this point in the history
Fixes #136099

Co-Authored-By: Megan Rogge <[email protected]>
  • Loading branch information
Tyriar and meganrogge committed Jan 26, 2022
1 parent ba40275 commit 14732d4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/vs/workbench/contrib/terminal/browser/terminalActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } });
Expand All @@ -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);
Expand Down

0 comments on commit 14732d4

Please sign in to comment.