Skip to content

Commit

Permalink
Assign default cwd correctly. (#83)
Browse files Browse the repository at this point in the history
* Assign default `cwd` correctly.

* Fix prettier
  • Loading branch information
noppej authored Feb 5, 2024
1 parent a6aeaca commit 01a006a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "probe-rs-debugger",
"displayName": "Debugger for probe-rs",
"version": "0.22.2",
"version": "0.22.3",
"publisher": "probe-rs",
"description": "probe-rs Debug Adapter for VS Code.",
"author": {
Expand Down
43 changes: 23 additions & 20 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,27 +309,30 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
);
debuggerStatus = DebuggerStatus.running; // If this is not true as expected, then the user will be notified later.
} else {
// Assign the default `cwd` for the project.
if (!session.configuration.hasOwnProperty('cwd')) {
session.configuration.cwd = session.workspaceFolder?.uri.fsPath;
}

// Validate that the `cwd` folder exists.
if (session.configuration.hasOwnProperty('cwd')) {
if (!existsSync(session.configuration.cwd)) {
logToConsole(
`${
ConsoleLogSources.error
}: ${ConsoleLogSources.console.toLowerCase()}: The 'cwd' folder does not exist: ${JSON.stringify(
session.configuration.cwd,
null,
2,
)}`,
);
vscode.window.showErrorMessage(
`The 'cwd' folder does not exist: ${JSON.stringify(
session.configuration.cwd,
null,
2,
)}`,
);
return undefined;
}
if (!existsSync(session.configuration.cwd)) {
logToConsole(
`${
ConsoleLogSources.error
}: ${ConsoleLogSources.console.toLowerCase()}: The 'cwd' folder does not exist: ${JSON.stringify(
session.configuration.cwd,
null,
2,
)}`,
);
vscode.window.showErrorMessage(
`The 'cwd' folder does not exist: ${JSON.stringify(
session.configuration.cwd,
null,
2,
)}`,
);
return undefined;
}
// Find and use the first available port and spawn a new probe-rs dap-server process
try {
Expand Down

0 comments on commit 01a006a

Please sign in to comment.