Bounties /Pin to ProfileBookmark

Can you format code in VS Code without an extension?

I’d rather not install extra extensions, though Prettier looks like a good option. Does Visual Studio Code support native code formatting?

to post a answer
August 5th, 2022Engineer

2 Answer(s)

answer
@NathanCruzSep 01, 2022 — One simple way is to use this shortcut to open the Command Palette and then search for "Format Document":

Ctrl + Shift + P

Or if you're on a Mac:

Cmd + Shift + P

You can also memorize or modify the format document keybinding for faster use the next time.
pending review
@emptydubSep 01, 2022 — This is the beauty of VS Code, it's developed with use cases at it's core so to be unambiguous yet still an excellent tool for any number of the developing tracks - where plugins/extensions can be added as needed. Otherwise it would contain too many unused functions for you or I. It allows you to tailor it to the way you use it... if later you wish to go another way, remove and add extensions as you see fit and your editor. It will still (most likely) be lighter weight than an all-encompassing or niche editor.

So, no, it's not built in for these reasons.
×

Success!

Help @buildinteractive spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with Github
about: ({
version: 0.1.7 BETA 2.4,
whats_new: article editor v2,
up_next: tip code demos,
coming_soon: embeddable tipping,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh

version: 0.1.5,
notes: added pins + new badge

version: 0.1.4,
notes: home refresh + tools
)...
recent_tips: (
tipper: @JohnDavis,
amount: 250 SATS,
source: article

tipper: @Megan0910,
amount: 1000 SATS,
source: article

tipper: @JohnDavis,
amount: 250 SATS,
source: article
)...