Skip to content

Commit

Permalink
update env var collection resolve undefined folder
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 committed Jan 7, 2025
1 parent 608af67 commit d208403
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/cdtDebugAdapter/debugConfProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
DebugConfiguration,
DebugConfigurationProvider,
WorkspaceFolder,
window
} from "vscode";
import { readParameter } from "../idfConfiguration";
import { getIdfTargetFromSdkconfig, getProjectName } from "../workspaceConfig";
Expand All @@ -40,6 +41,14 @@ export class CDTDebugConfigurationProvider
token?: CancellationToken
): Promise<DebugConfiguration> {
try {
if (!folder) {
folder = await window.showWorkspaceFolderPick({
placeHolder: "Pick a workspace folder to start a debug session.",
});
if (!folder) {
throw new Error("No folder was selected to start debug session");
}
}
if (!config.program) {
const buildDirPath = readParameter("idf.buildPath", folder) as string;
const projectName = await getProjectName(buildDirPath);
Expand Down
9 changes: 9 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,15 @@ export async function appendIdfAndToolsToPath(curWorkspace: vscode.Uri) {
pathNameInEnv
] = `${IDF_ADD_PATHS_EXTRAS}${path.delimiter}${modifiedEnv[pathNameInEnv]}`;

extensionContext.environmentVariableCollection.replace(
pathNameInEnv,
modifiedEnv[pathNameInEnv],
{
applyAtShellIntegration: true,
applyAtProcessCreation: true,
}
);

let idfTarget = await getIdfTargetFromSdkconfig(curWorkspace);
if (idfTarget) {
modifiedEnv.IDF_TARGET = idfTarget || process.env.IDF_TARGET;
Expand Down

0 comments on commit d208403

Please sign in to comment.