Python Land
Published in

Python Land

The Most Beautiful and Popular IDE For Programmers

A quick overview of Visual Studio Code and its features

Image by python.land

When working with code, it’s vital to use a powerful and responsive editor, or better yet, an IDE. A good IDE offers improved code organization, a fluent workflow, and powerful features to make life easier. One such tool is VSCode, created by Microsoft and freely available for anyone to download.

What is an IDE?

IDE stands for “Integrated Development Environment.” In more human terms, an IDE is a programmer’s playground. Most IDEs are backed by a community of contributors that build extensions for the IDEs. All modern IDEs also include productivity features like syntax highlighting, checking, and autocomplete that make writing code much more manageable.

You have choices

There are many IDEs to choose from. Some of the most popular are listed below:

  • Visual Studio Code (Backed by Microsoft)
  • Xcode (Backed by Apple)
  • IntelliJ IDEA
  • Atom
  • Notepad++

For the sake of demonstration, we’ll use Visual Code Studio (VSCode) to show you the basic features of an IDE and how to navigate it. VSCode is backed by Microsoft and many third-party developers, making this the perfect program to master.

This article assumes that you’ve already installed VSCode and fired it up. If you haven’t done that yet, follow the instructions for installing VSCode for your OS and return to this page.

A tour of the GUI

When you fire up VSCode for the first time, it might look overwhelming, but we’ll take it step by step so you get the most from this powerful IDE.

Overview

This is our primary workspace in VSCode, and it is divided into five main sections, as noted by the numbers:

VSCode overview. Image by author.

1. Standard UI Toolbar with Extra Features

2. VSCode Sidebar

3. VSCode Explorer

4. Debug Console/Terminal

5. Document Display/Editor

The Menu bar

Menu’s from VSCode’s menubar. Image by author

The menu bar is a no-frills part of the UI but vital to your projects.

  • Under the “File” section, you can save and open projects, but you can add folders to your workspace as well.
  • The “Edit” tab contains the standard copy/paste options, which come in handy when you need to make copies of a line with slight modifications. The find and replace options are hidden here as well.
  • Under “Selection,” there are options that allow you to select and move through code easier.
  • The “View” tab carries options that will enable you to change the look of VSCode and show windows such as a debug console.
  • I personally don’t use “Go” as much, but this section again allows you to navigate code easier.
  • The “Run” tab offers options to debug code and add configurations.
  • The “Terminal” window lets you create a Terminal window and edit tasks.
  • Our toolbox’s last tool is the “Help” window, which leads you to more information and documentation about VSCode.

The Sidebar

Looking closer at the sidebar, there are five main elements. The first is the “Explorer” tab, which I’ll go into in more detail later, but understand that it’s the meat and potatoes of organization in your workspace.

VSCode sidebar panels. Image by author.

The “Search” tab is used to search for any string of characters. The best part is that any file in your workspace will be searched too, meaning that you can find specific text in all of your source code.

The “Source Control” tab allows you to publish and maintain code on the GitHub repository. This allows your code to be made public for other programmers to use and build their projects from. While an excellent feature for more seasoned programmers, you won’t need this if you are still learning VSCode.

The last tab, “Extensions,” allows you to see currently installed extensions and find others available to add. As you can see, I have a few installed for the Java and Python programming languages. If you don’t have Visual Studio IntelliCode, I would highly recommend installing it, and I’ll show why later.

File Explorer

The file explorer planel

The file explorer works as any file explorer would. You can create, organize, and delete files right from here. Using the tools shown above, you can create a new folder or refresh the directory. Any changes to your directory are almost instantly shown here, but you might need to force a refresh now and then.

The last window icon allows you to minimize all folders at once. As you begin to build larger projects such as websites, you will have to manage several files at once. This button clears the clutter and folds everything back into a simple view.

Skipping the first icon was no accident as I wanted to show a cool feature in VSCode. This little icon lets you create a file in your current directory.

You can create many files that contain source code and will be recognized by VSCode. For example, the .csv file extension is typically used for storing comma-separated data. The .py files contain Python code, while the .html files are webpage files. My favorite part of this feature is the little icons it creates based on your file type. It gives you visual cues to quickly find what you’re looking for.

Debug console and terminal window

The small bottom window is typically reserved for a Terminal window. Integrating a terminal in your workspace saves time and clicking. If you want to navigate through other directories or run a script, that’s typically done through the terminal, which is why it’s nice to have a nested window at the bottom.

Running a script in VSCode is quite simple using the terminal. Let’s say you have a script called thisisavirus.py saved in your directory. If you want to run that, simply type python thisisavirus.py in the console.

You might want to run a python file in a different directory than your workspace is in. In this case, point the terminal to the file name and still use the python command as seen below. Its important to use commas if the path has spaces in. This will prevent the error like shown below from popping up.

The terminal is also fantastic to see where errors in your code might be, such as shown above. The traceback shows you what went wrong and where the code is that gave the error.

My favorite of the tools in this section is simply called “Problems.” It’s beneficial because it checks every file open in your workspace for errors and other problems. As seen here, I have an “EOF” error, which is simply a syntax error because of missing parentheses in the command print(name).

The document editor

Look at all those pretty colors! In this code I built for a class, there are about six different colors, each representing another type of code. For example, purple text highlights native Python commands such as “import” and words found in loops. Strings will be highlighted orange to stand out from other text as well.

Another excellent feature of VSCode is the mini text overlay. When working with many lines of code, an error will inevitably pop up. Rather than scroll through hundreds of lines, VSCode provides you with a smaller version of your code on the right side, which will highlight a line in red if an error is spotted.

Of course, when working with many lines of code, you may also be referencing between separate files. VSCode allows you to see multiple files by simply clicking on them and then clicking this little icon near the top. Each file is scrollable and dependent on the other file.

To the left of the dual-screen button is a tiny green arrow. I hope after many years of researching, you’ve found that this arrow simply runs the code, which it does.

As a final note, think of those people with ten browser tabs open at once. You may despise their ways, but VSCode sets no limit of open tabs either. This does come in handy now, knowing that you can split the screen and edit multiple files at once.

Finding and squashing bugs

We haven’t talked about the fourth icon yet, because it’s special enough to deserve it’s own section.

Debugging software with VSCode. Image by author.

The play button, decorated with a little bug, runs your script in debug mode. When you enter debugging mode, the bottom of VSCode will turn orange as shown above and will run the script a bit differently.

In debug mode, VSCode checks each line for errors as it runs. If a bug is found, you’ll be presented with this bright red window that points you to where the error occurred. This makes finding errors and debugging code much easier than depending on the terminal to tell you which line was at fault.

VSCode highlighting an error in your code. Image by author.

Wrap up

We’ve looked at one of the most popular IDEs and walked through the available features. For tips on installing VSCode for your OS and picking the best plugins for Python programming, make sure to read the chapter on VSCode at the Python.land website.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zach Goreczny

Zach Goreczny

College Student. Coffee Lover. Writes about Leadership, Business, and Data Science. https://www.udemy.com/user/zachary-goreczny/