xsburg / vscode-javascript-booster

Sprinkle extra refactorings, code actions and commands over your JavaScript! 🍩 TypeScript and Flow are first class citizens as well!
https://marketplace.visualstudio.com/items?itemName=sburg.vscode-javascript-booster
160 stars 13 forks source link

Feature request: expand/collapse object/arrays declaration #44

Open enzoclock opened 2 years ago

enzoclock commented 2 years ago

Hi 👋 Thanks for this very useful extension 🙏

I was looking for a code action to split/merge an array into multiple/single lines, like so:

I found this extension which works fine. But I suppose it can be a nice addition to JS-booster, with the usual quick-action trigger.

Would it be interesting?

xsburg commented 2 years ago

Hey @enzoclock, Thanks for the idea! I wonder, what would be the use case for this action in JavaScript/TypeScript code? I would expect most people to use Prettier for automated code formatting, which would eliminate the results of this action. 🤔

enzoclock commented 2 years ago

Hey @xsburg I'm reading from the Prettier doc that this feature exists, but yet is considered as a "workaround-feature" since there aren't obvious reversibility rules.

Personally, I wouldn't mind having to decide when to expand/collapse an object/array, depending on the code context, rather than having automatic fixing. Wdyt?

Also, I've read this feature exists for webstorm :)