Visual Studio Code for Python Developers Transcripts
Chapter: Exploring the Editor
Lecture: Settings
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
All right, now it's time to get into settings for Visual Studio Code.
0:04
VS Code settings allow us to tailor our coding environment the way we would like it.
0:11
And that can be specific to what projects you have open or general development purposes.
0:16
But there's a few ways to get access to the Visual Studio Code settings.
0:21
First of all, one of the more common ways if you're more of a visual person through the UI is by going to File, Preferences, and then Settings.
0:30
But that takes a little bit, a few clicks. You've got to use your mouse. If you want to use your keyboard and have quicker access to the settings,
0:38
you can press, as you saw there, while I'm on Windows or on Linux, you can press Control, comma, which I just pressed to bring this up.
0:46
You get the settings view. Or if you're on macOS, it would be Command, comma.
0:50
And last but not least, one of the other ways that you can do it is through the Command Palette.
0:55
So to bring the Command Palette up, you press Control-Shift-P on Windows and Linux. On MacOS. On MacOS, it's going to be Command-Shift-P.
1:02
And then in here, I can just type in Settings, or if you wanted to, you could say Preferences as well. Right? And Open Settings UI.
1:10
So that's the one you would want. And it brings us right back to that Settings UI there. So use whichever one you prefer.
1:18
I personally feel that it's more efficient to just press Control, comma, for Windows and Linux, and Command, comma, for macOS.
1:25
Now, as we're looking at the Settings UI here, you'll notice... at the top here, there's a few different tabs.
1:32
Now, you may not see all the same ones that I have, but in particular, you should see a User and a Workspace at least.
1:38
What that does is it encapsulates settings based on the different environments you might be working within.
1:43
So when it comes to User, that's your user level settings. That's more globally applied across Visual Studio Code.
1:51
And then Workspace is for the current workspace you're using and have open within Visual Studio Code. So in this case, this base Python project.
1:59
So I can have settings tailored to that environment versus settings at a more global level at the user environment.
2:07
You'll also may notice that I have this other one. It's for remote development environment. So I'm working within Windows Subsystem for Linux.
2:13
So if you are doing something like that on Windows, you might have the option, this option here to configure settings based on that environment.
2:21
Or if you're working within a dev container, for instance, which is outside the scope of this course,
2:26
you'll be able to apply settings based on that as well. But the remainder of this, we're going to focus on user level or workspace level settings,
2:34
and you can ignore that remote one. So within settings, you can actually search for whatever type of setting you might want.
2:40
I know right off the bat, you can see at the front here that there's font sizes.
2:43
But if I couldn't find that or I didn't know what it was I was looking for,
2:47
you can start typing in the search box here to look for what you're wanting. Maybe I want to change the font, right?
2:53
And I want to find all settings based on font. I just type that into the search box and I could see I get 44 different settings,
2:59
related to font, font size, font family, and so forth. It's very, very efficient, very helpful to have that search box.
3:06
It's improved quite a bit over the years since VS Code has been available.
3:10
And I use that quite often, even if I don't know the exact name of the setting that I want to change,
3:15
to find what it is that I need, and it's super helpful. So that's how you navigate settings in Visual Studio Code.
3:21
Again, you can encapsulate them at the user level, workspace level.
3:24
But one other thing I want to talk about with this is you can actually sync these settings.
3:28
So if you work on more than one machine, so for instance, I work on a macOS machine for a laptop,
3:34
but when I'm on a desktop, I'm on Windows, I can sync these settings across instances of Visual Studio Code,
3:40
across operating systems as well, and machines. The way you can do that is by going to the gear icon in the bottom of the activity bar,
3:48
clicking on that, and you can see I have settings sync as on.
3:52
I'm going to turn it off really quick to demonstrate what that flow is like, or I can configure it to all the different
3:58
options that you have related to settings sync. What ends up happening is you sign into either a GitHub account or a Microsoft account.
4:05
This is what the option will look like for you if you've never set it up before, backup and sync settings.
4:11
You choose which settings you want to and UI state and extensions that you want to include as part of this. We'll get into profiles in just a moment.
4:19
I generally choose all and then you click on sign in and that will take you through the sign in flow with options to sign in with GitHub,
4:26
which I'm already signed into my Clarkio GitHub account. Or other Microsoft based accounts.
4:30
And what that will do is store your settings in a secure manner in the cloud based on whichever one you signed into.
4:37
And that way when you sign into a new machine in Visual Studio Code with that same account, your settings will be synced over along with all those other capabilities that are incorporated into your account like extensions and profiles and stuff like that.
4:51
Okay, I'm signed back into my settings sync account.
4:57
Now the last thing I want to touch upon this when it comes to settings because I think it's related and it's really nice and I'm using it actually for the purposes of this course.
5:04
You can create profiles and those profiles will be a further encapsulation of your settings.
5:11
So in this case, I have a profile that's Python dev recording, but I have other ones for when I'm presenting or my just default one or VS Code default.
5:21
You can create all kinds of different profiles. You can edit the profile. You can delete profiles export. And import. We can use that.
5:28
So if you want to share with a colleague like your Python, the perfect Python settings and environment within Visual Studio Code, you can export that profile and share it with colleagues and friends that want to use the same approach.
5:41
Same environment that you're using for developing in your Python projects. And that folks concludes everything at a high level.
5:49
What you need to know to get familiar with settings in Visual Studio Code.