Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting Support using native VSCode shortcut #2285

Closed
ghost opened this issue Jun 23, 2020 · 4 comments
Closed

Formatting Support using native VSCode shortcut #2285

ghost opened this issue Jun 23, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 23, 2020

Is your feature request related to a problem? Please describe.

VSCode offers a formatting hook for extension authors to write a method to format files, but this isn't implemented in the SFDX packages.

Describe the solution you'd like

Ideally the solution would match the formatting pattern in the developer console.

Describe alternatives you've considered

There are alternatives via other extensions, such as uncrustify or prettier, but those are additional plugins that require set up time.

Additional context

There is a stackexchange question from nearly two years ago, about the lack of this feature, but with the latest updates, you still get the same "cannot format" message when you use the shortcut. I'm hoping this request brings more attention to this missing feature - since I didn't find any other requests when I did a quick search in the repo.

https://salesforce.stackexchange.com/questions/212382/format-apex-code-visual-studio-code/212571

@lcampos
Copy link
Contributor

lcampos commented Jun 24, 2020

Hi @seanh-massmep thanks for providing feedback. For Apex, we decided to partner with a Salesforce community member and go the route of having formatting through prettier. This is in line with the rest of the formatting options we offer which are also done through prettier.

Here's more info on it Prettier Code Formatter. cc @smaddox-sf

@ghost
Copy link
Author

ghost commented Jun 24, 2020

Thanks for the response! I'll make sure this information is included in the answers there.

@ghost
Copy link
Author

ghost commented Jun 24, 2020

Could a version of Prettier come installed with the apex extension package instead?

@smaddox-sf
Copy link
Contributor

We don't plan to ship Prettier by default, but do include it in our recommended extensions. While Prettier is quite popular, some like to use other code formatters, so we leave you the choice rather than pushing an install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants