@@ -75,9 +75,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
7575 vscode . commands . registerCommand ( 'wpilibcore.setTeamNumber' , async ( ) => {
7676 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
7777 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
78- if ( workspace === undefined ) {
78+ if (
79+ workspace === undefined ||
80+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
81+ ) {
7982 vscode . window . showInformationMessage (
80- i18n ( 'message' , 'Cannot set team number in an empty workspace ' )
83+ i18n ( 'message' , 'Cannot set team number since this is not a WPILib project ' )
8184 ) ;
8285 return ;
8386 }
@@ -102,9 +105,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
102105 async ( source : vscode . Uri | undefined ) => {
103106 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
104107 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
105- if ( workspace === undefined ) {
108+ if (
109+ workspace === undefined ||
110+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
111+ ) {
106112 vscode . window . showInformationMessage (
107- i18n ( 'message' , 'Cannot deploy code in an empty workspace ' )
113+ i18n ( 'message' , 'Cannot deploy code since this is not a WPILib project ' )
108114 ) ;
109115 return ;
110116 }
@@ -119,9 +125,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
119125 async ( source : vscode . Uri | undefined ) => {
120126 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
121127 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
122- if ( workspace === undefined ) {
128+ if (
129+ workspace === undefined ||
130+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
131+ ) {
123132 vscode . window . showInformationMessage (
124- i18n ( 'message' , 'Cannot debug code in an empty workspace ' )
133+ i18n ( 'message' , 'Cannot debug code since this is not a WPILib project ' )
125134 ) ;
126135 return ;
127136 }
@@ -136,9 +145,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
136145 async ( source : vscode . Uri | undefined ) => {
137146 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
138147 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
139- if ( workspace === undefined ) {
148+ if (
149+ workspace === undefined ||
150+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
151+ ) {
140152 vscode . window . showInformationMessage (
141- i18n ( 'message' , 'Cannot simulate code in an empty workspace ' )
153+ i18n ( 'message' , 'Cannot simulate code since this is not a WPILib project ' )
142154 ) ;
143155 return ;
144156 }
@@ -153,9 +165,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
153165 async ( source : vscode . Uri | undefined ) => {
154166 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
155167 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
156- if ( workspace === undefined ) {
168+ if (
169+ workspace === undefined ||
170+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
171+ ) {
157172 vscode . window . showInformationMessage (
158- i18n ( 'message' , 'Cannot simulate code in an empty workspace ' )
173+ i18n ( 'message' , 'Cannot simulate code since this is not a WPILib project ' )
159174 ) ;
160175 return ;
161176 }
@@ -170,9 +185,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
170185 async ( source : vscode . Uri | undefined ) => {
171186 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
172187 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
173- if ( workspace === undefined ) {
188+ if (
189+ workspace === undefined ||
190+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
191+ ) {
174192 vscode . window . showInformationMessage (
175- i18n ( 'message' , 'Cannot start tests in an empty workspace ' )
193+ i18n ( 'message' , 'Cannot start tests since this is not a WPILib project ' )
176194 ) ;
177195 return ;
178196 }
@@ -187,9 +205,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
187205 async ( source : vscode . Uri | undefined ) => {
188206 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
189207 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
190- if ( workspace === undefined ) {
208+ if (
209+ workspace === undefined ||
210+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
211+ ) {
191212 vscode . window . showInformationMessage (
192- i18n ( 'message' , 'Cannot set team number in an empty workspace ' )
213+ i18n ( 'message' , 'Cannot set team number since this is not a WPILib project ' )
193214 ) ;
194215 return ;
195216 }
@@ -210,9 +231,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
210231 }
211232 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
212233 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
213- if ( workspace === undefined ) {
234+ if (
235+ workspace === undefined ||
236+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
237+ ) {
214238 vscode . window . showInformationMessage (
215- i18n ( 'message' , 'Cannot create command in an empty workspace ' )
239+ i18n ( 'message' , 'Cannot create command since this is not a WPILib project ' )
216240 ) ;
217241 return ;
218242 }
@@ -225,9 +249,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
225249 vscode . commands . registerCommand ( 'wpilibcore.setLanguage' , async ( ) => {
226250 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
227251 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
228- if ( workspace === undefined ) {
252+ if (
253+ workspace === undefined ||
254+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
255+ ) {
229256 vscode . window . showInformationMessage (
230- i18n ( 'message' , 'Cannot set language in an empty workspace ' )
257+ i18n ( 'message' , 'Cannot set language since this is not a WPILib project ' )
231258 ) ;
232259 return ;
233260 }
@@ -260,9 +287,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
260287 vscode . commands . registerCommand ( 'wpilibcore.setSkipTests' , async ( ) => {
261288 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
262289 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
263- if ( workspace === undefined ) {
290+ if (
291+ workspace === undefined ||
292+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
293+ ) {
264294 vscode . window . showInformationMessage (
265- i18n ( 'message' , 'Cannot set skip tests in an empty workspace ' )
295+ i18n ( 'message' , 'Cannot set skip tests since this is not a WPILib project ' )
266296 ) ;
267297 return ;
268298 }
@@ -285,9 +315,15 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
285315 vscode . commands . registerCommand ( 'wpilibcore.setSkipSelectSimulateExtension' , async ( ) => {
286316 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
287317 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
288- if ( workspace === undefined ) {
318+ if (
319+ workspace === undefined ||
320+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
321+ ) {
289322 vscode . window . showInformationMessage (
290- i18n ( 'message' , 'Cannot set skip select simulate extension in an empty workspace' )
323+ i18n (
324+ 'message' ,
325+ 'Cannot set skip select simulate extension since this is not a WPILib project'
326+ )
291327 ) ;
292328 return ;
293329 }
@@ -314,9 +350,15 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
314350 vscode . commands . registerCommand ( 'wpilibcore.setSelectDefaultSimulateExtension' , async ( ) => {
315351 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
316352 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
317- if ( workspace === undefined ) {
353+ if (
354+ workspace === undefined ||
355+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
356+ ) {
318357 vscode . window . showInformationMessage (
319- i18n ( 'message' , 'Cannot set select default simulate extension in an empty workspace' )
358+ i18n (
359+ 'message' ,
360+ 'Cannot set select default simulate extension since this is not a WPILib project'
361+ )
320362 ) ;
321363 return ;
322364 }
@@ -343,9 +385,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
343385 vscode . commands . registerCommand ( 'wpilibcore.setOffline' , async ( ) => {
344386 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
345387 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
346- if ( workspace === undefined ) {
388+ if (
389+ workspace === undefined ||
390+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
391+ ) {
347392 vscode . window . showInformationMessage (
348- i18n ( 'message' , 'Cannot set offline in an empty workspace ' )
393+ i18n ( 'message' , 'Cannot set offline since this is not a WPILib project ' )
349394 ) ;
350395 return ;
351396 }
@@ -372,9 +417,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
372417 vscode . commands . registerCommand ( 'wpilibcore.setDeployOffline' , async ( ) => {
373418 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
374419 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
375- if ( workspace === undefined ) {
420+ if (
421+ workspace === undefined ||
422+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
423+ ) {
376424 vscode . window . showInformationMessage (
377- i18n ( 'message' , 'Cannot set deploy offline in an empty workspace ' )
425+ i18n ( 'message' , 'Cannot set deploy offline since this is not a WPILib project ' )
378426 ) ;
379427 return ;
380428 }
@@ -401,9 +449,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
401449 vscode . commands . registerCommand ( 'wpilibcore.setStopSimulationOnEntry' , async ( ) => {
402450 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
403451 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
404- if ( workspace === undefined ) {
452+ if (
453+ workspace === undefined ||
454+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
455+ ) {
405456 vscode . window . showInformationMessage (
406- i18n ( 'message' , 'Cannot set stop simulation in an empty workspace ' )
457+ i18n ( 'message' , 'Cannot set stop simulation since this is not a WPILib project ' )
407458 ) ;
408459 return ;
409460 }
@@ -430,9 +481,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
430481 vscode . commands . registerCommand ( 'wpilibcore.setUseWinDbgX' , async ( ) => {
431482 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
432483 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
433- if ( workspace === undefined ) {
484+ if (
485+ workspace === undefined ||
486+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
487+ ) {
434488 vscode . window . showInformationMessage (
435- i18n ( 'message' , 'Cannot set windbgx in an empty workspace ' )
489+ i18n ( 'message' , 'Cannot set windbgx since this is not a WPILib project ' )
436490 ) ;
437491 return ;
438492 }
@@ -463,9 +517,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
463517 vscode . commands . registerCommand ( 'wpilibcore.setAutoSave' , async ( ) => {
464518 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
465519 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
466- if ( workspace === undefined ) {
520+ if (
521+ workspace === undefined ||
522+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
523+ ) {
467524 vscode . window . showInformationMessage (
468- i18n ( 'message' , 'Cannot set auto save in an empty workspace ' )
525+ i18n ( 'message' , 'Cannot set auto save since this is not a WPILib project ' )
469526 ) ;
470527 return ;
471528 }
@@ -492,9 +549,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
492549 vscode . commands . registerCommand ( 'wpilibcore.setStartRioLog' , async ( ) => {
493550 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
494551 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
495- if ( workspace === undefined ) {
552+ if (
553+ workspace === undefined ||
554+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
555+ ) {
496556 vscode . window . showInformationMessage (
497- i18n ( 'message' , 'Cannot set start RioLog in an empty workspace ' )
557+ i18n ( 'message' , 'Cannot set start RioLog since this is not a WPILib project ' )
498558 ) ;
499559 return ;
500560 }
@@ -540,9 +600,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
540600 vscode . commands . registerCommand ( 'wpilibcore.installGradleTools' , async ( ) => {
541601 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
542602 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
543- if ( workspace === undefined ) {
603+ if (
604+ workspace === undefined ||
605+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
606+ ) {
544607 vscode . window . showInformationMessage (
545- i18n ( 'message' , 'Cannot install gradle tools with an empty workspace ' )
608+ i18n ( 'message' , 'Cannot install gradle tools since this is not a WPILib project ' )
546609 ) ;
547610 return ;
548611 }
@@ -560,9 +623,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
560623 return ;
561624 }
562625 const wp = await externalApi . getPreferencesAPI ( ) . getFirstOrSelectedWorkspace ( ) ;
563- if ( wp === undefined ) {
626+ if (
627+ wp === undefined ||
628+ ! externalApi . getPreferencesAPI ( ) . getPreferences ( wp ) . getIsWPILibProject ( )
629+ ) {
564630 vscode . window . showInformationMessage (
565- i18n ( 'message' , 'Cannot run command on empty workspace ' )
631+ i18n ( 'message' , 'Cannot run gradle command since this is not a WPILib project ' )
566632 ) ;
567633 return ;
568634 }
@@ -587,9 +653,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
587653 vscode . commands . registerCommand ( 'wpilibcore.resetAutoUpdate' , async ( ) => {
588654 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
589655 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
590- if ( workspace === undefined ) {
656+ if (
657+ workspace === undefined ||
658+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
659+ ) {
591660 vscode . window . showInformationMessage (
592- i18n ( 'message' , 'Cannot reset auto update with an empty workspace ' )
661+ i18n ( 'message' , 'Cannot reset auto update since this is not a WPILib project ' )
593662 ) ;
594663 return ;
595664 }
@@ -602,9 +671,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
602671 vscode . commands . registerCommand ( 'wpilibcore.changeDesktop' , async ( ) => {
603672 const preferencesApi = externalApi . getPreferencesAPI ( ) ;
604673 const workspace = await preferencesApi . getFirstOrSelectedWorkspace ( ) ;
605- if ( workspace === undefined ) {
674+ if (
675+ workspace === undefined ||
676+ ! preferencesApi . getPreferences ( workspace ) . getIsWPILibProject ( )
677+ ) {
606678 vscode . window . showInformationMessage (
607- i18n ( 'message' , 'Cannot change desktop with an empty workspace ' )
679+ i18n ( 'message' , 'Cannot change desktop since this is not a WPILib project ' )
608680 ) ;
609681 return ;
610682 }
@@ -697,9 +769,12 @@ export function createVsCommands(context: vscode.ExtensionContext, externalApi:
697769 context . subscriptions . push (
698770 vscode . commands . registerCommand ( 'wpilibcore.runGradleClean' , async ( ) => {
699771 const wp = await externalApi . getPreferencesAPI ( ) . getFirstOrSelectedWorkspace ( ) ;
700- if ( wp === undefined ) {
772+ if (
773+ wp === undefined ||
774+ ! externalApi . getPreferencesAPI ( ) . getPreferences ( wp ) . getIsWPILibProject ( )
775+ ) {
701776 vscode . window . showInformationMessage (
702- i18n ( 'message' , 'Cannot run command on empty workspace ' )
777+ i18n ( 'message' , 'Cannot run gradle clean since this is not a WPILib project ' )
703778 ) ;
704779 return ;
705780 }
0 commit comments