Skip to content

Commit

Permalink
Limit extension activation
Browse files Browse the repository at this point in the history
Currently activation event is set to `*` which makes extension always active.
This results in extension always showing `Micromamba: Open a folder or a workspace` on startup
And extension will attempt to activate for every workspace even if it has no environment file consuming memory and CPU.

Extension packaging with `vcse` confirms this with the following warning:
```
 WARNING  Using '*' activation is usually a bad idea as it impacts performance.
More info: https://code.visualstudio.com/api/references/activation-events#Start-up
```

By limiting `activationEvents` to `workspaceContains:environment*.{yml,yaml}` extension will remain out of memory unless there is an environment file it can read to activate it. All the commands extension provides are still available and extension will be activate upon command execution:
```
2024-07-24 18:43:22.918 [info] ExtensionService#_doActivateExtension corker.vscode-micromamba, startup: false, activationEvent: 'onCommand:corker.micromamba.activate.environment.by.path'
```
  • Loading branch information
anton-matosov authored and corker committed Aug 6, 2024
1 parent 2d6386b commit 80922b5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"workspace"
],
"activationEvents": [
"*"
"workspaceContains:environment*.{yml,yaml}"
],
"contributes": {
"commands": [
Expand Down

0 comments on commit 80922b5

Please sign in to comment.