Skip to content

Commit

Permalink
Merge branch 'master' into readme_change
Browse files Browse the repository at this point in the history
  • Loading branch information
noppej authored Feb 21, 2023
2 parents d32645b + 018fc4f commit d514b09
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ on:
jobs:
publish:
name: Publish the VS Code Extension
runs-on: ubuntu-latest
if: success() && startsWith(github.ref, 'refs/tags/') && runner.name == 'ubuntu-latest'
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
if: success() && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,18 @@
}
]
}
],
"configuration": [
{
"title": "probe-rs Debugger",
"properties": {
"probe-rs-debugger.debuggerExecutable": {
"type": "string",
"markdownDescription": "Path to the `probe-rs-debugger` executable. If this is not set, the extension requires that `probe-rs-debugger` (or `probe-rs-debugger.exe`) is available on the system `PATH`.\n\nNote: Settings in 'launch.json' take precedence over this setting.",
"scope": "machine-overridable"
}
}
}
]
}
}
29 changes: 22 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,7 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
if (session.configuration.hasOwnProperty('runtimeExecutable')) {
command = session.configuration.runtimeExecutable;
} else {
switch (os.platform()) {
case 'win32':
command = 'probe-rs-debugger.exe';
break;
default:
command = 'probe-rs-debugger';
}
command = debuggerExecutablePath();
}
} else {
command = executable.command;
Expand Down Expand Up @@ -512,6 +506,27 @@ function startDebugServer(
});
}

// Get the name of the debugger executable
//
// This takes the value from configuration, if set, or
// falls back to the default name.
function debuggerExecutablePath(): string {
let configuration = vscode.workspace.getConfiguration('probe-rs-debugger');

let configuredPath: string = configuration.get('debuggerExecutable') ?? defaultExecutable();

return configuredPath;
}

function defaultExecutable(): string {
switch (os.platform()) {
case 'win32':
return 'probe-rs-debugger.exe';
default:
return 'probe-rs-debugger';
}
}

// @ts-ignore
class ProbeRsDebugAdapterTrackerFactory implements DebugAdapterTrackerFactory {
createDebugAdapterTracker(
Expand Down

0 comments on commit d514b09

Please sign in to comment.