Become a VS Code Power User

Common Setting Customizations

Steve Kinney
Temporal
Become a VS Code Power User

Lesson Description

The "Common Setting Customizations" Lesson is part of the full, Become a VS Code Power User course featured in this preview video. Here's what you'd learn in this lesson:

Steve explains various settings and customization options in VS Code. He mentions that you can have custom settings for different file types and languages, and even set the default language for new files. He also discusses the ability to copy and share specific settings, as well as the option to sync settings across different devices.

Preview
Close

Transcript from the "Common Setting Customizations" Lesson

[00:00:00]
>> Steve Kinney: What I think is and it doesn't look all that special, but you can also say for given file types, custom settings. Which is, okay, these are my settings but if I am in this case, I just want prettier on all the things. I can probably move that out of one, I think what happened is if you go to format a file and there is no formatter set, it goes, which one do you wanna use?

[00:00:26]
And then it updates this, I didn't do this by hand. But you can theoretically for different kinds of files, let's say hypothetically you're working at a code base where the front end engineers really want two space indents, but the Python engineers want four space tabs. Or does it go eight spaces or something horrific?

[00:00:48]
So theoretically for the go files, you could have the settings for the go files and for the Typescript files. You can get a little more nuanced, and like we said before, those language preferences like Stack. So TypeScript is an extension of JavaScript, JavaScript React is an extension of JavaScript.

[00:01:08]
Markdown might be an extension of HTML at one point, you can see all these things at various points. Also if you open up a brand new file, what you want the default language to be rather than plain text. If I'm preparing for a workshop, I want it to be marked down.

[00:01:28]
If I'm writing code at work, I usually wanna be TypeScript, cuz I'm just trying to scratch something out, right? But you can set what you want it to be. This one will also then try to you just start typing it will try to figure it out. Works great for people a little bit more patience than me.

[00:01:43]
Yeah, a this point I changed the terminal font size, so on and so forth. This is when we set that material icon theme just before we target extensions, that's in here now. The setting I just changed earlier, it's here now as well. And the nice part is for any given setting, you can right click on it or maybe hit the gear.

[00:02:03]
You can copy that setting ID just that setting as JSON. Literally linked to the setting to somebody. So they click that link into Open VS Code at that setting, so on and so forth. If you have multiple profiles, you can pick what sinks and what doesn't. A lot of different setting features in there, yeah, I have usually this always turned on, which is update the import on file move.

[00:02:26]
I don't know if that's the default or not, but if it doesn't work, that's the one where if I move the file and it changed all the imports automatically for me, love that. Organize imports will, if you have an import that is not used in that file, it will just remove it, right?

[00:02:45]
Yeah, you can also have it set to sort them, which for some reason is a hill that I wanna die on. In our core project, I actually have an ESN rule that follows my very type A ordering, which is Node stuff first, then a space. Then third party libraries, then stuff in my utilities folder, then relative stuff, and then React components, or spell components.

[00:03:17]
I feel strongly about this, no one else on my team does, but I'm the boss. So guess what we do? If you hate the mini map, you can turn that off, I don't know. These are esoteric ones, but they're there, but whatever it is, if something's not behaving the way you like, you can open the settings.

[00:03:37]
You can search, and if we open up the default settings,
>> Steve Kinney: It's all the default settings, great, who cares. More importantly, descriptions of what the options are.
>> Speaker 2: How long is that file?
>> Steve Kinney: Let's go to the bottom. It is 11,166 lines. But as you can see, a lot of that is my VS code pets, all right and so this will be also all your extension.

[00:04:13]
But you can kinda, in a lot of cases, you can always see what the options are super easily if you go into any of these obviously if it's got to drop down. It'll show you what the default is. And you can see all the options what they mean, but this is very tedious.

[00:04:29]
Sometimes if you're just trying to get a sense of what are all the things I can do and what do they all mean? You can open this file and get a sense of what they all are. They are the default settings, it doesn't really matter, but it's sometimes, if I am trying to tweak stuff maybe I'm, I don't know, ridiculous, but this is helpful to me.

[00:04:52]
You can be like, I don't ever want to see this again. And I hear that, that's valid as well. Cool, so yeah, those are, the other one that I think is, let's see if we can do it in here, that is useful.
>> Steve Kinney: And I turned this one off, which is associations, which is extensions that you want to be treated as something else, right?

