Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting breaks when using nullish coalescing operator (??) in template literals. #2104

Open
DiriectorDoc opened this issue Oct 1, 2022 · 1 comment

Comments

@DiriectorDoc
Copy link

Description

There seems to be a bug with the syntax highlighting. I'm not sure what's going on here, but this is not the first time I've seen a problem like this. My former IDE (Adobe Brackets) had this same issue.

Input

The code looked like this before beautification:

var variable;
if (someCondition()) {
    variable = 4
}

var result = `The result is ${valuable ?? 5}`;

function someFunction(a) {
    // do something with `a`
    return a
}

Expected Output

The code should have looked like this after beautification:
image

Actual Output

The code actually looked like this after beautification:
image

Environment

OS: Windows 10 (10.0.19044)
Browser: Google Chrome Version 105 (105.0.5195.127)

Settings

{
  "indent_size": "4",
  "indent_char": " ",
  "max_preserve_newlines": "5",
  "preserve_newlines": true,
  "keep_array_indentation": false,
  "break_chained_methods": false,
  "indent_scripts": "normal",
  "brace_style": "collapse",
  "space_before_conditional": true,
  "unescape_strings": false,
  "jslint_happy": false,
  "end_with_newline": false,
  "wrap_line_length": "0",
  "indent_inner_html": false,
  "comma_first": false,
  "e4x": false,
  "indent_empty_lines": false
}
@bitwiseman
Copy link
Member

Highlights on the site are provided by CodeMirror and not part of this project. We are using an older version, so this might be fixed already somewhere.

The failed highlight just means that that component doesn't understand the nullish operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants