From 375a0b721c4eb3269a278f020441d9b428ca08ef Mon Sep 17 00:00:00 2001 From: "Cornelius A. Ludmann" Date: Fri, 17 Apr 2020 13:24:44 +0000 Subject: [PATCH] Use normalized URI in Terminal CWD selector If you have configured a workspace folder like ``` "path": "../../workspace" ``` you get a Terminal for URI `/workspace/theia/../../workspace` instead of `/workspace`. This commit fixes this by using a normalized path in the terminal cwd selector. Fixes #7597 Signed-off-by: Cornelius A. Ludmann --- .../src/browser/terminal-frontend-contribution.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index 739e037fadb3f..d77a4e5f27d60 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -564,7 +564,14 @@ export class TerminalFrontendContribution implements TerminalService, CommandCon protected async selectTerminalCwd(): Promise { const roots = this.workspaceService.tryGetRoots(); return this.quickPick.show(roots.map( - ({ uri }) => ({ label: this.labelProvider.getName(new URI(uri)), description: this.labelProvider.getLongName(new URI(uri)), value: uri }) + ({ uri }) => { + const normalizedUri = new URI(uri).normalizePath(); + return { + label: this.labelProvider.getName(normalizedUri), + description: this.labelProvider.getLongName(normalizedUri), + value: normalizedUri.toString() + }; + } ), { placeholder: 'Select current working directory for new terminal' }); }