This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 162624 [details] Screencaps of current (incorrect) highlighting vs correct highlighting When an Object literal is used within an ES6 template literal, the syntax highlighting indicating the embedded expression (within placeholder delimiters “${…}”) incorrectly stops at the closing brace of the expression's Object literal — not at the closing brace of the expression's placeholder delimiters — with the rest of the expression highlighted as a String. Example: /** * @returns {String} source string with '<','>','&','"' replaced with their HTML/XML entities. */ 1: function h ( s ) 2: { 3: return s.replace(/[<>&"]/g, function(c){ 4: return `&${{'<':'lt','>':'gt','&':'amp','"':'quot'}[c]};`; 5: }); 6: } template literal in line #4: String syntax incorrectly resumes with the opening bracket at “[c];”, but String syntax should not resume until after the final closing curly bracket of the expression placeholder's delimiters (only the final “;” character should be highlighted as String syntax).
Just noticed: not just syntax highlighting — also syntax parsing. Causes mismatched brackets which create erroneous syntax errors later in code.
Created attachment 162625 [details] Screencap of mismatched brackets due to incorrect parsing
Umm… after editing the file a bit more, then undoing all the changes to go back to the state at which this error appeared, the example I provided is now parsing perfectly correctly. So uncertain now how to reproduce it.
I can not reproduce it as well now. Marking as works for me, please reopen, if you run in it again. Thanks.