11/* eslint-disable max-len */
22/* eslint-disable @typescript-eslint/naming-convention */
3- import { dirname , join } from "path" ;
3+ import { join } from "path" ;
44import { dirname as dirnamePosix } from "path/posix" ;
55import Logger , { LoggerSource } from "../../logger.mjs" ;
66import { unknownErrorToString } from "../errorHelper.mjs" ;
@@ -27,10 +27,12 @@ import {
2727import { homedir } from "os" ;
2828import {
2929 GET_CHIP_UPPERCASE ,
30+ GET_GIT_PATH ,
3031 GET_OPENOCD_ROOT ,
3132 GET_PICOTOOL_PATH ,
3233 GET_TARGET ,
3334 GET_WEST_PATH ,
35+ GET_ZEPHYR_SDK_PATH ,
3436 GET_ZEPHYR_WORKSPACE_PATH ,
3537} from "../../commands/cmdIds.mjs" ;
3638import { getZephyrSDKVersion , getZephyrVersion } from "../setupZephyr.mjs" ;
@@ -69,8 +71,7 @@ async function generateVSCodeConfig(
6971 ninjaPath : string ,
7072 cmakePath : string ,
7173 te : TextEncoder = new TextEncoder ( ) ,
72- data : ZephyrSubmitMessageValue ,
73- gitPath : string
74+ data : ZephyrSubmitMessageValue
7475) : Promise < boolean > {
7576 const vsc = join ( projectRoot , ".vscode" ) ;
7677
@@ -164,7 +165,7 @@ async function generateVSCodeConfig(
164165 toolchainPrefix : "arm-zephyr-eabi" ,
165166 armToolchainPath :
166167 // TODO: maybe just full get zephyr compiler path command
167- `\${command:${ extensionName } .${ GET_ZEPHYR_WORKSPACE_PATH } }/zephyr-sdk /arm-zephyr-eabi/bin` ,
168+ `\${command:${ extensionName } .${ GET_ZEPHYR_SDK_PATH } } /arm-zephyr-eabi/bin` ,
168169 // TODO: get chip dynamically maybe: chip: `\${command:${extensionName}.${GetChipCommand.id}}`,
169170 // meaning only one cfg required
170171 device : `\${command:${ extensionName } .${ GET_CHIP_UPPERCASE } }` ,
@@ -179,6 +180,8 @@ async function generateVSCodeConfig(
179180 openOCDLaunchCommands : [ "adapter speed 5000" ] ,
180181 // TODO: add zephyr build support to support this.
181182 rtos : "Zephyr" ,
183+ // TODO: maybe get into launch target path command like in c/c++ projects
184+ preLaunchTask : "Compile Project" ,
182185 } ,
183186 ] ,
184187 } ;
@@ -205,15 +208,13 @@ async function generateVSCodeConfig(
205208 "terminal.integrated.env.windows" : {
206209 // remove gperf and dtc for now
207210 // \${env:USERPROFILE}/.pico-sdk/dtc/${CURRENT_DTC_VERSION}/bin;\${env:USERPROFILE}/.pico-sdk/gperf/${CURRENT_GPERF_VERSION}
208- Path : `${ dirname (
209- gitPath
210- ) } ;\${env:USERPROFILE}/.pico-sdk/7zip;\${env:Path};`,
211+ Path : "${env:USERPROFILE}/.pico-sdk/7zip;${env:Path};" ,
211212 } ,
212213 "terminal.integrated.env.osx" : {
213- PATH : ` ${ dirname ( gitPath ) } :\${ env:PATH}:` ,
214+ PATH : "${ env:PATH}:" ,
214215 } ,
215216 "terminal.integrated.env.linux" : {
216- PATH : ` ${ dirname ( gitPath ) } :\${ env:PATH}:` ,
217+ PATH : "${ env:PATH}:" ,
217218 } ,
218219 "raspberry-pi-pico.cmakeAutoConfigure" : true ,
219220 "raspberry-pi-pico.useCmakeTools" : false ,
@@ -331,9 +332,15 @@ async function generateVSCodeConfig(
331332 problemMatcher : "$gcc" ,
332333 options : {
333334 cwd : `\${command:${ extensionName } .${ GET_ZEPHYR_WORKSPACE_PATH } }` ,
335+ env : {
336+ PATH : `\${command:${ extensionName } .${ GET_GIT_PATH } }:\${env:PATH}:` ,
337+ } ,
334338 } ,
335339 windows : {
336340 options : {
341+ env : {
342+ Path : `\${command:${ extensionName } .${ GET_GIT_PATH } };\${env:Path};` ,
343+ } ,
337344 shell : {
338345 executable : "cmd.exe" ,
339346 args : [ "/d" , "/c" ] ,
@@ -365,6 +372,8 @@ async function generateVSCodeConfig(
365372 panel : "dedicated" ,
366373 } ,
367374 problemMatcher : [ ] ,
375+ dependsOrder : "sequence" ,
376+ dependsOn : "Compile Project" ,
368377 } ,
369378 ] ,
370379 } ;
@@ -1170,8 +1179,7 @@ export async function generateZephyrProject(
11701179 latestVb : [ string , VersionBundle ] ,
11711180 ninjaPath : string ,
11721181 cmakePath : string ,
1173- data : ZephyrSubmitMessageValue ,
1174- gitPath : string
1182+ data : ZephyrSubmitMessageValue
11751183) : Promise < boolean > {
11761184 const projectRoot = join ( projectFolder , projectName ) ;
11771185
@@ -1245,8 +1253,7 @@ export async function generateZephyrProject(
12451253 ninjaPath ,
12461254 cmakePath ,
12471255 te ,
1248- data ,
1249- gitPath
1256+ data
12501257 ) ;
12511258 if ( ! result ) {
12521259 Logger . debug (
0 commit comments