/    Sign up×
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
Engineer

2 Replies

Copy linkTweet thisAlerts:
@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.
Copy linkTweet thisAlerts:
@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 GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...