Formatting
VS Code has great support for source code formatting. You can invoke the formatting commands from the Command Palette (Ctrl+Shift+P) or the editor context menu.
The Puppet VS Code extension supports; Format the line while typing and Format a file on save.
Format While You Type
Information
This feature is disabled by default, both by VS Code and the Puppet Extension. It can be enabled using the
puppet.editorService.formatOnType.enable
andeditor.formatOnType
settingsFormatting will not occur on large documents (> 4KB) or when using tabs for indentation
Hash Rocket Alignment
Automatically align hash rockets (also known as arrows or fat commas) when typing. The alignment happens with you type >
.
Format Document
The Format Document
(Shift+Alt+F
or ⇧⌥F) command automatically fixes any linting errors using the equivalent of puppet-lint --fix
. See the puppet-lint documentation for information about the available checks.
Information
- This feature is enabled by default and can be disabled using the
puppet.format.enable
setting
Format on Save
VS Code can automatically apply any formatting fixes every time you save the document. You can enable this feature with the editor.formatOnSave
setting.