Original text: betterprogramming. Pub / 5 – tips – to – b…
By Jose Granja
Visual Studio Code was released on November 18, 2015. Five years on, it has become one of the most successful editors in the world. It is released under an MIT license, which makes it free to use. The key to its success is:
- versatility
- Lots of plugins
- Availability on multiple platforms
Currently VS Code is available natively on the following platforms:
- OS X Yosemite (+ 10.10)
- Windows 7 (with.net Framework 4.5.2), 8.0, 8.1 and 10 (32-bit and 64-bit)
- Linux (Debian): Ubuntu Desktop 16.04, Debian 9
- Linux (Red Hat): Red Hat Enterprise Linux 7, CentOS 8, Fedora 24
It also runs in any modern browser, but with limited functionality.
Its great platform availability is due to the fact that it is a Web application released on Electron.
Electron (formerly known as Atom Shell) is an open source software framework developed and maintained by GitHub. It allows desktop GUI applications to be developed using Web technologies: it combines the Chromium rendering engine with node.js applications.
The only downside is that Electron can be very resource-intensive and less efficient than native based applications, which means it can be slow if you’re not careful.
Is your VS Code feeling a little sluggish? Do you want it to run in a higher performance way? Today, we’ll look at five tips that can help you make the most of it.
The basic requirements
Before we start tuning, let’s see if we meet the minimum hardware requirements recommended by the Visual Studio Code team. We need at least 200 MB of disk space.
Processor and memory recommendations:
- 1.6 GHz or faster processor
- 1 GB of memory
See a more detailed list.
1. Disable unused built-in functions
VS Code is rich in features. However, you may not be interested in some of them. Therefore, you can disable them to improve the performance of the editor.
File > Preferences > Settings > Files:Exclude
: Add any file modes that you don’t want VS Code to use in your project.File > Preferences > Text Editor > Minimap > Enabled
: check box to disable/enable minimap.File > Preferences > Text Editor > Suggestions
: This is where you can fine-tune anything related to the proposal.File > Preferences > Text Editor > From on save / Format on paste
: For example, you can disable formatting at save time and defer it until pre-commit.File > Preferences > Application > Telemetry
: Telemetry may affect performance.File > Preferences > Text Editor > Code lens
: You can disable/enable code lensing.
2. Be an extended minimalist
There are a number of extensions available. However, that doesn’t mean you need them all. Add only those that have a direct impact on your daily productive life.
Before adding any extensions, ask yourself:
- Isn’t this built into VS Code already?
- Isn’t this just a one-time thing?
- Does it really affect your day-to-day work?
- Is this the best tool for your situation?
- Does it have a good review?
3. Bind the extension to the workspace
If you work on many different projects with different code stacks, you may find yourself installing a lot of extensions. This can easily have an impact on performance.
One trick is to align your extensions with your workspace. This way, you know that you are only loading the plug-ins needed for the workspace.
All you need to do is browse through all the available plug-ins and disable those that are not needed for a particular workspace.
It may seem like a time-consuming task at first, but it will be worth it in the long run.
4. Monitor the loading time of plug-ins
Once you have the minimum plug-ins you need to code, you can check their performance. VS Code comes with a few developer options that you can take advantage of.
You can easily monitor the startup time of all of these plug-ins by executing CMD + P > Developer: Show Running Extensions.
You will get a list of all your activity extensions and when they were active. As a general rule of thumb, you might want to double-check anything that takes longer than 300 milliseconds.
If you want to dig deeper, you can analyze any of them by clicking the Record button.
If you want to get a clear picture of everything that happens when VS Code starts up, you might want to look at CMD + P > Developer Startup Performance.
You will get the following information:
- Operating System Details
- Performance indicators
- Extended Activation Details
- The cache location
It gives a good overview of your VS Code performance. This is useful when trying to determine the performance impact of any change. It’s a good habit to do regular checks to make sure everything is running smoothly.
5. Fine-tune your configuration runtime parameters
In some cases, you may need to further configure VS Code startup. You can do this by using arguments on the command line. This is easy to configure in the argv.json file.
Run CMD + Shift + P > Configure Runtime Arguments.
Then edit the argv.json file with all your custom configurations.
Final thoughts
VS Code is a great widely used IDE. It is very flexible and highly customizable. However, there is a cost. Make sure you understand what you are adding and how you load it.
At first, it seems easy to add plug-ins for any small task you do yourself. Over time, this extension began to fade away in search of higher-performance editors.
I hope all of these tips will help you speed up the VS Code editor and enjoy a better coding experience.