RedditPP Mascot

RedditPP

r/vscode • … • u/Liquidje

Is there a more ergonomic way to destructure in e.g. Javascript?

Destructuring is a way to unpack e.g. properties of an object to variables. Typical example:

// init an object const obj = { a: 1, b: 2 }; // destructure const { a, b } = obj;

However, typing this in while using Intellisense always feels a bit odd. For Intellisense to kick in, I have to type

`const {} = obj;`

Then I can move my cursor back inside the curly braces, and it will suggest/autocomplete the property names. But with longer names than `obj`and `a` it is just a bit inconvenient. I also feel like I am missing something, as this is so commonly used nowadays in some frameworks, I can't imagine nobody ever found a better (or at least different) way to do this.

I feel like I am missing something, but when I try to google it I mainly get extensions which help refactor to destructuring. Any extension or input in general would be appreciated

— 0