Apex Intention Actions: The Next Frontier for Apex Completions
Idea from IDEa
Recently, I needed to code a little tool in Java. The last time I coded something in Java was in high school, so it was a nice exercise for me to dust off my Java and get back up to speed on learning some new stuff, too. I used IntelliJ IDEa this time and found their so-called “intention actions” or “bulb actions” quite helpful. After coming back to developing in Salesforce I really missed some of them, because they really sped up my work. This lead me to take a look at Sublime’s Package Control, and when I found nothing similar there, I decided that maybe I’m not the only one who’d like to have those.
What are my intentions?
I thought – which actions do I do most often, and hence are good candidates for automation? I came up with this list:
– Add getter
– Add setter
– Add both getter and setter
– Add constructor parameter
– Add class constructor
– Add init method and call in each constructor
– Add 0-arg constructor and init method
– Add method overload
These are basic actions that you can do quickly with “Apex Intention Actions”.
How this works
The plugin analyses the first string you have your cursor on and suggests actions you can do quickly with it. It’s not automatic, so you need to call the plugin by tapping a hotkey.
You can also use hotkeys for all of the actions.
The plugin is maintained, though I plan to migrate to VS Code for Salesforce development. So, soon Apex intention Actions will run on VS Code! 🙂
The project also has a wiki, so you can find more info there.