Skip to content

Commit 1cac778

Browse files
committed
Adds base support for debugging desktop and simulation.
Part of #13
1 parent a242d49 commit 1cac778

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

vscode/shared/extensionAPIs/externalapi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export abstract class IDeployDebugAPI implements IVersionable {
5959
public abstract startRioLog(teamNumber: number, show: boolean): Promise<boolean>;
6060
public abstract deployCode(workspace: vscode.WorkspaceFolder): Promise<boolean>;
6161
public abstract registerCodeDeploy(deployer: ICodeDeployer): void;
62-
public abstract debugCode(workspace: vscode.WorkspaceFolder): Promise<boolean>;
62+
public abstract debugCode(workspace: vscode.WorkspaceFolder, desktop: boolean): Promise<boolean>;
6363
public abstract registerCodeDebug(deployer: ICodeDeployer): void;
6464
public abstract addLanguageChoice(language: string): void;
6565
public getVersion(): number {

vscode/vscode-wpilib/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
"debuggers": [
1919
{
2020
"type": "wpilib",
21-
"label": "WPILib Deploy and Debug",
21+
"label": "WPILib Debug",
2222
"configurationAttributes": {
2323
"launch": {
2424
"required": [
25-
"debug"
25+
"desktop"
2626
],
2727
"properties": {
28-
"debug": {
28+
"desktop": {
2929
"type": "boolean",
30-
"description": "True for debug, false for deploy"
30+
"description": "True for desktop, false for roboRIO"
3131
}
3232
}
3333
}

vscode/vscode-wpilib/src/deploydebugapi.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,18 @@ class WPILibDebugConfigurationProvider implements vscode.DebugConfigurationProvi
2424
public resolveDebugConfiguration(_: vscode.WorkspaceFolder | undefined,
2525
config: vscode.DebugConfiguration, __?: vscode.CancellationToken):
2626
vscode.ProviderResult<vscode.DebugConfiguration> {
27-
let debug = false;
28-
if ('debug' in config) {
29-
debug = config.debug;
27+
let desktop = false;
28+
if ('desktop' in config) {
29+
desktop = config.desktop;
3030
} else {
31-
console.log('debugger has no debug argument. Assuming deploy');
31+
console.log('debugger has no desktop argument. Assuming roboRIO');
3232
}
3333
return new Promise<undefined>(async (resolve) => {
3434
const workspace = await this.preferences.getFirstOrSelectedWorkspace();
3535
if (workspace === undefined) {
3636
return;
3737
}
38-
if (debug) {
39-
await this.debugDeployAPI.debugCode(workspace);
40-
} else {
41-
await this.debugDeployAPI.deployCode(workspace);
42-
}
38+
await this.debugDeployAPI.debugCode(workspace, desktop);
4339
resolve();
4440
});
4541
}
@@ -48,15 +44,15 @@ class WPILibDebugConfigurationProvider implements vscode.DebugConfigurationProvi
4844
__?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration[]> {
4945
const configurationDeploy: vscode.DebugConfiguration = {
5046
type: 'wpilib',
51-
name: 'WPILib Deploy',
47+
name: 'WPILib roboRIO Debug',
5248
request: 'launch',
53-
debug: false
49+
desktop: false
5450
};
5551
const configurationDebug: vscode.DebugConfiguration = {
5652
type: 'wpilib',
57-
name: 'WPILib Debug',
53+
name: 'WPILib Desktop Debug',
5854
request: 'launch',
59-
debug: true
55+
desktop: true
6056
};
6157
return [configurationDeploy, configurationDebug];
6258
}
@@ -121,7 +117,7 @@ export class DeployDebugAPI extends IDeployDebugAPI {
121117
this.languageChoices.push(language);
122118
}
123119

124-
public debugCode(workspace: vscode.WorkspaceFolder): Promise<boolean> {
120+
public debugCode(workspace: vscode.WorkspaceFolder, _desktop: boolean): Promise<boolean> {
125121
return this.deployCommon(workspace, this.debuggers, true);
126122
}
127123
public deployCode(workspace: vscode.WorkspaceFolder): Promise<boolean> {

vscode/vscode-wpilib/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export function activate(context: vscode.ExtensionContext) {
121121
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
122122
return;
123123
}
124-
await externalApi.getDeployDebugAPI().debugCode(workspace);
124+
await externalApi.getDeployDebugAPI().debugCode(workspace, false);
125125
}));
126126

127127
context.subscriptions.push(vscode.commands.registerCommand('wpilibcore.createCommand', async (arg: vscode.Uri | undefined) => {

0 commit comments

Comments
 (0)