Composer manual

osp-composer is a VScode plugin providing guidance to configure OnSphere. Usage of the composer is not mandatory but strongly recommended.

The installation guide will help you getting started with the composer.

Index

Type

Functionality

link

Commands

patch to version

see documentation

Commands

copy onsphere path

see documentation

Commands

goto ItemId

see documentation

Template playbook execute.all

template.playbook.execute.all

see documentation

Template playbook execute

template.playbook.execute

see documentation

Template playbook clean

template.playbook.clean

see documentation

Tools

Template previewer

see documentation

Facility - Language server

Validation of json configuration files from schema

N.A.

Facility - Language server

Autocompletion of ItemId

see documentation

Facility

clickable link on ItemId

see documentation

Facility

Displayed documentation

The current documentation is displayed when the mouse is over a keyword

Facility - File autogenerated are read-only

Block manual edition of template generated files.

N.A.

Commands

Note

To launch the command palette, you can use either of the following :

  • Press ctrl + shift + p

  • Open the menu view then command palette

Copy onsphere path

References for the configuration are separated by ., the composer gives you a contextual option to copy them :

../../_images/copy-osp-path.png

Patch from older configuration

When a new version of OnSphere is released, patches are created to upgrade the configuration. To apply them :

  1. Open the configuration

  2. Launch the command palette

  3. Apply patch and select the patch to apply

Patches must be applied in the right order (1.1.0 then 1.1.1 and so on).

../../_images/osp-patch.png

Goto

This command allows navigating to a file from its OnSphere ID.

  1. Launch the command palette

  2. Type goto

  3. Select the id with . separation example example root.test

There are 3 behaviors on this command :

  • Shows an error if the id is incorrect or doesn’t exist

  • Opens the file if there is only one inside the folder

  • Shows a quick selection of files if there are more than one

../../_images/osp-goto.png

Templates execute all

This command execute all templates playbooks. Based on all the files present inside the folder /templates/playbooks/*.json.

Note

This command execute a template cleaning before refreshing templates.

  1. Launch the command palette

  2. Type template.playbook.execute.all

  3. Press enter

See the usage for detail about the feature himself

Template playbook execute

This command execute a template playbook. The list is automatically generated based on the contains of the file /templates/playbooks/*.json,

  1. Launch the command palette

  2. Type template.playbook.execute

  3. Select the playbook to execute

  4. Press enter

See the usage for detail about the feature himself

Template playbook clean

This command execute a template playbook cleanup. The list is automatically generated based on the contains of the file /templates/playbooks/*.json,

  1. Launch the command palette

  2. Type template.playbook.clean

  3. Select the playbook to execute

  4. Press enter

Warning

The cleanup function will clean all empty folders. Even if the folder is not auto-generated.

Facility

Autocompletion modules/root

The composer allows completion of modules and root path, triggered when either modules. or root. is entered.

Clickable osp-path

Osp-path are clickable and will focus the first file (by alphabetical order) inside the osp-path.

File auto-generation

When a file is completely empty, user automatically create a fake JSON object that match all requirements of json-schema. For example, if you create a file named value.ospp and you want to create a valid fake object, you can hit ctrl + space and it will create a random object that match requirement.

pic1 pic2

Tools

Template previewer

The composer provides a previewer for helping templates edition. The previewer can be enabled by the command osp: current file template preview. Its usage is described here

../../_images/osp-template-preview.png

The previewer open a dedicated windows displaying :

  • The preview of the result of the template process

  • The variables available from templates

  • The different sources used for generating the result with clickable link