Skip to content

Commit

Permalink
Fixes no error message on most functions if not in a workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
ThadHouse committed Apr 6, 2018
1 parent b118bdf commit b2ca005
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vscode/vscode-wpilib-core/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ export function activate(context: vscode.ExtensionContext) {
}
await externalApi.getDeployDebugAPI().startRioLog(await preferences.getTeamNumber(), true);
}));

context.subscriptions.push(vscode.commands.registerCommand('wpilibcore.setTeamNumber', async () => {
const preferencesApi = externalApi.getPreferencesAPI();
const workspace = await preferencesApi.getFirstOrSelectedWorkspace();
if (workspace === undefined) {
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
return;
}
const preferences = preferencesApi.getPreferences(workspace);
Expand All @@ -89,6 +90,7 @@ export function activate(context: vscode.ExtensionContext) {
const preferencesApi = externalApi.getPreferencesAPI();
const workspace = await preferencesApi.getFirstOrSelectedWorkspace();
if (workspace === undefined) {
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
return;
}
await externalApi.getDeployDebugAPI().deployCode(workspace);
Expand All @@ -98,6 +100,7 @@ export function activate(context: vscode.ExtensionContext) {
const preferencesApi = externalApi.getPreferencesAPI();
const workspace = await preferencesApi.getFirstOrSelectedWorkspace();
if (workspace === undefined) {
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
return;
}
await externalApi.getDeployDebugAPI().debugCode(workspace);
Expand All @@ -107,6 +110,7 @@ export function activate(context: vscode.ExtensionContext) {
const preferencesApi = externalApi.getPreferencesAPI();
const workspace = await preferencesApi.getFirstOrSelectedWorkspace();
if (workspace === undefined) {
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
return;
}

Expand All @@ -132,11 +136,13 @@ export function activate(context: vscode.ExtensionContext) {
const preferencesApi = externalApi.getPreferencesAPI();
const workspace = await preferencesApi.getFirstOrSelectedWorkspace();
if (workspace === undefined) {
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
return;
}

const result = await vscode.window.showInformationMessage('Automatically save on deploy?', 'Yes', 'No');
if (result === undefined) {
console.log('failed to set automatically save on deploy');
return;
}
const preferences = preferencesApi.getPreferences(workspace);
Expand All @@ -155,11 +161,13 @@ export function activate(context: vscode.ExtensionContext) {
const preferencesApi = externalApi.getPreferencesAPI();
const workspace = await preferencesApi.getFirstOrSelectedWorkspace();
if (workspace === undefined) {
vscode.window.showInformationMessage('Cannot set team number in an empty workspace');
return;
}

const result = await vscode.window.showInformationMessage('Automatically start RioLog on deploy?', 'Yes', 'No');
if (result === undefined) {
console.log('Invalid selection for riolog on deploy');
return;
}
const preferences = preferencesApi.getPreferences(workspace);
Expand Down

0 comments on commit b2ca005

Please sign in to comment.