-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy activation for most commands, jres view #150
base: main
Are you sure you want to change the base?
Changes from all commits
2c80b2b
d8b2ab3
b793807
265c762
bc3da04
a7da5af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,7 @@ | |
"url": "https://github.com/microsoft/vscode-makecode" | ||
}, | ||
"activationEvents": [ | ||
"onCommand:makecode.create", | ||
"workspaceContains:./pxt.json", | ||
"workspaceContains:**/pxt.json", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
"onFileSystem:mkcdfs" | ||
], | ||
"browser": "./dist/web/extension.js", | ||
|
@@ -179,27 +178,32 @@ | |
{ | ||
"id": "imageExplorer", | ||
"name": "%makecode.imageExplorer.title%", | ||
"icon": "media/logo.svg" | ||
"icon": "media/logo.svg", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"id": "animationExplorer", | ||
"name": "%makecode.animationExplorer.title%", | ||
"icon": "media/logo.svg" | ||
"icon": "media/logo.svg", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"id": "tileExplorer", | ||
"name": "%makecode.tileExplorer.title%", | ||
"icon": "media/logo.svg" | ||
"icon": "media/logo.svg", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"id": "tilemapExplorer", | ||
"name": "%makecode.tilemapExplorer.title%", | ||
"icon": "media/logo.svg" | ||
"icon": "media/logo.svg", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"id": "songExplorer", | ||
"name": "%makecode.songExplorer.title%", | ||
"icon": "media/logo.svg" | ||
"icon": "media/logo.svg", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
} | ||
] | ||
}, | ||
|
@@ -211,9 +215,9 @@ | |
"menus": { | ||
"editor/context": [ | ||
{ | ||
"when": "resourceLangId == typescript && makecode.extensionActive", | ||
"when": "resourceLangId == typescript && makecode.extensionActive && makecode.hasMakeCodeProjectOpen", | ||
"command": "makecode.simulate", | ||
"group": "navigation" | ||
"group": "debug" | ||
} | ||
], | ||
"view/title": [ | ||
|
@@ -288,6 +292,38 @@ | |
{ | ||
"command": "makecode.createTilemap", | ||
"when": "false" | ||
}, | ||
{ | ||
"command": "makecode.build", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.simulate", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.clean", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.shareProject", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.addDependency", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.removeDependency", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.refreshAssets", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
}, | ||
{ | ||
"command": "makecode.testBlocks", | ||
"when": "makecode.hasMakeCodeProjectOpen" | ||
} | ||
] | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.