An extension runs only once something wakes it. The
activationEvents array in package.json lists what does. Each
event is a string, most of them a name, a colon and an argument, such as
onLanguage:python.
Events
| Event | Fires when |
|---|---|
onAuthenticationRequest:id | An extension asks for a session from this authentication provider. |
onChatParticipant:id | This chat participant is invoked. Deprecated. |
onCommand:command | The command is invoked. |
onCustomEditor:viewType | VS Code needs a custom editor with this view type. |
onDebug | Before a debug session starts. |
onDebugAdapterProtocolTracker | A debug session of a given type is about to launch and a protocol tracker may be needed. |
onDebugDynamicConfigurations | Just before dynamic debug configurations are provided. |
onDebugInitialConfigurations | Just before initial debug configurations are provided, such as when launch.json is created. |
onDebugResolve:type | Just before a debug configuration of this type is resolved. |
onEditSession:scheme | An edit session is opened with this scheme. |
onFileSystem:scheme | A file or folder from this scheme is read. |
onIssueReporterOpened | The issue reporter is opened. |
onLanguage:language | A file in this language is opened. Plain onLanguage fires before any language is used. |
onLanguageModelTool:tool | The language model tool is invoked. |
onNotebook:type | A notebook of this type is opened. |
onOpenExternalUri | An external address, such as an http or https link, is being opened. |
onRenderer:renderer | A notebook output renderer is used. |
onSearch:scheme | A search starts in a folder with this scheme. |
onStartupFinished | Some time after start-up, once the * extensions have finished activating. |
onTaskType:type | Tasks of this type need to be listed or resolved. |
onTerminal:shell | A terminal with this shell type is opened. |
onTerminalProfile:profile | This terminal profile is launched. |
onTerminalShellIntegration:shell | Shell integration activates in a terminal of this shell type. |
onUri | A system-wide address for the extension is opened. The scheme is vscode or vscode-insiders, the authority the extension’s ID. |
onView:id | A view with this ID is expanded in the sidebar. |
onWalkthrough:id | The walkthrough is opened. |
onWebviewPanel:viewType | VS Code needs to restore a webview with this view type. |
workspaceContains:pattern | A folder is opened that holds at least one file matching the glob pattern. |
* | VS Code starts. The documentation advises this only when nothing else will do. |
Automatic activation
Some contributions no longer need a matching event in the list. From VS Code 1.74.0
commands, languages, views, custom editors and authentication providers activate the
extension by themselves; from 1.76.0 so do tasks. So an extension’s
activationEvents can be short or missing and it can still start.