Etsi0 / class-collapse

This powerful extension lets you collapse any code segment using custom regex patterns. Simplify your coding view, enhancing readability and focus.
https://marketplace.visualstudio.com/items?itemName=Etsi0.class-collapse
MIT License
8 stars 0 forks source link

Collapsing documentation comments in PHP file #11

Closed B-Yasmina closed 3 months ago

B-Yasmina commented 3 months ago

php is listed as a supported language in class-collapse.supportedLanguages, however, I can't seem to make it work for documentation comment lines.

I'd like to turn

    /**
    * Function description
    * @param type var desc
    * @return type desc
    */

into

    /**...doc...*/

Is there something wrong in my settings?

    "class-collapse.regex": "(^ *\\/\\*\\*)([^!][.\\s\\t\\S\\n\\r]*?)(\\*\\/)",
    "class-collapse.collapsedText": "...doc...",
    "class-collapse.regexGroups": [
        2
    ],
    "class-collapse.supportedLanguages": [
        "html",
        "javascript",
        "markdown",
        "php"
    ],
    "class-collapse.classCollapseToggle": true

Or is it simply not possible with this extension ?

Thank you in advance.

Etsi0 commented 3 months ago

Hello,

Here is a regex that should work: regex101.com. Additionally, here is a visualization of the regex: regex-vis.com.

Thank you for using Class Collapse and I hope you have a good rest of your day or night. // Albin

B-Yasmina commented 3 months ago

That indeed solved it, thank you.

However, is it intentional that all lines haven't really collapsed? The text has been replaced, not the \n.

/**...doc...

*/
Etsi0 commented 3 months ago

Hello again, As far as i know it's not possible to remove lines :/