vscode
vscode copied to clipboard
Under "Runtime Status" also report activation reason/context
Request
Under Runtime Status, please add a section which says why an extension was activated.
It would be even better if it could include context around it:
- Which activation event triggered the activation of the extension?
- When was the extension activated?
- How many contributions of the extension were used since activation?
Motivation
I use Visual Studio Code for almost all development that I do, across all stacks, languages, frameworks, etc. As a result, I end up installing a lot of extensions.
I've noticed that Visual Studio Code is slowly using a lot of resources on my system. Closing or restarting VSC can save me upwards of 10-20 GB of RAM. (Of the total 64 GB on my system.)
One of the problems stems from extensions activating when I'm not working on projects that require that extension, and I'm not sure why they're activating in the first place. 🤔
I'd really like to have more information here, so we can propose different activation events to extension developers, so they don't trigger when they are not required.
My Specific Scenario

Here is an extension that is using 1.325 GB of RAM alone.

The workspace I have open has no *.java, *.xml, or *.properties files, I'm not executing the command vscode-spring-boot.rewrite.list, and doesn't have Spring YAML files that match the filenamePatterns array.
"languages": [
{
"id": "spring-boot-properties-yaml",
"aliases": [
"Spring Boot Properties Yaml"
],
"filenamePatterns": [
"application*.yml",
"application*.yaml",
"bootstrap*.yml",
"bootstrap*.yaml"
],
"configuration": "./yaml-support/language-configuration.json"
},
{
"id": "spring-boot-properties",
"aliases": [
"Spring Boot Properties"
],
"filenamePatterns": [
"application*.properties",
"bootstrap*.properties"
],
"configuration": "./properties-support/language-configuration.json"
}
]
— https://github.com/spring-projects/sts4/blob/main/vscode-extensions/vscode-spring-boot/package.json
Now I probably am triggering one of these activation events, but I have no idea why, when, and which one. (As a mere human, I really don't think I'm triggering any of them. But when I open certain projects, the extension activates before I've opened any files in the workspace.)
@alexdima May I know if this info requested by the user is available to display?
Yes, this is available in IExtensionsStatus.activationTimes.activationReason:
export interface ExtensionActivationReason {
readonly startup: boolean;
readonly extensionId: ExtensionIdentifier;
readonly activationEvent: string;
}
