Lecture 1: VS Code and LaTeX Workshop
This snippet will insert the following when you press TAP after typing vdm:
3.2.2 Example
-
If you have more than one snippets, you must put a comma , after each snippet.
So, for example, your latex.jason file should look something like this (notice the outermost pair of curly braces):
3.3 Write user snippets (with arguments)
- Using arguments you can create more flexible snippets.
- Arguments are of this form $1 , $2 , etc., and $0 .
- $1 , $2 , etc. mean the first argument and the second argument etc.
- You will be asked to type these variables when you use the snippet.
- $0 means the final location of the cursor when all the arguments have been typed.
3.3.1 Example
Consider the following snippet.
If you type m TAB z TAB , then the snippet will insert this:
3.3.2 Example (default arguments)
-
You can also set default arguments using $
For example, the following snippet has default values n and x for the arguments $1 and $2 respectively.
3.4 Exercises
Write a snippet that inserts the following and place the cursor in the middle.
Write a snippet that inserts the following and place the cursor in the middle. (Hint: a new line can be created using \n .)
Write a snippet that inserts the following, where x and n are given as default but can be changed to anything.
3.5 More Exercises
LaTeX Workshop has the snippet BCAS that inserts the following.
Write your own snippet with the same prefix BCAS that inserts
and asks you to fill A, B, C, D in this order, where D is set to be otherwise by default, and locate the cursor below the line containing \end
How to Create a New Workspace in VS Code
The Visual Studio Code Workspace is a collection of files opened in a single window. A Workspace can be a single folder but, in some cases, will include multiple files in a development workflow known as multi-root Workspaces. If you’re working on a project and have to open multiple files on this platform, the new Workspace feature can help. You will be able to open several files in the same window, making it easy to access all your necessary documents. The .code-Workspaces file is used to save the project’s folder configuration. Once configured, it will automatically open the various files in the same window. It’s also much faster and easier to set up than writing a shell script. Check out how to create a VS Code Workspace.

Creating a New Workspace in VS Code
Your Workspace is often the local copy of the team’s codebase that you can use to test and develop your code. In most cases, it’s created automatically when you open a VS folder. However, you might want to create multiple files to keep track of all the changes you make in different branches of the project. Here’s how to consolidate those files into a VS Code Workspace.
- Select the folders you would like in your Workspace.

- Add them to the Workspace by navigating to “File” then “Add Folder to Workspace.”

- With your workplace set up, save the new forum by going to “File” then “Save Workspace As.”

Your new Workspace has now been created on VS Code, and the name will show up as (Name).code-Workspace.
Workspace Settings
These settings override default settings and can be used to customize your Workspace to your liking. They are stored in JSON files, and their location will be determined by how you open your folder.
Single-Folder Workspace Settings

If you open a folder as a Workspace, the settings will be found in .vscode/settings.json.
Multi-Root Workspace Settings

If the folder you open is a .code-workspace file, all Workspace settings will be added to the .code-workspace file.
You can still customize settings per root folder, but the settings will override those defined in the .code-workspace.
Workspace Launch Configurations and Tasks
Similar to how settings are configured for Workspace, tasks and launches can also be personalized to suit a Workspace. If you have a folder opened as a .code-workspace file or a Workspace, the locations of task and launch configurations are in the .vsh file or .workspace file. These configurations can also be adjusted from the folder.
Optimize a New VS Code Workspace
With built-in support for various programming languages, including TypeScript, Javascript, and Node JS, Workspace is an ideal tool for developers. These tips will make the platform more efficient and easier to navigate.
Terminals
You might be utilizing the default terminal provided by your operating system. With VS Code, the platform wanted to make it so that you don’t have to rely on the OS feature. VS Code comes with a built-in terminal that has all your requirements in one place. It’s a great way to keep track of your development projects and ensure that they are running smoothly. With the ability to rename or change the icon color, it’s also easier to differentiate between the various terminals for your project.
Wrap Tabs
This feature is handy for developers who are working on large projects where multiple components are being used. It can be hard to keep track of all the files when moving from one component to another. In VS Code, tabs appear in the browser, and you will have to scroll from one to the other when you want to view what’s inside them.
A more efficient method would be to wrap these tabs by clicking Cmd + and searching for “Wrap Tabs.” This feature will make it easier to see what is in different tabs.
Pin Tabs
As a developer, it’s advisable to keep your Workspace as organized as possible. You can do this by pining tabs you often use to the front of your screen. You can also customize the look and feel of these tabs by hitting the Cmd + or Ctrl + buttons and searching for “Pin Tab.”
User Interface
The interface of your terminal is set up so that it has various options, such as explorer, search, project manager, and output. It also has a footer-like section where you can easily find and modify multiple details. In VS Code, it is possible to drag and drop these tabs, rearranging them to your liking. You can place the more frequently used options closer to the top or customize them to make them easier to access. Personalizing the user interface makes your Workspace easier to navigate.
Language
When creating a new page in Visual Studio Code, the file is untitled, and you will have to fill in those details yourself. You would then have to move to the file’s name and enter the extension. The process can be tedious, especially when dealing with a large number of files.
You can optimize the process by allowing the IDE to look at the files. It will then use the previous naming system to assign names to new files that you create.
Preview
VS Code has some frustrating features. For example, if you open a file in preview and then open another one immediately after without making changes to the first one, the program will close the first file. If you would like to change this and keep both files open in preview, go to Settings and search for “Enable Preview.” Tick the checkbox to make the necessary changes.
New PC Set-Up
You may have customized and personalized your VS Code Workspace to your liking, only to get a new PC. While a new machine is great, having to reconfigure your Workspace can be annoying.
Setting Sync allows you to save all of your configurations in one place. When you get another device, it will automatically apply the settings of the old one to the new VS Code Workspace. This way, you don’t have to reconfigure Workspace on your new PC.
Open Replay

