mikaeljorhult / brackets-todo

Brackets/Edge Code extension that displays all TODO comments in current document or project.
144 stars 37 forks source link

Recognize multiline-comments #68

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello,

at prebuild code (e.g. WordPress themes) I like to comment out parts of the code and mark this as CHANGES.

<!-- CHANGES: logo commented out
  <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    <img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" />
  </a>
-->

The extension doesn't recognize the comment. Only

<!-- CHANGES: logo commented out -->

this one. My .todo file:

{
    "regex": {
        "prefix": "(?:<!--) *(",
        "suffix": "):? *(.*?) ?(?=-->)"
    }
}

Is it possible to fix this? I don't know enough about regex.

mikaeljorhult commented 10 years ago

The following .todo file will recognize your multiline HTML comments.

{
    "regex": {
        "prefix": "(?:<!--) *(",
        "suffix": "):? *([\\s\\S]*?) ?(?=-->)"
    }
}

Please note that multiline comments isn't recognized by default they might display a bit funky in the panel as line breaks aren't preserved. I hope it will still solve your use case.

ghost commented 10 years ago

It works! Thank you.

mikaeljorhult commented 10 years ago

Great! Glad I could help.