Skip to content

[JavaScript] Nullish coalescing operator(??) breaks highlight #6394

@azu

Description

@azu

image

I've tested with following code in https://codemirror.net/demo/theme.html

function printWidgetTitle(widget) {
    const title = widget?.window?.title ?? "no name";
    console.log(`Title is ${title}`);
}
printWidgetTitle({
    window: {
        title: "Book Viewer"
    }
});

Notes

?. is ok. It was resolved by #6255

I tested || instead of ?? and It is valid syntax highlight.
So, I think that ?? break the syntax highlight.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions