Salesforce XML FormatterDescriptionThe main purpose of this extension is to provide a standard way to format and sort tags for metadata files (with extension ".xml" ) on Salesforce orgs. The tags inside the XMLs are sorted in a fixed order following Salesforce-specific set of rules. The final goal is to be able to work easily with git using a repository shared by multiples developers, minimizing the number of conflicts detected at the time of doing the merges. FeaturesThis is a formatter extension. It implements the Formatting API following the VS Code's guiding principles. The core benefit of using the extension API for implementing a formatter comes from the exposure of the Format Document and Format Selection actions. These actions are available in the editor context menu, bound to keyboard shortcuts, and visible in the Command Palette. InstallationInstall through VS Code extensions. Search for Salesforce XML Formatter It can also be installed in VS Code: Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Default FormatterTo ensure that this extension is used over other extensions you may have installed, be sure to set it as the default formatter in your VS Code settings.
Auto FormatYou can add the following line in your VS Code settings to automatically format all XML files on save.
How to use?You can use the Formatting actions of VS Code: Format Document and Format Selection; or just use the configuration showed above in the Auto Format section to format on save. Extension SettingsThis extension contributes the following settings:
Disable the formatterYou can add the following line in your VS Code settings to disable the formatter.
CommandsFormat directory commandFormat all XML files in a specific folder at once from the context menu. Open docs commandThere is a command to open the docs:
|