[00:05:23]
So for instance, if you have a certain file that's got maybe some weird extension, but no, it's kinda just a CSS file. You can say the key is, let's say I'm trying to come up with a fictitious. SCSS, treat it like CSS or, and now, if somebody opens that type of file, it'll be that file extension, but it will be treating that file extension as if it's CSS, markdown.

[00:05:56]
All right, what have you, if you just like, yeah, I understand this is a ridiculous file extension, but dot d, HTML should just be HTML. You know what I mean? You can associate different file extensions with different languages, useful for, even some files that I didn't start at SCSS, but a license you could then treat as markdown.

[00:06:20]
>> Speaker 2: Or if you have records that expand inside another file type.
>> Steve Kinney: Yeah, exactly, right? And so if you need to say hey, just treat this as whatever, it will do that as well. Yeah, also to little stuff like that, if your other setup doesn't do insert a new line, a trailing new line, or remove all white space at the end, on save, right, all of those things as well.

[00:06:48]
The other one that I have is some of these, if they are complicated, you have to go into the JSON view. But as you can see, these editor code actions on save, which is organize my imports on save, fix any ESLint errors you can fix by yourself. Don't make me run ESLint dash dash fix, I don't want to.

[00:07:13]
Sort the imports, you can have, certain of these, refactors or, whatever automatically apply when you save. Right, and you just kinda tweak them over time. Some of these were probably set when I got asked to confirm that I didn't wanna do this, right [INAUDIBLE]. You can have all that in place as well, yeah.

[00:07:33]
I don't ever wanna see the release notes again for every version of VS code, right?
>> Speaker 3: And dditional one for that code actions on save that was suggested in the chat was to remove unused imports.
>> Steve Kinney: I think organized imports does that too.
>> Speaker 3: They had both in there, they had organized imports and remove.

[00:07:58]
>> Steve Kinney: I mean, I'm doing that.
>> Steve Kinney: Well, now, I usually do the-
>> Speaker 3: Actually, I should clarify organizeImports was set to explicit.
>> Steve Kinney: Yeah-
>> Speaker 3: I don't know if-
>> Steve Kinney: Explicit, I think, asks if you wanna do it, I don't ever wanna be asked. [LAUGH] That's why I got version control.

[00:08:16]
[LAUGH] But the nice part is, as you can see, you can also, just like the intellisense is pretty good in here. Admittedly, I'm gonna regret some choices in a week cuz I'm not even paying attention to what I'm picking. I'm just like, that seems cool while I'm talking.

[00:08:33]
And then a week from now, I'm going to cause an incident. Luckily, none of my students watches this, so they won't know, they have to hear me talk all day. They don't wanna tune in for bonus listening to me talk, cool. But yeah, lots of settings in there, and like I said before, there is, I think you can do it settings, sync.

[00:08:57]
I have it set up, but you need to be logged in with I think github and you can choose to synchronize your settings. So all the dumb things I'm doing right now on my personal computer, when I open my work laptop, I will inherit all those things, for better or for worse.

[00:09:18]
Let's hope I remember what I did even the UI state, which is kinda of cool. I can open up a different laptop and all my panes and stuff will be open.
>> Speaker 2: Does it version control these settings, I think?
>> Steve Kinney: No. Push to mean.
>> [LAUGH]
>> Steve Kinney: I think it's just conflict resolving a JSON file or whatever.

[00:09:38]
And I'm sure the last one wins, I don't think it's particularly sophisticated technology. Yeah, I might come to regret it. The other thing you can do is you will know if you need this, is that you can create these things called profiles. And all a profile is, it's like you have those user settings, but what if you had different people at different times, right?

[00:10:09]
Like I said before the extensions that I have when I'm working on or doing pies I don't need running the rest of the time, right? There's a whole bunch of micro Python ID, serial port, I don't need that. There's some BS ones I made just rehearsing where you can basically have different sets of snippets for different use cases, different settings, so on so forth.

[00:10:35]
It's basically different user profiles. You can create one, I would say, yeah, if you don't want a bunch of extensions running, but you wanna be able to turn them on or slightly different settings, it's useful. I would say for the average person, probably not super useful. But there, if you need it, and that's part of my job right now, is to say this thing exists for the 5% of you that desperate will be like, yes, and the other 95 will be like, moving on.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now