How can I install Visual Studio Code on Linux Mint 20?
Installing Visual Studio Code in Linux Mint 20 is easy because it already includes a package repository for installation
First, update system repository
sudo apt update -y
Next, install HTTPS support to enable retrieving of packages
sudo apt install curl apt-transport-https
Get Microsoft signing key
curl -sSL https://packages.microsoft.com/keys/microsoft.asc -o microsoft.asc sudo apt-key add microsoft.asc
Add Microsoft Visual Studio Code repository to your Linux Mint
echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
Update your system again and install Visual Studio Code
sudo apt update -y sudo apt install code -y
Once instalation is complete, Visual Studio Code will be available as part of your applications.
Launch the Visual Studio Code program and start using it!
How do I Install Visual Studio Code Plugins?
There are plugins that integrate with Visual Studio Code to make development more interesting and easier. In this guide, we are going to look at integrating Docker and Python with Visual Studio Code.
Docker Visual Studio Code plugin
How does Visual Studio Code works with Docker plugin?
Docker is a runtime for building containerized applications. It is has made it easy for developers to build and ship containerized apps. Integrating with Visual Studio Code will enable developers to directly use it while coding in Visual Studio Code, and they will be able to package their apps into images that can run on any other system that has Docker or any supported container engine installed. To be able to use Docker on Visual Studio Code, you need to install Docker and Docker compose on you development environment. Check our previous guides on how to install Docker and Docker Compose Linux Mint 20.
Once you have Docker and Docker Compose installed and have Visual Studio Code also installed, launch Visual Studio Code, click extensions section (left pane) and look for Docker.
When you install Docker, you will notice on the left pane that a Docker logo has appeared. On clicking it, it opens Docker explorer showing Images, Containers and registries.
Docker commands will also be added to command palette. You can view these commands by opening command palette under view and typing docker
You can now start using Docker plugin in Visual Studio Code!
Python Plugin for Visual Studio Code
How does Python plugin works in Visual Studio Code? Python is one of the easiest languages to learn. Here, we will see how to set up python and use inside Visual Studio Code. First, you need to have python installed on your system and a local development environment set. If you do not have python already, follow the below steps on how to install python3 on Linux Mint 20.
Download and install Python3
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz tar -xvf Python-3.5.1.tgz sudo apt update sudo apt install build-essential checkinstall -y sudo apt install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev sudo apt install -y libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev sudo apt install -y python3-dev cd Python-3.5.1 ./configure sudo make install sudo apt install -y python3-pip
At this point, Python3 has been successfully installed in you system. You can verify by checking Python version.
To check how python works with Visual Studio Code, create a directory for your virtual environment. Create a sample project, in my case i call it my_env. Activate your virtual environment.
mkdir venvs cd venvs python3.5 -m venv my_env source my_env/bin/activate
Your terminal should be as shown
In the virtual environment, create a “Hello World!” program as a test program. Use your favorite file editor.
And add the following content
Once Python is installed, launch Visual Studio Code. On the left pane, search for Python and install the extension. It will ask you to choose your Python interpreter.
After that go to file -> open then open the directory that you were working on. In my case, it is venvs. Once you open, you will see it open on your Visual Studio Code on the left pane with its content.
You have successfully installed Visual Studio Code in Linux Mint 20 and have incorporated Docker and Python plugins. Enjoy your coding!
More of your Linux installations guide below: