prettier-plugin-apex
prettier-plugin-apex copied to clipboard
Selective Formatting not working
# Prettier options (if any):
Default
**Input:**
cls file - Selected Text
```apex
// code snippet
```errorList.addAll(validateField(contact.FirstName, objectName, 'First Name', 0));
**Actual output:**
```errorList.addAll(validateField(contact.FirstName, objectName, 'First Name', 0));
```apex
// code snippet
Expected output:
validateField(contact.FirstName, objectName, 'First Name', 0)
);
```apex
// code snippet
Additional information (please fill this out):
- OS: [e.g. Windows/OS X/Ubuntu]
- Version: [e.g. 1.0.0] mac 10.14.6
Hi, thank you for submitting your issue. Currently there are some issues with formatting in your post, so I can't really tell what is not working right. Could you reformat it, or describe it in some way?
Sorry, the issue is if I try to Format the complete file the formatting works, But it does not work with Selective text. Example : I select a block of code
errorList.addAll(validateField(contact.FirstName, objectName, 'First Name', 0));
Nothing happens and I get an error in the VS Code status bar as Extension Prettier cannot format the file.
Does this help ?
Oh I see, thank you for the explanation, that helps a lot. I think this is actually a feature request for Range Formatting support by this plugin. I will take a look at this soon.
I have looked into this, and unfortunately Prettier does not allow its plugins to do this at the moment. I have opened an issue upstream here, and when that is resolved I will make sure prettier-plugin-apex
supports it.