Open Savacken opened 3 years ago
A little more experimenting and I found that the trailing comma is key to the problem. However, trailing commas are used elsewhere without issue, so it appears specifically to be the trailing comma paired with the spread operator.
Prerequisites
Debug -> Reload Without Extensions
?Description
Depending on how / where it's used, the spread operator in js files seems to break Brackets' ability to correctly interpret syntax.
Steps to Reproduce
If you paste that in notice the syntax highlighting in the lines after the spread operator. If you type it in, the
console.log
line indents after the line break as if something above it is malformed.With some experimenting I found that if the entire z declaration is on a single line,
let z = { ...x };
then things seem to be okay. You can also get it to be kind of okay on a multiline declaration if a property follows the spread operator's inclusion; i.e.By "kind of" I mean that the highlighting of the
console.log
line seems okay, but the highlighting of thea
property is still a little off.ESLint isn't having a problem with the code that Brackets doesn't recognize.
Expected behavior: [What you expected to happen] Brackets to correctly highlight / recognize code following valid use of a spread operator.
Actual behavior: [What actually happened] See description above in how to reproduce, but a simple recap, depending on how the spread operator is used Brackets seems to not recognize the syntax.
Versions
Behaves the same in both Brackets 14.1 and 14.2.
MacOS 10.15.7