Extension directory name

The directory name of the extension is the unique ID of the extension, and cannot conflict with other extension. The name can only use English words and does not support separation by spaces.

package.json

All extensions must have a package.json file in the root directory, which inherits the npm specification and extends some fields. The meaning of each field is listed below:

The meaning of each field is listed below:

Field Type Required Description
name String True Extension name
displayName String True Used to display the name in the extension list
version String True The extension version number, which will be used when checking the upgrade
engines Object True The attribute must contain at least HBuilderX, and the attribute value is a compatible major version number. If the version of HBuilderX is lower than this version, the user will be prompted to upgrade HBuilderX. For example: {“HBuilderX”:”^2.7.0”}.
description String True A short description of the extension, the recommended length is less than 30
main String False Extension code entry file, configuration type extension can be left blank
activationEvents Array False activation events list. If it is empty, it means that the extension will not load lazily
contributes Object False Configuration extension point
extensionDependencies Array False The id of other extensions that this extension depends on

Example

  1. {
  2. "name": "helloworld",
  3. "displayName":"Simple Extension Example",
  4. "description": "Simple extension example for testing extension API",
  5. "version": "1.0.0",
  6. "publisher": "coder",
  7. "engines": {
  8. "HBuilderX": "^2.7.0"
  9. },
  10. "categories": [
  11. "Other"
  12. ],
  13. "main": "./extension",
  14. "activationEvents": [
  15. "onCommand:extension.helloWorld",
  16. "onView:extensions.treedemo"
  17. ],
  18. "contributes": {},
  19. "extensionDependencies": [
  20. "foo1","bar1"
  21. ],
  22. "dependencies": {}
  23. }