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

Option to not format comments. #29

Closed
renkejr-pkwy opened this issue Jun 21, 2019 · 4 comments
Closed

Option to not format comments. #29

renkejr-pkwy opened this issue Jun 21, 2019 · 4 comments

Comments

@renkejr-pkwy
Copy link

The formatter currently strips all leading and trailing white space and then indents.

/**
 * Description
 *
 * @param Some parameter info
 */

is now

/**
* Description
*
* @param Some parameter info
*/

Unfortunately, this breaks my doc-block extension since it is expecting an extra space after the indent.

@jcberquist
Copy link
Owner

Thanks for raising the issue. If and how to format comments is something I have been unsure about. So it is helpful to see this issue - may I ask what doc-block extension you use? I wonder if I should just switch doc comments to be formatted the way you have, make it an option, or just leave them untouched.

@renkejr-pkwy
Copy link
Author

The extension is Document This. I tried a couple of other extension as well. The extensions all work until the document gets reformatted. I then have to add the extra leading space or delete the comment if I want make any changes.

Not a big deal but, in general, I'd prefer comments don't get reformatted anyway.

@jcberquist
Copy link
Owner

I have been working on this. I took a look at what prettier does with JS files and it looks to me like it renders block comments as is, unless every line starts with a *, in which case it aligns the lines on the *'s. So my current plan is to create a new settings for this sort of alignment: https://github.com/jcberquist/commandbox-cfformat/blob/master/reference.md#commentasterisks

By default it will copy prettier and align all lines on the *, but you can disable this if you want. Absent the leading asterisks, comments should be renderered as is without being reformatted.

@jcberquist
Copy link
Owner

This is now out in v0.10.0. Note: in order to convince CommandBox to update to that version you will either need to uninstall and then reinstall - or explicitly install that version. @bdw429s pointed out to me that with semver minor version bumps with a major version of 0 are treated as major version updates and so are not automatic upgrades.

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