Using Prettier with Apex Salesforce in VSCode – User friendly Tech help
Prerequisite:- VSCode is fully configured to work with Salesforce
n
- n
- Select the existing Salesforce Project. At the root level run the below command in the Terminaln
npm init //this will create package.json file to track npm dependencies
n
Run the below code to install the prettier apex npm plugin, as a local dependency to the project.
n
- Note:- Same could have been done globally.n
npm install --save-dev --save-exact prettier prettier-plugin-apex
- Install the prettier extension, it will create a .prettierrc file under the root of SF project
- Open apex file (.cls), Cmd+Shift+P > Format document.
n
n
n
n