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> {
176
176
177
177
const workspaceFolder = workspace . workspaceFolders ?. [ 0 ] ;
178
178
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 ) {
184
181
// finish activation
185
182
Logger . warn (
186
183
LoggerSource . extension ,
187
- "No workspace folder or Pico project found."
184
+ "No workspace folder found."
188
185
) ;
189
186
await commands . executeCommand (
190
187
"setContext" ,
@@ -210,6 +207,25 @@ export async function activate(context: ExtensionContext): Promise<void> {
210
207
return ;
211
208
}
212
209
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
+
213
229
// check if it has .vscode folder and cmake donotedit header in CMakelists.txt
214
230
if (
215
231
! existsSync ( join ( workspaceFolder . uri . fsPath , ".vscode" ) ) ||
You can’t perform that action at this time.
0 commit comments