Getting started with debugging a web app in production can be challenging and time-consuming. With OpenReplay, you can monitor and replay everything that your users do, allowing you to see how the app behaves and detect any issues that may appear. OpenReplay is an excellent option as it is a free, open-source alternative to other debugging applications like LogRocket and FullStory. Using a debugging program saves you a lot of time when using Workspace.
GitHub

VS Code comes with a built-in GitHub integration. This allows you to push your files to GitHub quickly. Connecting to GitHub from VS Code means that you don’t have to spend time writing git commands. The VS Code integration makes maintaining your files simpler.
All Your Folders in One Location
Workspace makes it easy for your team to stay organized. Files and folders can be stored in a single location, allowing them to be opened and viewed at the click of a button. Workspace can also be optimized to improve efficiency and help keep track of ongoing projects. With this guide, you are now well equipped to create a Workspace on VS Code and customize it to suit your needs.
Have you set up a new Workspace on VS Code? Let us know how you created and optimized your Workspace in the comments below.
What is a VS Code "workspace"?
A Visual Studio Code "workspace" is the collection of one or more folders that are opened in a VS Code window (instance). In most cases, you will have a single folder opened as the workspace but, depending on your development workflow, you can include more than one folder, using an advanced configuration called Multi-root workspaces.
The concept of a workspace enables VS Code to:
- Configure settings that only apply to a specific folder or folders but not others.
- Persist task and debugger launch configurations that are only valid in the context of that workspace.
- Store and restore UI state associated with that workspace (for example, the files that are opened).
- Selectively enable or disable extensions only for that workspace.
You may see the terms "folder" and "workspace" used interchangeably in VS Code documentation, issues, and community discussions. Think of a workspace as the root of a project that has extra VS Code knowledge and capabilities.
Note: It is also possible to open VS Code without a workspace. For example, when you open a new VS Code window by selecting a file from your platform’s File menu, you will not be inside a workspace. In this mode, some of VS Code’s capabilities are reduced but you can still open text files and edit them.
How do I open a VS Code "workspace"?
The easiest way to open a workspace is using the File menu and selecting one of the available folder entries for opening. Alternatively if you launch VS Code from a terminal, you can pass the path to a folder as the first argument to the code command for opening.
Single-folder workspaces
You don’t have to do anything for a folder to become a VS Code workspace other than open the folder with VS Code. Once a folder has been opened, VS Code will automatically keep track of things such as your open files and editor layout so the editor will be as you left it when you reopen that folder. You can also add other folder-specific configurations such as workspace-specific settings (versus global user settings), task definitions, and debugging launch files (see below in the workspace settings section).

A single-folder workspace opened inside VS Code
Multi-root workspaces
Multi-root workspaces are an advanced capability of VS Code that allows you to configure multiple distinct folders to be part of the workspace. Instead of opening a folder as workspace, you will open a <name>.code-workspace JSON file that lists the folders of the workspace. For example:

A multi-root workspace opened in VS Code
Note: The visual difference of having a folder opened versus opening a .code-workspace file can be subtle. To give you a hint that a .code-workspace file has been opened, some areas of the user interface (for example, the root of the File Explorer) show an extra (Workspace) suffix next to the name.
Untitled multi-root workspaces
It is easy to add or remove folders in your workspace. You can start off by opening a folder in VS Code and then later add more folders as you see fit. Unless you already have opened a .code-workspace file, the first time you add a second folder to a workspace, VS Code will automatically create an "untitled" workspace. In the background, VS Code automatically maintains a untitled.code-workspace file for you that contains all of the folders and workspace settings from your current session. The workspace will remain "untitled" until you decide to save it to disk.

