![]() You can modify your settings to format the document whenever you hit Ctrl+S. You can the see the shortcut key combo right next to the Format Document option. You see, the shortcut keys are different for different Operating Systems and sometimes even for different environments. Click on it, and your document will be auto-formatted, like this □ Right click anywhere in the code, and you'll see the Format Document option in the context menu. There, now you have Prettier installed as an extension in VSCodeĮasy. If you're not sure what that means, I recommend just choosing Yes. If it opens up a dialog box about syncing this extension, choose your sync preference for this extension. Type ext install esbenp.prettier-vscode in the input box that opens up, and hit enter.You'll just need to learn to use the CLI. You don't need to bother with this point if you have a 8 GB RAM, i5 CPU with blazing-fast SSD laptop, it can take any extension (These specs are just my laptop's specs, these are not hard limits in any way).īut if you have a slow system and don't wanna add any extensions, No Problem □. There's also the fact that VSCode is a memory hog, and adding extensions to it makes everything slower. If you're adding prettier in a pre-existing large-enough project, you simply can't bother with opening every single file yourselves, and hitting the magic keys. VSCode extension is much easier and better in terms of Developer Experience, but it can only format one file at a time. Why should I bother with the NPM package? It can be run as easily asĮnter fullscreen mode Exit fullscreen mode it's actually an NPM package as well as a CLI originally, on top of which the VSCode extension has been written. All you have to know is one shortcut key combo to automatically format the code, and boom, you're done.īut it's more than an extension. It's a very good extension that saves you a lot of trouble. Prettier is basically a tool that automatically formats the code you've written, saving you the headache of fixing spaces and brackets positioning yourselves. Nobody minds(And ignore those who do).īut if you are in a team or in some situation where multiple developers are collaborating on the code, you need to have properly formatted code, whether by yourself by hand, or by having it auto-formatted by the tooling.Īnd it's good to have formatted code, even when you're on your own. If you're the only one involved in the project, sure go ahead and write unformatted code. Having written unformatted code doesn't make you a bad developer. It's your child, as Scott Tolinsky would say. You wrote it with the sweat of your brows and strength of your fingers. The code may look ugly, but it's still your code. This is the same situation with well-formatted code, and unformatted code.Ī little letter to those who have written unformatted code/still write them: You'd probably scare them off! No good conversation, no collaboration, nothing, NADA!! You simply can't expect to collaborate with anyone in here. ![]() It's the kind of place where people would wanna sit and have a chat together. On the left, there is a very clean table chair, and very orderly. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |