Menu

#2219 LexHTML - block comments break code folding in embedded JavaScript

Bug
closed-fixed
nobody
5
2022-05-22
2020-10-21
No

Report from: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5581 . Also apply to latest SciTE.
Code folding gets confused upon seeing block comments (/** … */) in embedded JavaScript.

Code for test:

<div>

    <script>

        /**
        */

    </script>

</div>

<p></p>

When we set fold.hypertext.comment=1 then using /** as opennig block comment will break folding. For above example it happend to block comment and also for script and div tags. If we start comment only with /* (or add space /* *) folding works fine.
https://sourceforge.net/p/scintilla/code/ci/default/tree/lexers/LexHTML.cxx#l642

Discussion

  • Neil Hodgson

    Neil Hodgson - 2020-10-25
    • labels: --> lexilla, html, javascript
    • status: open --> open-accepted
     
  • Neil Hodgson

    Neil Hodgson - 2020-10-25

    It is checking only for SCE_HJ_COMMENT, not for SCE_HJ_COMMENTDOC which this is due to the "/**".

     
  • Zufu Liu

    Zufu Liu - 2022-04-06

    This can be fixed by updating line 1236 of LexHTML.cxx.

    - } else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT)) && foldComment && (ch == '*') && (chNext == '/')) {
    + } else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTDOC)) && foldComment && (ch == '*') && (chNext == '/')) {
    
     
  • Neil Hodgson

    Neil Hodgson - 2022-04-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Report from: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5581. Also apply to latest SciTE.
    +Report from: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5581 . Also apply to latest SciTE.
     Code folding gets confused upon seeing block comments (`/** … */`) in embedded JavaScript.
    
     Code for test:
    
    • status: open-accepted --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2022-05-22
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.