Closed
Description
Private fields (https://v8.dev/features/class-fields) use a #
at the start of the field declaration in a class. CodeMirror currently doesn't highlight these private fields as fields and its syntax highlighting marks the whole line as red. Example
class Project {
#id;
constructor(name) {
this.name = name;
this.#id = Math.random();
}
get id() {
return this.#id;
}
#setId(id) {
this.#id = id;
}
aMethod() {}
static fromStore(id, name) {
const proj = new Project(name);
proj.#setId(id);
proj.aMethod();
return proj;
}
}
Current syntax highlighting:
(Code was pasted on https://codemirror.net/mode/javascript/index.html)
The expected syntax highlighting here is that private fields have the same color as normal fields (e.g. name
in this example).
Downstream issue: https://bugs.chromium.org/p/chromium/issues/detail?id=1073903
Metadata
Metadata
Assignees
Labels
No labels