Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1 Enhancements/18650.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for referencing multiroot-workspace folders in settings using `${workspaceFolder:<folder_name>}`.
11 changes: 11 additions & 0 deletions src/client/common/variables/systemVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as Path from 'path';
import { Range, Uri } from 'vscode';

import { IDocumentManager, IWorkspaceService } from '../application/types';
import { WorkspaceService } from '../application/workspace';
import * as Types from '../utils/sysTypes';
import { IStringDictionary, ISystemVariables } from './types';

Expand Down Expand Up @@ -125,6 +126,16 @@ export class SystemVariables extends AbstractSystemVariables {
string | undefined
>)[`env.${key}`] = process.env[key];
});
workspace = workspace ?? new WorkspaceService();
try {
workspace.workspaceFolders?.forEach((folder) => {
const basename = Path.basename(folder.uri.fsPath);
((this as any) as Record<string, string | undefined>)[`workspaceFolder:${basename}`] =
folder.uri.fsPath;
});
} catch {
// This try...catch block is here to support pre-existing tests, ignore error.
}
}

public get cwd(): string {
Expand Down