@@ -29,18 +29,31 @@ import Logger from "../logger.mjs";
2929import  {  rustProjectGetSelectedChip  }  from  "../utils/rustUtil.mjs" ; 
3030import  {  OPENOCD_VERSION  }  from  "../utils/sharedConstants.mjs" ; 
3131import  { 
32-   getBoardFromZephyrProject , 
32+   GET_CHIP , 
33+   GET_CHIP_UPPERCASE , 
34+   GET_COMPILER_PATH , 
35+   GET_CXX_COMPILER_PATH , 
36+   GET_ENV_PATH , 
37+   GET_GDB_PATH , 
38+   GET_OPENOCD_ROOT , 
39+   GET_PICOTOOL_PATH , 
40+   GET_PYTHON_PATH , 
41+   GET_SVD_PATH , 
42+   GET_TARGET , 
43+   GET_WEST_PATH , 
44+   GET_ZEPHYR_WORKSPACE_PATH , 
45+ }  from  "./cmdIds.mjs" ; 
46+ import  {  getBoardFromZephyrProject  }  from  "../utils/setupZephyr.mjs" ; 
47+ import  { 
3348  ZEPHYR_PICO , 
3449  ZEPHYR_PICO2 , 
3550  ZEPHYR_PICO2_W , 
3651  ZEPHYR_PICO_W , 
37- }  from  "./switchBoard .mjs" ; 
52+ }  from  "../models/zephyrBoards .mjs" ; 
3853
3954export  class  GetPythonPathCommand  extends  CommandWithResult < string >  { 
40-   public  static  readonly  id  =  "getPythonPath" ; 
41- 
4255  constructor ( )  { 
43-     super ( GetPythonPathCommand . id ) ; 
56+     super ( GET_PYTHON_PATH ) ; 
4457  } 
4558
4659  async  execute ( ) : Promise < string >  { 
@@ -58,10 +71,8 @@ export class GetPythonPathCommand extends CommandWithResult<string> {
5871} 
5972
6073export  class  GetEnvPathCommand  extends  CommandWithResult < string >  { 
61-   public  static  readonly  id  =  "getEnvPath" ; 
62- 
6374  constructor ( )  { 
64-     super ( GetEnvPathCommand . id ) ; 
75+     super ( GET_ENV_PATH ) ; 
6576  } 
6677
6778  async  execute ( ) : Promise < string >  { 
@@ -79,10 +90,8 @@ export class GetEnvPathCommand extends CommandWithResult<string> {
7990} 
8091
8192export  class  GetGDBPathCommand  extends  CommandWithResult < string >  { 
82-   public  static  readonly  id  =  "getGDBPath" ; 
83- 
8493  constructor ( private  readonly  _extensionUri : Uri )  { 
85-     super ( GetGDBPathCommand . id ) ; 
94+     super ( GET_GDB_PATH ) ; 
8695  } 
8796
8897  async  execute ( ) : Promise < string >  { 
@@ -172,10 +181,8 @@ export class GetGDBPathCommand extends CommandWithResult<string> {
172181} 
173182
174183export  class  GetCompilerPathCommand  extends  CommandWithResult < string >  { 
175-   public  static  readonly  id  =  "getCompilerPath" ; 
176- 
177184  constructor ( )  { 
178-     super ( GetCompilerPathCommand . id ) ; 
185+     super ( GET_COMPILER_PATH ) ; 
179186  } 
180187
181188  async  execute ( ) : Promise < string >  { 
@@ -213,10 +220,8 @@ export class GetCompilerPathCommand extends CommandWithResult<string> {
213220} 
214221
215222export  class  GetCxxCompilerPathCommand  extends  CommandWithResult < string >  { 
216-   public  static  readonly  id  =  "getCxxCompilerPath" ; 
217- 
218223  constructor ( )  { 
219-     super ( GetCxxCompilerPathCommand . id ) ; 
224+     super ( GET_CXX_COMPILER_PATH ) ; 
220225  } 
221226
222227  async  execute ( ) : Promise < string >  { 
@@ -256,10 +261,8 @@ export class GetCxxCompilerPathCommand extends CommandWithResult<string> {
256261export  class  GetChipCommand  extends  CommandWithResult < string >  { 
257262  private  readonly  _logger  =  new  Logger ( "GetChipCommand" ) ; 
258263
259-   public  static  readonly  id  =  "getChip" ; 
260- 
261264  constructor ( )  { 
262-     super ( GetChipCommand . id ) ; 
265+     super ( GET_CHIP ) ; 
263266  } 
264267
265268  async  execute ( ) : Promise < string >  { 
@@ -357,10 +360,8 @@ export class GetChipCommand extends CommandWithResult<string> {
357360} 
358361
359362export  class  GetChipUppercaseCommand  extends  CommandWithResult < string >  { 
360-   public  static  readonly  id  =  "getChipUppercase" ; 
361- 
362363  constructor ( )  { 
363-     super ( GetChipUppercaseCommand . id ) ; 
364+     super ( GET_CHIP_UPPERCASE ) ; 
364365  } 
365366
366367  async  execute ( ) : Promise < string >  { 
@@ -372,10 +373,8 @@ export class GetChipUppercaseCommand extends CommandWithResult<string> {
372373} 
373374
374375export  class  GetTargetCommand  extends  CommandWithResult < string >  { 
375-   public  static  readonly  id  =  "getTarget" ; 
376- 
377376  constructor ( )  { 
378-     super ( GetTargetCommand . id ) ; 
377+     super ( GET_TARGET ) ; 
379378  } 
380379
381380  async  execute ( ) : Promise < string >  { 
@@ -455,12 +454,11 @@ export class GetPicotoolPathCommand extends CommandWithResult<
455454>  { 
456455  private  running : boolean  =  false ; 
457456
458-   public  static  readonly  id  =  "getPicotoolPath" ; 
459- 
460457  constructor ( )  { 
461-     super ( GetPicotoolPathCommand . id ) ; 
458+     super ( GET_PICOTOOL_PATH ) ; 
462459  } 
463460
461+   // TODO: add rate limiting and caching 
464462  async  execute ( ) : Promise < string  |  undefined >  { 
465463    if  ( this . running )  { 
466464      return  undefined ; 
@@ -505,10 +503,8 @@ export class GetOpenOCDRootCommand extends CommandWithResult<
505503>  { 
506504  private  running : boolean  =  false ; 
507505
508-   public  static  readonly  id  =  "getOpenOCDRoot" ; 
509- 
510506  constructor ( )  { 
511-     super ( GetOpenOCDRootCommand . id ) ; 
507+     super ( GET_OPENOCD_ROOT ) ; 
512508  } 
513509
514510  async  execute ( ) : Promise < string  |  undefined >  { 
@@ -536,10 +532,8 @@ export class GetOpenOCDRootCommand extends CommandWithResult<
536532 * Currently rust only! 
537533 */ 
538534export  class  GetSVDPathCommand  extends  CommandWithResult < string  |  undefined >  { 
539-   public  static  readonly  id  =  "getSVDPath" ; 
540- 
541535  constructor ( private  readonly  _extensionUri : Uri )  { 
542-     super ( GetSVDPathCommand . id ) ; 
536+     super ( GET_SVD_PATH ) ; 
543537  } 
544538
545539  async  execute ( ) : Promise < string  |  undefined >  { 
@@ -582,10 +576,8 @@ export class GetSVDPathCommand extends CommandWithResult<string | undefined> {
582576} 
583577
584578export  class  GetWestPathCommand  extends  CommandWithResult < string  |  undefined >  { 
585-   public  static  readonly  id  =  "getWestPath" ; 
586- 
587579  constructor ( )  { 
588-     super ( GetWestPathCommand . id ) ; 
580+     super ( GET_WEST_PATH ) ; 
589581  } 
590582
591583  execute ( ) : string  |  undefined  { 
@@ -602,10 +594,8 @@ export class GetWestPathCommand extends CommandWithResult<string | undefined> {
602594export  class  GetZephyrWorkspacePathCommand  extends  CommandWithResult < 
603595  string  |  undefined 
604596>  { 
605-   public  static  readonly  id  =  "getZephyrWorkspacePath" ; 
606- 
607597  constructor ( )  { 
608-     super ( GetZephyrWorkspacePathCommand . id ) ; 
598+     super ( GET_ZEPHYR_WORKSPACE_PATH ) ; 
609599  } 
610600
611601  execute ( ) : string  |  undefined  { 
0 commit comments