VSCodeBeautify icon indicating copy to clipboard operation
VSCodeBeautify copied to clipboard

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

Open roflsunriz opened this issue 3 years ago • 2 comments

  • 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 avatar Sep 14 '21 14:09 roflsunriz

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

ExpertInvest avatar Sep 30 '21 10:09 ExpertInvest

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

SmileyChris avatar Nov 23 '21 22:11 SmileyChris