6 VS Code Tips Will Improve Your Productivity

Photo by Sarah Pflug from Burst

As a programmer developing DotNet projects on Mac OS, I love VS Code very much. Not only is VS Code cross-platform, but it is also free, open-source, and powerful. Here are some tips I used to program with VS Code. By using these tips, VS Code will become simpler and make you more productive.

Tip #1 Multi-line and Multi-cursor Editing

The first tip is multi-line and multi-cursor editing in VS Code. Yes, VS Code allows us to edit multiple lines at the same time. And I think it will greatly increase our productivity in some situations, as you can see the examples below.

  • Windows: Ctrl + Alt + Arrow Keys
  • Mac OS: Opt + Cmd + Arrow Keys

YEAH! It looks Cool and increases our productivity.

However, if the multiple lines of code you want to edit are not aligned, for example, in different positions of the source code file. Then you can use Multi-cursor Editing by using the keyboard and the mouse.

  • Windows: Alt + select the target block by the mouse
  • Mac OS: Opt + select the target block by the mouse

By the way, as you can see in the Multi-cursor Editing example, you can use this approach to do multi-line editing by using the keyboard and the mouse, too.

Tip #2 Exclude Redundant Files And Folders

When you focus on your source code, the files and folders automatically generated in the project become redundant. You can config the Settings file of VS Code to exclude files and folders that you think are redundant from VS Code to make your workspace clean.

As you can see above, you can open the Settings Panel of VS Code and find the Exclude section, then add patterns to exclude the redundant files and folders(for example, the obj folder and the bin folder).

Tip #3 prop and ctor snippets

If you installed the C# extension by Microsoft, you could use the prop and ctor snippets to boost your coding speed.

Tip #4 Make Your Life Easier When You Deal With Brackets

I think many programmers have had similar experiences with me. When a pair of brackets are far apart, it is difficult to match the correct pair of brackets. For example, a very long method, or the parameters passed into the method are complicated.

Therefore, the Bracket Pair Colorizer2 extension is an excellent option to handle this situation and will make your life easier.

Tip #5 Add Icons To Make The Project Layout Informative

The default icon theme of VS Code is very boring. When the project is complicated, such icon theme cannot provide enough information and make the project difficult to maintain. For example, it is difficult to distinguish different file types, and it is also difficult to distinguish between folders and files.

Therefore, it’s necessary to select an excellent icon theme and replace the default one(you can set the icon theme form VS Code Preference File Icon Theme Panel). For example, I use vscode-icons extension to make the project layout informative.

Tip #6 Postfix Completion

If you are a fun of Rider or Resharper, I think you might like the Postfix templates function. For example, you have some code that you want to wrap into, say, if , with postfix templates, you can quickly surround the code with a required if statement.

And the TS/JS postfix completion extension provides similar functions to VS code when writing TS/JS code.


These 6 tips make me more productive when writing code with VS Code, and I believe they will definitely increase your productivity too. Give it a try!

Thanks for reading. I hope it’s useful!


Subscribe To Jiadong Chen's Blog

Avatar
Jiadong Chen
Cloud Architect/Senior Developer

Cloud Architect at Company-X | Microsoft MVP, MCT | Azure Certified Solutions Architect & Cybersecurity Architect Expert | Member of .NET Foundation | Packt Author ㅣ Opinions = my own.

comments powered by Disqus

Related