Before we can write some code, we need to open some files.
Doing that as quickly and efficiently as possible lets
you get right to work.
Clicking on the File menu reveals the familiar open file option. That
works great if you only want to quickly open and edit
a single file.
If you're working on an entire application,
then you'll likely need to open more than just one file.
I generally store my projects in a single folder and open the
entire folder in VS Code.
With the entire folder open, you can easily navigate subfolders
and edit any files in those folders.
In the VS Code documentation, Microsoft often uses the terms
folder and workspace interchangeably.
A single folder is a workspace, but you can also have workspaces
that consist of multiple root folders. That requires you to
create a workspace file that stores a reference to each
folder in the workspace.
You would open a project like that using the Open Workspace
from File option.
I've already got a folder open in this instance of VS Code.
I can view it by clicking on the explorer icon at the top of the
activity bar here on the left.
Expandable subfolders are displayed at the top and
individual files at the bottom.
The project I've opened is a website for a fictional travel
agency named explore-california.
I'll be using some of the files in the project just to demonstrate
some VS Code features throughout the course.
Single-clicking on a file opens it in the editor pane.
Notice that the name of the file on the editor tab is italicized.
Single-clicking on a different file replaces the open file on
that tab with the new file.
I can open a file and pin it to a tab by double-clicking on it.
If I wanted to add another root folder to this workspace,
I can go back to the File menu and select "Add Folder to Workspace."
I'll choose this mobile-app folder to add to the workspace.
You can now see I have two root folders in my workspace.
I can save this configuration by going back to the File menu and
choosing "Save Workspace As."
I'll choose the default name of explore-california.code-workspace.
I'm now going to quickly close VS Code and show you another option
for opening a project that I use quite a bit.
I'm often working in a terminal and decide to open a project.
You can do that by just typing code followed by what
you want to open.
You can open the current directory by just typing a dot.
I'm going to type the name of the workspace file I just created
to open my entire project.
I'm quickly back in my pre-configured workspace and ready
to write some more code.
Now that you see how to open your projects in VS Code,
let's see some options for navigating your files and
executing commands with the command palette.