How to configured to allow this type of comments by autoformater?

Hello, I use 2 comment styles

1st:

//comment 
actual code
code continues
code continues even more

2nd:

// comment
actual code with indent
code continues
code continues even more
// --

1st variant allows me to comment on particular lines or small fragments

2nd variant allows me to easily fold bigger pieces

The problem however is that PHPStorm autoformatter does not allow me to have 2nd variant. And no, i do not want to disable autoformatter, since it does a lot of good things. Maybe there's a way to configure it so it allows such 2nd variant? Thank you!

0
4 comments

Hi there,

Maybe there's a way to configure it so it allows such 2nd variant? Thank you!

AFAIK no. And possibly for good (it better be persistent).

 

2nd variant allows me to easily fold bigger pieces

Have you tried using special folding comments in the first place? https://www.jetbrains.com/help/phpstorm/surrounding-blocks-of-code-with-language-constructs.html (at the end).

(you can omit optional bits, like defaultstate)

//<editor-fold defaultstate="collapsed" desc="Your custom description">
... actual code here
//</editor-fold>

or these (more closer to your example):

//region Description
... code here
//endregion
1

Hmm, not bad, i like the <editor-fold> thing, however - seems i have to type it each time, it doesn't offer autocompletion. How so?

0

seems i have to type it each time, it doesn't offer autocompletion. How so?

It's just a comment -- plain text.

P.S. If you check the link in my previous comment, there at the end is a screenshot that show how to use "Code | Surround With" to surround selected lines with such folding comments.

0

Yep, wonderful, that will do! :) Thank you so much !:)

0

Please sign in to leave a comment.