Conversation
| }, | ||
| "activationEvents": [ | ||
| "onCommand:makecode.create", | ||
| "workspaceContains:./pxt.json", |
There was a problem hiding this comment.
I'm not actually sure this is a valid glob pattern. Doesn't seem to work for me looking at a glob checker online. Might be why it was activating too much before.
There was a problem hiding this comment.
Yeah, I wasn't completely sure what was going on here, was planning on looking into it a bit more and possibly filing a bug; I tried the three variants of 'top level file checking' (workspaceContains:./pxt.json, workspaceContains:/pxt.json, workspaceContains:pxt.json) and saw the same behavior for each, and it seems like they should have worked (or at least the last one) as I see similar checks in other extensions activation events; e.g. https://github.com/microsoft/vscode-python/blob/main/package.json#L71-L77 (and if it's an invalid pattern I would think it would want to throw an error or default to false?)
That said, I did forget to mention that this still doesn't fully fix the issue as we still appear to be getting hit by the bug mentioned in #147 (comment) and activating early for that treason at times. (that's what I get for putting up a draft pr late on a friday) -- it does minimize it a bit though as fewer extra commands would show up.
| "activationEvents": [ | ||
| "onCommand:makecode.create", | ||
| "workspaceContains:./pxt.json", | ||
| "workspaceContains:**/pxt.json", |
There was a problem hiding this comment.
Would you still need makecode.create as an activation event here? From my (small) knowledge that command should still be an activation command options since you'd be running it with nothing but an empty workspace open.
There was a problem hiding this comment.
In vscode that line was giving a warning saying it was now unneeded and is taken as an activation event automatically since we define the command
There was a problem hiding this comment.
Nice. That used to be a common extension issue (forgetting to add a command activation) so that makes sense for core vscode to have added. Can't run a command if you are not activated.
probably can leave this one to merge in after our initial release to put in preview channel until we have more changes / things to release
workspaceContainswhen checking top level files (workspaceContains:./pxt.jsonorworkspaceContains:/pxt.jsonorworksapceContains:pxt.json), as it is firing off the activation event even when the folder is completely empty:but with
workspaceContains:**/pxt.jsonit's correctly firing off only when the file is present.when loading empty repo:
Then after 'create a new project' or loading in a folder that contains pxt.json they'll pop in as they are now: