Enhancing code on Visual Studio Code with the help of Extensions

You must be aware of Visual Studio Code already by now. This is so because we already talked about it in an article a while ago. Now, in this article, we are going to talk about how to make the programs that you write better. For me, ‘better’ refers to the notion of error-free, optimized code which will lead to smoother deployment and execution of the respective project. We will be covering everything about writing some code on the IDE in this article. But before that, we should cover what all languages and technologies are supported better by Visual Studio Code.

How to write & enhance your first program on Visual Studio Code

This Visual Studio Code tutorial for beginners will show you how to compile or write your first program or code. Microsoft added support for extensions in Visual Studio Code. These extensions help to enhance and optimize your code for languages like PHP, C, C++ and more!

Languages supported by Visual Studio Code

According to the webpage published on the official website of Visual Studio Code, the following are the main languages supported by the IDE. They include C++, C#, CSS, Dockerfile, Go, HTML, Java, JavaScript, JSON, Less, Markdown, PHP, Python, Sass, T-SQL, and TypeScript.

Now with this, you get some language features that help you write better code. This better code is similar in the track of what we talked about above. So, with support for numerous extensions, we get the rich support for the following:

Syntax highlighting and bracket matching, Smart completions (IntelliSense), Linting and corrections, Code navigation (Go to Definition, Find All References), Debugging and Refactoring.sc

When the language or the file extension is supported by the IDE, you will see the name of that particular language in the Status Bar on the bottom right corner. Else, it will show you markdown or plaintext written.

For example:

The above image is when the IDE identifies the file as a known type (HTML).

The above image is when the IDE does not identify the file as a known type. Hence, it is mentioned as Plain Text.

Now, let us take a look at how to install and use these extensions to leverage the full advantage of their capabilities.

How to install Extensions on Visual Studio Code

So, in the first step when you open Visual Studio Code, you might see a screen somewhat similar as shown in the snippet below.

After that, click on the Extensions button on the left side vertical menu as shown in the screenshot below.

Then you will see a new panel sliding from the left side itself. In the Search bar of the panel, search for the language or service you want an extension for. I will be searching for an extension for PHP because I will be demoing it.

From the list that you get as search results, select the one that is most suitable to fulfill your needs. If you click on the listing of the extension, you will get more details like description, developer’s name, features, size, compatibility, and more.

Once you hit on the Install button, you are good to go!

Now as I installed the PHP IntelliSense Extension on Visual Studio Code, it starts displaying smart suggestions and auto-completion for different syntax. Hence, this will decrease the chances of an error and will make the execution and deployment of your application smooth.

The real-time example of IntelliSense working with a PHP file is inserted here.

Bonus: What did I do to demo?

If you are curious to try out what I did now, just follow these quick steps.

Install Visual Studio Code and then, search or get the extension for PHP as instructed in the steps above or follow this link marketplace.visualstudio.com.

Now create a new file and save it in .php extension for the file.

    echo "This is Ayush from TheWindowsClub.com";

Save and then move the files to the htdocs folder of XAMPP or WWW folder of WAMP.

Now, finally open your favorite web browser and enter the local URL for your file. Then you will see an output like this.

So, this is how extensions help you to enhance and optimize your code on Visual Studio Code.

Hope you find it easy to understand.

Posted by on , in Category General with Tags
Ayush has been a Windows enthusiast since the day he got his first PC with Windows 98SE. He is an active Windows Insider since Day 1 and is now a Windows Insider MVP. He has been testing pre-release services on his Windows 10 PC, Lumia, and Android devices.

Leave a Reply

Your email address will not be published. Required fields are marked *

9 + 9 =