Hacker News new | past | comments | ask | show | jobs | submit login

I've seen this plugin trend on Salesforce Twitter. Can you summarise what does it do that beautify with simple config or Illuminated Cloud 2 formatter cannot do?



Here are a few things that set it apart:

- It is opinionated so teams no longer have to debate about coding styles. It is a refreshing change once you get used to that mindset. IC2 formatter has many configurations that developers can tweak, but that means you as a team need to debate within yourself which one(s) to configure.

- It is a CLI tool. That means you can do things like: run it as a linting tool on every commit to enforce coding styles, run it as a pre-commit hook, auto format files when you save in your IDE, etc. IC2 is closed source, and as far as I know there's no easy way to run it in a headless way.

- It is free.

- It is open source and has been tested on millions of lines of code. If you're using an open source Apex library, chances are it's part of the integration test suite, see [0]

- It is written specifically for Apex/SOQL/SOSL. That means it knows the context of your code and can format based on that. Tools like Uncrustify technically do work on Apex code, but it is being parsed as a generic C-like syntax so a lot of things do not work right (especially when Apex moves farther away from being Java-like).

- It is blessed by Salesforce, and their official IDE (VSCode) will soon adopt Prettier as the formatting tool of choice.

Those are just a few reasons. Prettier has a dedicated page [1] for everything else that also applies to this project.

[0] - https://github.com/dangmai/prettier-plugin-apex/blob/master/...

[1] - https://prettier.io/docs/en/why-prettier.html




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: