There are countless extensions in the VS Code marketplace. On top of that hundreds of new extensions are added every day. But we are aware of only a handful of them. Let us look at some of the less known, not so used but useful extensions.
One of my most productive days was throwing away 1,000 lines of code. : Ken Thompson
When I started programming, I followed a simple Mantra -> “Write less lines of code, readable or not, performant or not”. With time I started appreciating the simplicity and readability of code. But often less lines of code is more readable. So I often like checking how many lines of code I wrote, to achieve a particular functionality. The number of lines of code is inversely proportional to the pride I take, in writing that code.
Another rule of thumb that I follow is, whenever a file crosses five hundred lines of code I consider it high time to break this code in multiple files. VSCode Counter is really helpful in this.
How to use it:
- Press F1 to open Command Pallete.
- Search for Vscode counter : count lines in directory.
- Select the directory for which you want to count.
- Press enter and you have all the statistics.
They say Matches are made in heaven. As a programmer I highly doubt it. I live on earth and I match brackets and believe me matching brackets is hell. People from the “Pre Promise Period” (callback hell) can certainly feel my pain. I have
spent wasted countless hours in matching brackets in my code. But now I use Bracket Pair Colorizer to deal with this demon.
How to use it:
- To match any bracket just click before it.
- And it will run a line matching your brackets.
- You can easily identify missing brackets if any.
3. Import Cost
If you can’t measure it, you can’t improve it. : Lord Kelvin
We live in a world of instant gratification. We have a short attention span. If your website takes a little longer to load, you will lose customers. And the relationship between loading time and losing customers is not linear btw, it’s exponential. You increase the load time of your website by a few seconds and B💣💥m you lose your traffic like anything. so It’s always good to know the size of libraries you are using and sending to the user. I use import cost for the same. It just tells me how much using some package is costing me. I look for alternatives if something is costing me a lot.
A lot of times I write headings to separate sections of my code. Doing it every time manually felt like a crime. And one day I came across this elegant extension. There are so many options that come with it. But I generally use two of these separators more frequently.
- Heading: Write your heading and press Alt + Shift +x
- Line Separator: just press Alt + y
Invert, always Invert: JacobiConvert, Always Convert. My monitor requires an HDMI port, my MacBook has only Type C port. what do I do? I use a Type C to HDMI adaptor. These Adaptors and Converters are very common. Type C to HDMI, Type C to 3.5mm, and almost whatever you want you can find them in the market. This highly exploited concept in hardware can be used in our daily life as well.
for eg: I have to write a JSON body to test my API endpoints. Just to simplify it a little bit, now I write my request body in YAML and convert it into JSON using this simple extension. YAML is just a superset of JSON. so whatever you can write in JSON you can also write it in YAML and YAML is a little less verbose than JSON. It looks neat and I can write it faster. I hope postman will one day have this feature built-in. so I can avoid this extra step of copying and pasting in postman.
How to use it:
- Create a .yml file first.
- Right click on the file in explorer.
- select “Convert to JSON”.
I don’t mind difference of opinion unless you prefer light theme over dark. : Ankit Aabad (yeah that’s me😊)
I spend a lot of time writing code, and I spend some more on my setup exploring different keyboards, mouse, monitors, tables, and whatnot. I also keep testing different themes and fonts. One theme that I have been using for a long time is Ayu. I like its dark variant. It is easy on my eyes and the color scheme is just perfect for my taste. Colors are punchy and bright and visibility is on another level. Just try it once and I’m sure you will fall in love with it.
I hope you enjoyed this post and you find these extensions useful. If you have any suggestions, I’d love to hear more from you.
Are you planning to go to serverless? AntStack is a cloud computing service and consulting company primarily focusing on Serverless Computing. We help companies get up and running with serverless, and we’ll make sure that there are no limits.