-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Open
Description
Describe the bug
In the JavaScript (JS) mode of Ace Editor, declaring static class properties (fields) causes a syntax highlighting and error detection issue. The editor incorrectly flags the static property declaration as a syntax error, even though it is valid JavaScript syntax (part of ECMAScript 2022 / ES13).
Expected Behavior
The static class property declaration (static myStaticField = 'initial value';) should be recognized as valid syntax and should not be highlighted as an error.
Current Behavior
The line containing the static class property declaration is highlighted with an error marker, indicating a syntax error.
Reproduction Steps
- Open Ace Editor.
- Set the mode to
ace/mode/javascript. - Enter the following code snippet:
class Example {
static myStaticField = 'initial value'; // --> Warning: Class properties must be methods. Expected '(' but instead saw '='.
constructor() {
console.log(Example.myStaticField);
}
}
const instance = new Example();Possible Solution
No response
Additional Information/Context
No response
Ace Version / Browser / OS / Keyboard layout
1.39.1 / any / any