Skip to content

Commit 180bbce

Browse files
bentekkiehyangah
authored andcommitted
Substitute workspaceFolderBasename variable into extension settings
Add logic to support ${workspaceFolderBasename} substitution in extension settings Fixes #2310 Change-Id: I2a68291d00b98d9c6b0b83b45cce35e0756e5761 GitHub-Last-Rev: 2c24341 GitHub-Pull-Request: #2322 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/416194 Reviewed-by: Suzy Mueller <[email protected]> TryBot-Result: kokoro <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
1 parent e63f1ad commit 180bbce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/util.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ export function timeout(millis: number): Promise<void> {
606606
}
607607

608608
/**
609-
* Expands ~ to homedir in non-Windows platform and resolves ${workspaceFolder} or ${workspaceRoot}
609+
* Expands ~ to homedir in non-Windows platform and resolves
610+
* ${workspaceFolder}, ${workspaceRoot} and ${workspaceFolderBasename}
610611
*/
611612
export function resolvePath(inputPath: string, workspaceFolder?: string): string {
612613
if (!inputPath || !inputPath.trim()) {
@@ -621,6 +622,7 @@ export function resolvePath(inputPath: string, workspaceFolder?: string): string
621622

622623
if (workspaceFolder) {
623624
inputPath = inputPath.replace(/\${workspaceFolder}|\${workspaceRoot}/g, workspaceFolder);
625+
inputPath = inputPath.replace(/\${workspaceFolderBasename}/g, path.basename(workspaceFolder));
624626
}
625627
return resolveHomeDir(inputPath);
626628
}

0 commit comments

Comments
 (0)