Visual Studio Code, often abbreviated as VSCode, is a powerful, lightweight, and versatile source code editor developed by Microsoft. It has quickly gained popularity among developers due to its vast array of features, ease of use, and extensibility. The following bulleted list highlights some of the key aspects of Visual Studio Code:
- Cross-platform compatibility: Visual Studio Code is available on Windows, macOS, and Linux, making it a suitable choice for developers working across multiple platforms.
- Language support: Out of the box, VSCode offers syntax highlighting, code navigation, and intelligent code completion for numerous programming languages, including but not limited to JavaScript, TypeScript, Python, C++, Java, and PHP.
- Built-in Git integration: Version control is essential for modern software development, and VSCode has Git support integrated directly into the editor. This allows developers to commit changes, view diffs, and manage branches without leaving the code editor.
- Debugging capabilities: Visual Studio Code provides a built-in debugger, allowing developers to set breakpoints, step through code, and inspect variables within the editor.
- Customizable appearance: Users can customize the look and feel of the editor by selecting from a wide range of themes or creating their own.
- Extensions and marketplace: The true power of Visual Studio Code lies in its extensibility. The VSCode marketplace offers thousands of extensions that can enhance the editor’s functionality, add new features, or provide support for additional programming languages and frameworks.
- Settings synchronization: Developers can synchronize their VSCode settings across multiple machines, ensuring a consistent development environment wherever they work.
- Performance: Visual Studio Code is built on Electron, a framework that allows developers to create cross-platform desktop applications using web technologies. This results in a lightweight and fast code editor, ensuring smooth performance even on larger projects.
- Active community: As an open-source project, Visual Studio Code has a large and active community of users and contributors. This ensures that the editor is continually evolving, with new features and bug fixes being regularly released.
In conclusion, Visual Studio Code is a powerful, customizable, and extensible code editor that caters to the needs of modern developers working on a variety of projects and platforms. The guide will demonstrate how to install Visual Studio Code on Debian 12 Bookworm, Debian 11 Bullseye, or Debian 10 Buster release series using the official Microsoft VSCode apt repository for the latest versions and to keep it up-to-date.
Table of Contents
Step 1: Visual Studio Code Pre-install Steps
Before diving into the installation process, it’s essential to make sure your Debian system is updated with the latest packages. This will help prevent any potential conflicts during the installation of Visual Studio Code.
Update Your System
To update your system, open a terminal and run the following command:
sudo apt update
After updating the package list, proceed to upgrade any outdated packages with the following command:
sudo apt upgrade
Install Required Packages
Next, you’ll need to install a few required packages to ensure a smooth installation of Visual Studio Code. These packages are common across most Linux distributions and help with managing repositories and securely downloading files.
Run the following command to install the necessary packages:
sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y
By following these pre-install steps, you’ve prepared your Debian system for the installation of Visual Studio Code. In the next steps, you’ll learn how to add the official Microsoft repository and install the latest version of Visual Studio Code.
Step 2: Import Visual Studio Code Repository
In this step, you’ll learn how to import the official Microsoft repository for Visual Studio Code to ensure you’re getting the latest version from a trusted source.
Import Microsoft GPG Key
First, you need to import the Microsoft GPG key, which allows your system to verify the authenticity of the Visual Studio Code installation package. To do this, run the following command in your terminal:
curl -fSsL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/vscode.gpg >/dev/null
This command downloads the GPG key from Microsoft’s server and adds it to your system’s keyring.
Add Microsoft Visual Studio Code Repository
Now that you’ve imported the GPG key, the next step is to add the Visual Studio Code repository to your system. This allows you to install and update Visual Studio Code directly from Microsoft’s official repository.
Run the following command in your terminal to add the repository:
echo deb [arch=amd64 signed-by=/usr/share/keyrings/vscode.gpg] https://packages.microsoft.com/repos/vscode stable main | sudo tee /etc/apt/sources.list.d/vscode.list
This command adds the repository to your system’s list of package sources, making it accessible when searching for packages to install or update.
With the repository imported, you’re now ready to install Visual Studio Code on your Debian system.
Step 3: Install Visual Studio Code on Debian
Now that you’ve imported the official Microsoft repository, it’s time to install Visual Studio Code on your Debian system. Before doing so, let’s briefly discuss the difference between Visual Studio Code and Visual Studio Code Insiders.
Visual Studio Code vs. Visual Studio Code Insiders
Visual Studio Code is the stable version of the editor, offering a reliable and thoroughly tested experience for most users.
Visual Studio Code Insiders is the beta version, which includes the latest features and improvements before they’re released in the stable version. While it allows users to access new features earlier, it may be less stable and could potentially contain bugs.
It’s important to note that both versions can coexist on your system, as they have separate installations.
Update Package List
Before installing Visual Studio Code, ensure that your system’s package list is up-to-date to include the newly added repository:
sudo apt update
Install Visual Studio Code
To install the stable version of Visual Studio Code, run the following command:
sudo apt install code
Install Visual Studio Code Insiders (Beta)
If you prefer to use the Insiders version, which offers early access to new features and improvements, run the following command:
sudo apt install code-insiders
Remember that you can install both the stable and Insiders versions of Visual Studio Code, as they have separate installations and can run side-by-side on your Debian system.
Step 4: Launch Visual Studio Code on Debian
With Visual Studio Code successfully installed on your Debian system, you can now launch the application using various methods. Choose the approach that best suits your preferences and workflow.
Launching from the Command Line
For those who enjoy using the terminal, you can launch Visual Studio Code quickly by entering the following command:
For the stable version:
code
For the Insiders (beta) version:
code-insiders
Launching from the Graphical User Interface (GUI)
If you prefer using the desktop environment to launch applications, you can find Visual Studio Code in your system’s application menu:
- Click on Activities in the top-left corner of your screen.
- Select Show Applications (usually represented by a grid icon).
- Locate Visual Studio Code or Visual Studio Code Insiders in the list of applications, or use the search bar to find it.
Example of Visual Studio Code application icon on Debian:
Step 5: Getting Started with Visual Studio Code on Debian
Now that you’ve installed Visual Studio Code on your Debian system, it’s time to explore some general tips, customizations, and other useful information to help you get started with this powerful code editor.
General Tips
- Use keyboard shortcuts: Learning and utilizing keyboard shortcuts can significantly improve your productivity. Visual Studio Code has a variety of built-in shortcuts to help you navigate, edit, and manage your code more efficiently. You can find a list of shortcuts by selecting Help > Keyboard Shortcuts Reference from the menu bar.
- Multi-cursor editing: VSCode supports multi-cursor editing, allowing you to make changes in multiple places simultaneously. Hold the
Alt
key and click on different locations to create multiple cursors. - Integrated terminal: Visual Studio Code features an integrated terminal, enabling you to execute commands directly within the editor. To open the terminal, select View > Terminal from the menu bar or press
Ctrl + ~
.
Customizations
- Themes: Personalize your editor’s appearance by choosing from a wide range of themes or creating your own. To change the theme, select File > Preferences > Color Theme from the menu bar, and pick the one that suits your taste.
- File icons: Improve file navigation by customizing the file icons displayed in the editor. To change the file icon theme, select File > Preferences > File Icon Theme from the menu bar, and choose your preferred theme.
- Settings: Customize your editor’s behavior by modifying settings. You can access the settings by selecting File > Preferences > Settings from the menu bar or pressing
Ctrl + ,
. Settings can be configured on a user or workspace level, allowing for different configurations per project.
Extensions
Visual Studio Code’s true power lies in its extensibility. Thousands of extensions are available in the VSCode marketplace to enhance your editor’s functionality, add new features, or provide support for additional programming languages and frameworks. To explore available extensions, select View > Extensions from the menu bar or press Ctrl + Shift + X
.
Some popular extensions to consider include:
- Live Server: Automatically launch a local development server with live reload feature for static and dynamic pages.
- Prettier: Automatically format your code using Prettier, a widely used code formatter supporting various languages.
- ESLint: Detect and fix problems in your JavaScript code by integrating the ESLint linter into your editor.
- Python: Enhance your Python development experience with rich language support, debugging, and testing features.
- GitLens: Supercharge your Git capabilities with advanced features like blame annotations, commit search, and detailed commit information.
These tips and customizations will help you get started with Visual Studio Code on your Debian system and make the most of its rich features, customizable appearance, and vast array of extensions. By tailoring the editor to your preferences and workflow, you’ll be well on your way to a more efficient and enjoyable coding experience.
Example of Visual Studio Code on Debian desktop:
Additional Tips
Removing Visual Studio Code on Debian
If you decide to remove Visual Studio Code from your Debian system, follow the steps below to uninstall the software, remove the repository, and delete the GPG key.
Uninstall Visual Studio Code
To uninstall Visual Studio Code or Visual Studio Code Insiders, run the corresponding command in your terminal:
Remove VSCode:
sudo apt remove code
Remove VSCode Insiders (Beta):
sudo apt remove code-insiders
Remove the Repository
After uninstalling the software, remove the Microsoft Visual Studio Code repository from your system with the following command:
sudo rm /etc/apt/sources.list.d/vscode.list
Delete the GPG Key
For enhanced security and proper system maintenance, it’s a good practice to remove the GPG key associated with the Visual Studio Code repository. To do this, run the following command:
sudo rm /usr/share/keyrings/vscode.gpg
By following these steps, you’ll have successfully removed Visual Studio Code, its repository, and the GPG key from your Debian system.
Conclusion
In this guide, you’ve learned how to install Visual Studio Code on Debian using the official Microsoft repository. By following the provided steps, you’ve ensured that you have the latest version of the software and can keep it up-to-date. Additionally, you’ve explored some tips and customizations to help you get started with Visual Studio Code and learned how to remove the software if needed.
Additional Resources and Links
To further enhance your experience with Visual Studio Code and deepen your knowledge, explore the following official resources:
- Visual Studio Code Official Website: The main site for Visual Studio Code contains download links, release notes, and an overview of the software’s features.
- Visual Studio Code Documentation: Comprehensive documentation for Visual Studio Code, covering topics like setup, customization, and extension development.
- Visual Studio Code GitHub Repository: The official GitHub repository for Visual Studio Code, where you can view the source code, contribute to the project, and report issues.
- Visual Studio Code Marketplace: The marketplace for Visual Studio Code extensions, where you can find thousands of plugins to enhance your coding experience.
- Visual Studio Code Twitter: The official Visual Studio Code Twitter account, where you can stay up-to-date with the latest news, announcements, and tips.