VSCode is continuing to evolve in pretty fascinating ways.
// Detect dark theme
var iframe = document.getElementById('tweet-104565506947833...
For further actions, you may consider blocking this person and/or reporting abuse
async/await
sometimes looks less readable thanpromise.then
counter-part.So one can use it when async/await version makes it more readable π.
I agree with this completely. I tried refactoring my code to
async/await
because it was the new thing, but I ended up sticking with promises because the code was much cleanerIt's very useful when you have if's especially if you have conditional diamond forks.
Yes, agreed.
I completely agree .. I can orchestrate the chains of thens in a Promise however it makes it more readable for me
Few releases later VSCode will learn how to make coffee β
If I recall correctly, the changelog also mentioned this was thanks to a summer intern on the VSCode team. Pretty cool!
Wow, thatβs fantastic!
That's a really cool aspect of this, go summer intern!
Cool, and there are definitely valid use cases for this, but I am scared the people who are too enthusiastic about
async
/await
will abuse this and the amount of PRs that changeinto
Why would it leave a then hanging off of an async call?
Which one are you talking about?
You mean the abuser would write the following?
Credit: @umaar , of course.
Hey Ben, I'd be down for an AMA as @nickytonline suggested (thanks Nick for the kind words about the course ποΈ)
Sounds good to me π
You should ask @umaar if he'd be up for an AMA. He's a dev tools guru. I signed up for his moderndevtools.com last year and it'sπ₯π―
VSCode is awesome! π
// Unrelated
I've read a lot of good things about axios, but never from a DEV community member yet. I wish to read one soon! Especially why fetch is better than axios instead of why axios is better than fetch like what most articles I've read says so.
We have to be careful and understand how async/await works. The converted code doesn't behave exactly the same in the twitter example. Before conversion the function returns a promise that resolves with undefined, and console.log(err) is called. After conversion, the function returns a promise that rejects, and console.log(err) is not called. We would assume the converted code should behave the same; thus it's a bug IMO.
Wow amazing
Watchout I saw some bugs reported on this feature, like all refactorings keep an eye on it and add more tests π
I was thinking more about writing new code than updating old code. Thatβs a very strong use case!
Beautiful.