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
9 changes: 7 additions & 2 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,11 @@
},
"default": []
},
"envFile": {
"type": "string",
"description": "Absolute path to a file containing environment variable definitions. This file has key value pairs separated by an equals sign per line. E.g. KEY=VALUE",
"default": "${workspaceFolder}/.env"
},
"additionalSOLibSearchPath": {
"type": "string",
"description": "Semicolon separated list of directories to use to search for .so files. Example: \"c:\\dir1;c:\\dir2\".",
Expand Down Expand Up @@ -1219,7 +1224,7 @@
},
"envFile": {
"type": "string",
"description": "Absolute path to a file containing environment variable definitions. These file has key value pairs sepearted by an equals sign per line. E.g. KEY=VALUE",
"description": "Absolute path to a file containing environment variable definitions. This file has key value pairs separated by an equals sign per line. E.g. KEY=VALUE",
"default": "${workspaceFolder}/.env"
},
"symbolSearchPath": {
Expand Down Expand Up @@ -1665,4 +1670,4 @@
"binaries": []
}
]
}
}
28 changes: 14 additions & 14 deletions Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,23 +197,23 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
config.environment = [disableDebugHeapEnvSetting];
}
}
}

// Add environment variables from .env file
if (config.envFile) {
try {
const parsedFile: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromFile(config.envFile.replace(/\${workspaceFolder}/g, folder.uri.path), config["environment"]);
// show error message if single lines cannot get parsed
if (parsedFile.Warning) {
CppConfigurationProvider.showFileWarningAsync(parsedFile.Warning, config.envFile);
}
// Add environment variables from .env file
if (config.envFile) {
try {
const parsedFile: ParsedEnvironmentFile = ParsedEnvironmentFile.CreateFromFile(config.envFile.replace(/\${workspaceFolder}/g, folder.uri.path), config["environment"]);

// show error message if single lines cannot get parsed
if (parsedFile.Warning) {
CppConfigurationProvider.showFileWarningAsync(parsedFile.Warning, config.envFile);
}

config.environment = parsedFile.Env;
config.environment = parsedFile.Env;

delete config.envFile;
} catch (e) {
throw new Error("Can't parse envFile " + config.envFile);
}
delete config.envFile;
} catch (e) {
throw new Error("Can't parse envFile " + config.envFile);
}
}

Expand Down
7 changes: 6 additions & 1 deletion Extension/tools/OptionsSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@
},
"default": []
},
"envFile": {
"type": "string",
"description": "Absolute path to a file containing environment variable definitions. This file has key value pairs separated by an equals sign per line. E.g. KEY=VALUE",
"default": "${workspaceFolder}/.env"
},
"additionalSOLibSearchPath": {
"type": "string",
"description": "Semicolon separated list of directories to use to search for .so files. Example: \"c:\\dir1;c:\\dir2\".",
Expand Down Expand Up @@ -431,7 +436,7 @@
},
"envFile": {
"type": "string",
"description": "Absolute path to a file containing environment variable definitions. These file has key value pairs sepearted by an equals sign per line. E.g. KEY=VALUE",
"description": "Absolute path to a file containing environment variable definitions. This file has key value pairs separated by an equals sign per line. E.g. KEY=VALUE",
"default": "${workspaceFolder}/.env"
},
"symbolSearchPath": {
Expand Down