Skip to content

Breaks optional chaining (?.) and Nullish coalescing operator (??) #401

@roflsunriz

Description

@roflsunriz
  • Operating System (+Version):
    OS Name: Microsoft Windows 10 Pro
    OS Version: 10.0.19043 N/A Build 19043
  • VS Code Version:
    Version: 1.60.0 (system setup)
    Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
    Date: 2021-09-01T10:41:52.311Z
    Electron: 13.1.8
    Chrome: 91.0.4472.164
    Node.js: 14.16.0
    V8: 9.1.269.39-electron.0
    OS: Windows_NT x64 10.0.19043
  • beautify Version:
    Name: Beautify
    Id: hookyqr.beautify
    Description: Beautify code in place for VS Code
    Version: 1.5.0
    Publisher: HookyQR
    VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify

Provide the settings you use:
nothing

Action performed

beautify JavaScript file

Expected results

beautify with optional chaining expression and Nullish coalescing operator held

option.f2 ? option?.f2(videoid, apiData) : false
var cacheIds = json[videoid].preferred ?? json[videoid].cacheIds[json[videoid].cacheIds.length - 1]

Actual results

optional chaining expression and Nullish coalescing operator broken (automatically adds spaces)

option.f2 ? option ? .f2(videoid, apiData) : false
var cacheIds = json[videoid].preferred ? ? json[videoid].cacheIds[json[videoid].cacheIds.length - 1]

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions