DEV Community

Discussion on: Mac commands in VSCode: A requiem for Windows

Collapse
 
mjsarfatti profile image
Manuele J Sarfatti

I'll add 2 shortcuts I find myself using all the time:

⌘+/: Comments/un-comments selected lines
⌥+⇧+F: Auto-formats the document

Collapse
 
jillianntish profile image
Jill

I love the auto-formatter command!! A few of my instructors have teased me about using it instead of my linter but even that can take longer right?! When it's crunch time this is a definite go-to as well

Collapse
 
mjsarfatti profile image
Manuele J Sarfatti

Well, instead of using a linter (such as eslint), it's recommended to use a formatter (two of the most used ones are prettier for JavaScript, TypeScript, JSON, CSS; and phpfmt for PHP. The reasone is that they assolve two slightly different roles.

In 99% of my projects I have a linter to protect me from syntax errors, and a formatter to beautify my code whenever I hit Cmd+S.

Sometimes I want to format the document but not save it yet, and that's when I use Alt+Shift+F.

Nothing is slower or takes longer though, the formatter takes literally less than the blink of an eye to do its work!