Update Extension Anatomy with activation events note

This commit is contained in:
DehanLUO 2024-11-17 08:41:03 -05:00
Родитель e32a849597
Коммит 37e4fa5ae3
1 изменённых файлов: 1 добавлений и 0 удалений

Просмотреть файл

@ -14,6 +14,7 @@ In the last topic, you were able to get a basic extension running. How does it w
The `Hello World` extension does 3 things:
- Registers the [`onCommand`](/api/references/activation-events#onCommand) [**Activation Event**](/api/references/activation-events): `onCommand:helloworld.helloWorld`, so the extension becomes activated when user runs the `Hello World` command.
> **Note:** Starting with [VS Code 1.74.0](https://code.visualstudio.com/updates/v1_74#_implicit-activation-events-for-declared-extension-contributions), commands declared in the `commands` section of `package.json` automatically activate the extension when invoked, without requiring an explicit `onCommand` entry in `activationEvents`.
- Uses the [`contributes.commands`](/api/references/contribution-points#contributes.commands) [**Contribution Point**](/api/references/contribution-points) to make the command `Hello World` available in the Command Palette, and bind it to a command ID `helloworld.helloWorld`.
- Uses the [`commands.registerCommand`](/api/references/vscode-api#commands.registerCommand) [**VS Code API**](/api/references/vscode-api) to bind a function to the registered command ID `helloworld.helloWorld`.