+ Start a Discussion
Sam Mohyee 12Sam Mohyee 12 

SFDX in Visual Studio Code has no formatter for Apex files?

When using Visual Studio code, you should be able to hit [SHIFT] + [ALT] + [F] in Windows to auto-format a file. I'm mainly interested in auto-indentation, like what is available in the Dev Console with [SHIFT] + [TAB].

Doing so on an apex file returns the error: There is no formatter for 'apex'-files installed.

Anyone know a solution to this? I'm currently looking into installing an extension to provide Java formatting support, and extending its file types to include .apex files. 
Best Answer chosen by Sam Mohyee 12
Raj VakatiRaj Vakati
Are you using Apex Code Editor for Visual Studio Code Plugn in ??

Unfortunaly no ... VS Code does work to format Apex whilst this is being sorted out


https://github.com/forcedotcom/salesforcedx-vscode/issues/95

All Answers

Raj VakatiRaj Vakati
Are you using Apex Code Editor for Visual Studio Code Plugn in ??

Unfortunaly no ... VS Code does work to format Apex whilst this is being sorted out


https://github.com/forcedotcom/salesforcedx-vscode/issues/95
This was selected as the best answer
Sam Mohyee 12Sam Mohyee 12
Yes I am, per the SFDX recommended setup. The github issue you link to has a comment recommending the Uncrustify extension. I haven't given this a try but if anyone has any feedback on how well it works, would love to hear it!
Pasquale NapolitanoPasquale Napolitano
Here there is a guide to how to indent Apex in Visual Studio Code https://mrwolf.altervista.org/how-to-indent-apex-code-in-visual-studio-code/
The linked guide explains how to proceed step by step to indent apex code using the shortcut CTRL + ALT + F in Visual Studio Code