VS Code

Introduction

VS Code is one of the most popular code editors that prides itself on being less of an IDE and more of a extension expandable source-code editor. It's not purely a source code editor though due to those extensions. Thus it exists within a middle ground between a full IDE and a pure source code editor.

Install

Generic Download & Install

If VS Code works on your system, then the download link on the homepage will work. There are however other ways that are often easier and more reliable.

MacOS

Homebrew is a package manager for MacOS. It can be used to install VS Code, via the terminal with the following command:

brew install --cask visual-studio-code

Linux

TODO go over flatpak, and package manager installs

Debugging

Debugging in VS Code is done via the Debug tab in the left sidebar, or the Ctrl+Shift+D keyboard shortcut. To start a debug session, you need to have a debug configuration in the .vscode/launch.json file. This can be handled through the Debug tab in the left sidebar, or the JSON file itself.

Breakpoints

Breakpoints are used to pause the program at a specific line. They can be added by clicking on the line number in the code editor, or by using the F9 keyboard shortcut.

It's also possible to set breakpoints in the Debug tab in the left sidebar. This includes setting breakpoints for specific conditions, like a variable containing a specific value.

Debug Actions

Debug Console

The Debug Console is a terminal that is opened when you start a debug session. It is used to interact with the program being debugged. It can be used when paused at a breakpoint to interact with the program, this includes using scoped variables for that line to get the result.

Variables

The sidebar in the debug tab has a Variables section. This section shows the variables that are in scope for the current line. It also shows the values of those variables. You can watch variables by right clicking on them and selecting Add to Watch. This will add the variable to the Watch section of the sidebar.

References

Web Links

Note Links