Bug in the js code editor: brackets correctly ignored in /* */ comments but not in // comments

The js code editor has a great feature which highlights corresponding brackets {()}

If a comment section // contains brackets, they are - correctly - ignored in the bracket analysis.

However, if a single line comment is used with //, then brackets contained in the comment are - incorrectly - accounted for in the bracket analysis.

For instance, this code

function test(){
    alert("test");
    /* this bracket is ignored correctly: } */
}

highlights the function brackets {} correctly, while this code:

function test(){
    alert("test");
    // this bracket is - incorrectly - NOT ignored : }
}

highlights the bracket } in the comment line as closing bracket of the function.

Regards, Mikael

Hi Mikael,

It is working correctly on my test site. Can you share a page url where this issue happens so we can investigate further?

Hi Lely,

thank you for getting back to me.

Please log into https://alimaarden.live-website.com/ and look at Footer “Test Footer”. There I pasted the test code into the js page. See login credentials in my secure note below.

This is how it looks for me:

When cursor is at last closing bracket, it is shown in red because editor thinks it is without corresponding opening bracket:

When cursor is at opening bracket in the second test function, it shows the closing bracket in the comment line as corresponding closing bracket:

Hi Mikael,

Thanks for pointing it out. The code is actually still read as a comment which is working correctly it’s just that the using the single line comment does not get the same formatting in the code editor.

I have already added this to our issue tracker so that our developers will be aware of it.

Thank you.

Hi Jade,

thank you!

Bets regards, Mikael

You are most welcome!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.