An untitled multi-root workspace opened in VS Code
Note: There is really no difference between an untitled workspace and a saved workspace other than the fact that an untitled workspace is automatically created for you for your convenience and will always restore until you save it. We automatically delete untitled workspaces (after asking you for confirmation) when you close a window in which an untitled workspace is opened.
Workspace settings
Workspace settings enable you to configure settings in the context of the workspace you have opened and always override global user settings. They are physically stored in a JSON file and their location depends on whether you opened a folder as a workspace or you opened a .code-workspace file.
Refer to the settings documentation for a comprehensive explanation of setting scopes and their file locations.
Single-folder workspace settings
Workspace settings will be stored in .vscode/settings.json when you open a folder as workspace.

The Settings editor when a folder is opened as workspace
Multi-root workspace settings
When you open a .code-workspace as workspace, all workspace settings will be added into the .code-workspace file.
You can still configure settings per root folder and the Settings editor will present a third setting scope called Folder Settings:

The Settings editor when a multi-root workspace is opened
Settings configured per folder will override settings defined in the .code-workspace .
Workspace tasks and launch configurations
Similar to how workspace settings are specific to a workspace, tasks and launch configurations can also be scoped to a workspace. Depending on whether you have a folder opened as workspace or a .code-workspace file, the location of workspace task and launch configurations will either be inside the .vscode folder or inside the .code-workspace file. In addition, task and launch configurations can always be defined at the level of a folder, even when you have opened a .code-workspace file.
Refer to tasks and debugging chapters for a more comprehensive overview of how to use tasks and launch configurations in VS Code.
Common questions
What is the benefit of multi-root workspace over a folder?
The most obvious advantage is that a multi-root workspace allows you to work with multiple projects that may not be stored inside the same parent folder on disk. You can pick folders from anywhere to add to the workspace.
Even if you are mainly working in a single-folder-based project, you can benefit from using .code-workspace files. You can store multiple .code-workspace files inside the folder to provide a scoped folder-view of certain aspects of the project depending on the scenario (for example client.code-workspace , server.code-workspace to filter out unrelated folders from the File Explorer). Since .code-workspace files support relative paths for the folders section, these workspace files will work for everyone independent of where the folder is stored.
Finally, if for some projects you want to apply the same set of workspace settings or tasks/launch configurations, consider adding these into a .code-workspace file and add/remove these folders from that workspace.
Why is VS Code restoring all untitled workspaces on a restart?
Untitled workspaces are designed to be something you must explicitly decide to keep or not. The first time an untitled workspace is created, VS Code adds the specified folders into the workspace file and also all existing workspace settings. This user data is always restored and displayed in a VS Code window until the untitled workspace is saved or deleted.
How do I delete an untitled workspace?
You can delete an untitled workspace by closing its window and dismissing the prompt to save the untitled workspace.
Can I use a multi-root workspace without folders
It is possible to leave the folders section of a .code-workspace file empty so that you end up with an instance of VS Code that does not show any root folders. You can still store workspace settings and even tasks or launch configurations in this case.
Does VS Code support projects or solutions?
VS Code doesn’t have the concept of a "project" or "solution" as they are sometimes defined in other development tools, for example Visual Studio IDE. You may see the term "project" used in VS Code documentation but it usually means "the thing you’re working on". Depending on your programming language or framework, the toolset itself may support something called a "project" to help define build configurations or enumerate included files.
Why Workspaces Will Up Your Efficiency Game
Do you ever find yourself working on a project and having to open multiple folders in vscode manually? Well, VSCode Workspaces can do this for you by opening several folders in the same window with one click.
Workspaces are a .code-workspaces file that save our project folder configuration. Once configured, instead of opening multiple folders manually the .code-workspaces file opens them for you. This is much faster and easier then writing a shell script or setting up a custom command because one set up it can be as easy as one click.
Now, let’s check out how to make a workspace!
A Step by Step Guide to Making a Workspace
Step 1 — Pick Your Folders
Before we do anything we need to know which folders we want in our workspace. The great part about workspaces is that these folders and files can be anywhere on your computer!

Step 2 — Add Your Folders
Now that we have our folders selected, you can add them to your workspace. In vscode, go to File > Add Folder to Workspace

Once you’ve added them in, this is what your vscode file explorer will look like. Notice the round circle to the left of each folders name.

Step 3 — Save Your New Workspace
With our workspace set up, the last thing we have to do is save it so we don’t have to make it again. In vscode, go to File > Save Workspace As

Once you save your new workspace, it should show up as a [NAME].code-workspace file wherever you saved it. Now you can open it whenever you want to work in those folders together!

When you open your new workspace, you should see its name in the file explorer.
Hot Tip
If you use a Mac and have Alfred, you can make this even better by setting up a workflow to open your .code-workspaces in vscode via a command. This can mean typing one keyword versus opening vscode and searching your computer files each time.