Comp 101 VS Code Tips and Tricks

VS Code Tips and Tricks

Sometimes things just don't go your way. This can be especially scary when you run into issues with VS Code you've never seen before.

But fear not! Most issues with VS Code are non-serious and can be easily resolved! Below are some of the most common issues we've seen with VS Code and how to fix them. Don't see your issue here or the solution didn't work for you? Come by office hours and a UTA will be more than happy to help you out!

My workspace is GONE

Go to the "File" menu in VS Code and select "Open Recent." If you see your COMP101 folder here double click and tada! Problem solved.

I can't see my files when I'm in my workspace in VS Code

Click on the Explorer button (this guy)--->

The file explorer pane should now show up!

My terminal is gone!

Navigate to the "Terminal" tab and select "New Terminal." Terminal should pop up at the bottom of your VS Code window.

My terminal isn't in bash

In the view menu (towards the bottom of your VS Code window) click on the drop down menu and select bash if it is an option.

If bash is not an option go to the "View" menu at the top of your screen and select "Command Palate..." Then type in "Terminal" and select "Terminal: Select Default Shell". Windows User? Select "Git Bash" Mac? Select "Bash"

How do I update course content or run a program in the browser?

To pull lecture materials type "npm run pull" and hit enter in the terminal.

To run a program type "npm start" and hit enter in the terminal.

I made changes to my code but they aren't showing up when I run the program

Double check that you saved the file you changed!

Pssst. Here's a shortcut: Windows - Control + S or Mac Command + S will save your files while cutting down on the amount of clicking you have to do!

I get a SUPER SCARY LOOKING error message when I try to run my program

Seeing something like this?

Although it may look scary this error message is giving us lots of valuable information!

This message is telling us that there is an error in one of our files, in this case 00-variable-usage-app.ts which is preventing our code from compiling. If we look for this file in VS Code we should see that its name is highlighted in red since it contains errors.

On the last line of this message we also see which line of our code has the error (in this case it's 17) and what the issue is (in this case it can't find the function named main).

Once we fix whatever issue is in the file and save it the error should disappear!