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

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

Open
roflsunriz opened this issue Sep 14, 2021 · 2 comments
Open

Comments

@roflsunriz
Copy link

roflsunriz commented Sep 14, 2021

  • 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

@roflsunriz roflsunriz changed the title Breaks optional chaining (?.) Breaks optional chaining (?.) and Nullish coalescing operator (??) Sep 15, 2021
@ExpertInvest
Copy link

Hi,
I'm experience the same issue. any solution? any updates?

@SmileyChris
Copy link

Update the bundled version of js-beautifer: #346 (then restart VScode)

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

No branches or pull requests

3 participants