File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -176,15 +176,12 @@ export async function activate(context: ExtensionContext): Promise<void> {
176176
177177 const workspaceFolder = workspace . workspaceFolders ?. [ 0 ] ;
178178
179- // check if is a pico project
180- if (
181- workspaceFolder === undefined ||
182- ! existsSync ( join ( workspaceFolder . uri . fsPath , "pico_sdk_import.cmake" ) )
183- ) {
179+ // check if there is a workspace folder
180+ if ( workspaceFolder === undefined ) {
184181 // finish activation
185182 Logger . warn (
186183 LoggerSource . extension ,
187- "No workspace folder or Pico project found."
184+ "No workspace folder found."
188185 ) ;
189186 await commands . executeCommand (
190187 "setContext" ,
@@ -210,6 +207,25 @@ export async function activate(context: ExtensionContext): Promise<void> {
210207 return ;
211208 }
212209
210+ // check for pico_sdk_init() in CMakeLists.txt
211+ if (
212+ ! readFileSync ( cmakeListsFilePath )
213+ . toString ( "utf-8" )
214+ . includes ( "pico_sdk_init()" )
215+ ) {
216+ Logger . warn (
217+ LoggerSource . extension ,
218+ "No pico_sdk_init() in CMakeLists.txt found."
219+ ) ;
220+ await commands . executeCommand (
221+ "setContext" ,
222+ ContextKeys . isPicoProject ,
223+ false
224+ ) ;
225+
226+ return ;
227+ }
228+
213229 // check if it has .vscode folder and cmake donotedit header in CMakelists.txt
214230 if (
215231 ! existsSync ( join ( workspaceFolder . uri . fsPath , ".vscode" ) ) ||
You can’t perform that action at this time.
0 commit comments