@@ -30,18 +30,24 @@ class InternalServiceError extends Error {}
30
30
class UnavaliableLaunchServiceError extends Error { }
31
31
32
32
const workspaceFolderToken = '${workspaceFolder}' ;
33
+ const fileToken = '${file}' ;
34
+
33
35
/**
34
- * Replaces '${workspaceFolder }' with the current folder while keeping path separators consistent .
36
+ * Replaces some '${variable }' tokens .
35
37
*
36
38
* @param projectPath The expected path to the .csproj
37
39
* @param folderPath The current workspace folder
38
40
* @returns A fully resolved path to the .csproj
39
41
*/
40
- function resolveWorkspaceFolderToken ( projectPath : string , folderPath : string ) : string {
42
+ function resolveVariableTokens ( projectPath : string , folderPath : string ) : string {
43
+ if ( projectPath === fileToken ) {
44
+ return vscode . window . activeTextEditor ?. document . fileName ?? projectPath ;
45
+ }
46
+
41
47
if ( projectPath . startsWith ( workspaceFolderToken ) ) {
42
48
const relativeProjectPath : string = projectPath . substring ( workspaceFolderToken . length ) ;
43
49
44
- // Keep the path seperate consistant
50
+ // Keep the path separators consistent
45
51
if ( relativeProjectPath . startsWith ( '/' ) ) {
46
52
folderPath = folderPath . replace ( / [ \\ / ] + / g, '/' ) ;
47
53
} else {
@@ -91,7 +97,7 @@ export class DotnetConfigurationResolver implements vscode.DebugConfigurationPro
91
97
let projectPath : string | undefined = debugConfiguration . projectPath ;
92
98
if ( folder ) {
93
99
if ( projectPath ) {
94
- projectPath = resolveWorkspaceFolderToken ( projectPath , folder . uri . fsPath ) ;
100
+ projectPath = resolveVariableTokens ( projectPath , folder . uri . fsPath ) ;
95
101
}
96
102
97
103
const dotnetDebugServiceProxy = await getServiceBroker ( ) ?. getProxy < IDotnetDebugConfigurationService > (
0 commit comments