 Have you ever needed a suggestion for what function you need to be calling while writing code? Well, learn more with the brand new IntelliCode extension team completions on this episode of Visual Studio Toolbox. Hey everyone, welcome to Visual Studio Toolbox. I'm your host, Leslie Richardson, and today I'm joined by Katie Caldwell, who is a senior program manager on the Visual Studio IntelliCode team. Welcome, Katie. How are you doing? Hi, Leslie. So IntelliCode is one of those features that I think a lot of us find ourselves using on a regular basis in Visual Studio without even realizing it. So can you tell us more about what it is? Sure. So IntelliCode is this set of AI-assisted developer tools that are available to you in Visual Studio. So if you've seen those starred completions that pop up in your IntelliSense list when you're typing like a class, yeah, that's IntelliCode. We are assisting you as you're typing to make you more productive. Not going to lie, I absolutely love those stars when they pop up as I start typing. Let's work for me to do. Awesome, not my problem. So we're on the street is that there's a new extension to IntelliCode called team completions. So can you tell us a little more about that? Yes, Leslie. So we actually introduced completions or IntelliCode completions about two years ago during build 2018. Since then, we have been working on some other features, more specifically like you mentioned team completions. So the base completions were learned and trained off of open-source repos and GitHub, and that they provide you some of those completions based off of common open-source repo usage. But what happens when you have custom types within your code base, which happens all the time, right? Team completions provides you with completions based off of your own code or tailored to your own code. That's really cool. So if I'm new to the project or that particular repo, I don't necessarily need to know every method name or function call or property under the sun because IntelliCode can give me that suggestion, right? Exactly. So team completions really is just learning from your own patterns or your own team's patterns. So it's great for that scenario. So if you are an onboarding developer to your team, you can just use some of these common properties or types automatically and helps you get onboard it really, really quickly. Cool. Well, I'd love to see team completions in action. Got a demo for us? I do actually. So I'm going to head over to Visual Studio now and share with you how team completions works from the client. Awesome. Cool. Okay. So as I mentioned before, you're probably familiar with custom code completions or with regular IntelliCode completions. So as I'm typing, you can see the intelligence list pop open. So as you can see, you'll see the IntelliCode stars here. My favorite icon. Yes. So this is, as I mentioned, trained on thousands of open-source repos, and it is based off of usage. So right-line is a very common method, and therefore when I'm typing console and invoking that class, the method right-line is more likely is what I'm going to use. As you can see, I've used it above as well. So it's a very common class, right? Or common method. So what happens, as I've shown you, is I have the Magic 8-Ball solution open, and so if you're probably familiar with Magic 8-Ball, it's like the physical 8-Ball where you shake and you get to the question and it gives you after an hour or other things, right? The thing that always tells me what I don't want to hear. Yes, exactly. And so I've created, I've actually written a console app, which simulates that same Magic 8-Ball experience. And as I did that, I actually wrote my own, as you can see, I've created Magic 8-Ball, I've created a class called Magic 8-Ball, and I actually invoke it in a couple of different places. So I'm going to go to program.cs, and so you can see where I'm actually using that Magic 8-Ball class, right? Yep. And so generally what will happen is, let's actually just, I'll just rewrite the above, so you can see. If I actually try to use the Magic 8-Ball class, I'm getting that IntelliSense list pop open, which is giving me some of the methods that are available in the class. However, I'm not getting those starred completions as I just showed you before, right? Right. How do I get that? And so what we've actually worked on is the ability to actually train a model to get those sort of those stars for that Magic 8-Ball class. And so I've already built this solution right before starting up this demo. And once after you've built this solution in Visual Studio, we've now enabled this gold bar to pop open after a successful build. And it allows you to actually set up an automatic training of these team completions for Magic 8-Ball for this solution. And so all I have to do is click Yes Enable It. But as you can see, I can click this, which will take me to the documentation to learn sort of what is happening behind the scenes. But let's click Yes Enable It and then I'll walk you through what's happening behind the scenes. Cool. So I clicked Yes Enable It. And so as I do that, what it does, it takes me to the Visual Studio IntelliCode UI, where I learn a little bit about what's happening behind the scenes. So what's happening behind the scenes is that IntelliCode is analyzing this solution. So it's analyzing Magic 8-Ball locally. And it's sort of understanding the types that are available and their usage across the solution. And then what it does is it then sends that to the IntelliCode service. And then IntelliCode will actually use our compute and actually generate a model that will provide these team completions back to my solution. And as I mentioned, our model is ready. And so let's go back to program and let's actually see it working. So before, as you could see, we weren't getting those stars for Magic 8-Ball. But now let's see if we can get those stars once we invoke. And look at that. Oh, awesome. That's super cool. So we're now seeing those IntelliCode stars, which is super, super helpful. As you mentioned the scenario, if I'm onboarding as a developer to a new team, I can, like using these stars would be super, super helpful. And so, yeah. And so this is a way to get those stars directly in Visual Studio. But let's say that you're working in a repository that just is like really, really fast turning. So, everyone is like pushing new code every single day. And you're not able to train this model as often because from Visual Studio IntelliCode will decide when to train. And right now we're only training every 30 days. And that way it just sort of helps us distribute the load and make it so that we're able to sort of provide these awesome stars to everyone. But let's say that you want to automatically refresh these completions for your team. So how do you do that? So we actually have enabled a GitHub Action. And I'm actually going to head over there. And as I head over there, I'd love to talk to you a little bit more about what is this GitHub Action for team completions? Yeah, that's a new buzzword I've been hearing around lately. Yeah. OK, so now I'm going to show you. I showed you team completions in Visual Studio. How about what if I want to automate these code completions for my team? And actually every single push on my team to my repo, I'm able to get these completions. So we have a GitHub Action that does just that. So I'm going to head to GitHub and show you our GitHub Action in action. So what is a GitHub Action? So a GitHub Action is a way to sort of automate some something that like anything. So right now, the IntelliCo team completions is a GitHub Action. It's a way to sort of automate some process as part of your CI workflow. So if your team is using GitHub or using Azure DevOps to actually perform their CI, so every time your code is being pushed and merged into sort of a main branch, then you can actually set up an action as part of that CI workflow to actually train the same model for completions and then distribute it to everyone who has access to that repo. So that's a very high level of what it is. But yeah, IntelliCode has started to use GitHub Actions to make it easier to automate some of these cool things that we do in the inner loop as part of your team's outer loop. Yeah, that's great, because I know CI CD things are not the greatest workflows to set up sometimes. They can be a little hard to do. Yeah, actually, we've made it really, really simple. And so I'll walk you through at a very high level of what our GitHub Action does for IntelliCode team completions. And then I'll just share with you and show you how it runs in action. It's very, very simple to set up. So if you're seeing my screen, you should be able to see sort of our GitHub Action on the GitHub Marketplace. And so here, you'll see what the requirements are for setting this up. And I've actually written out a sample YAML file, which is sort of really declaring as part of your workflow how to use this action. And so if you can tell that on push to our main branch, we're actually enabling IntelliCode to train a model for these team completions. And so as I mentioned before, this makes it so that if I set this up for my team and this repo, I'm able to share these team completions with everyone who has access to this repo without them having to do anything. They just automatically get these completions without actually having to do anything on their part. That's really cool. So if somebody changed the context of a specific function or something without your knowledge, then you're still going to get that update that tells you the new way to use that function. Exactly, Leslie. Exactly. And so what I've done is to do just exactly what you said. Let's actually go to a shared repo that I have with someone else on my team. As you can see, this is a previous training that I did that was successful. So I'm going to actually run through this to show you that it's so simple. So it doesn't have to be a function update to sort of train this model. What I did was I actually earlier today just wrote out some sample code in a README file. And it doesn't have to be this text. Let's just say demoing GitHub action or team completions. I'll put in telecode in there so you can remember that's in telecode. And so all you have to do is commit these changes. So updating the README. And so I will commit them directly into our main branch just for the sake of this demo. And what I'll do is I'll go to the actions. And as I said, I defined in my YAML that on push, we're going to train a model for team completions. However, I could have defined it any way. I could say it doesn't have to be on every single push. It can maybe be on a push to a specific branch. If I want to, it doesn't have to be for the main branch. But let's actually go see what's happening. So I'm looking into the Intel Code team model trainer, which you can find in the action section of that repo. And let's actually see what's happening. So as you can tell, what's happening is we're training. So we've already set up the job. We're running the action. So we're actually running our GitHub action. And it's going based off of that definition that I've already written in that YAML file. And now we're actually running and actually computing our new model. And so yeah, and this should take no longer than a minute. I've done this earlier today just to prep myself for this. But yeah, what's happening behind the scene is the exact same thing that happened from Visual Studio. So it is analyzing the code in this repo. It is finding all the types and the type usage. It's sending that to an Intel Code service. And then it's computing a machine learning model for this repo. And then it's sending this back to this repo. So as you can tell, what we've done is I've created a model. And it's the C-sharp model. And it's just been updated. It says when it was originally created and when it's been updated and when it was last trained. And now you can see that it is actually complete. So this is all you need to do to set up your GitHub action and run it and actually get a model. So now anyone who has access to the top-down shooter repo, they are able to get these start completions, which is super, super cool. So either way, from Visual Studio, which we in Intel Code will schedule and train a model for you if you set up automatic training in Visual Studio, or from our GitHub action, you can get these team completions and really help your team be more successful. That's very exciting. Who doesn't want to be more productive and feeling like they don't have to pull their hair out, just freaking out over what do I do with all these functions? I don't understand the context of this, that, or whatnot. So very exciting. So I mean, every good thing comes out of cost, right? So what are some of the limitations that the team completions currently has that people should be aware of? So I think the limitations that I will mention is that from Visual Studio, you're only able to set up the automatic training in Visual Studio for C-Sharp projects. So we are considering expanding to more languages. But for right now, this is only C-Sharp. It's only available for C-Sharp developers and training for C-Sharp projects. For our GitHub action or Azure DevOps build task, if you're on Azure DevOps for your CI or using Azure DevOps for your CI workflows, we are available for both C-Sharp projects as well as C++ projects. So that's only our CI-based model training 14 completions. And you should feel free to try it out. We do have some build configuration options that are a bit limited from CI. But we are mainly available for just MS Build, if you're familiar with MS Build. And a couple other options are available that you can find on our GitHub Action Marketplace site. So just search our GitHub Action on the Marketplace. It's called IntelliCode Team Completions. And you'll see the list of all the limitations. So MS Build and CMake are the build agents that we are limited to for GitHub Action. Cool. And can I use this in VS Code? You cannot. Unfortunately, this is a Visual Studio feature for right now. We are considering expanding to Visual Studio Code. But we are first trying to make sure that we delight our Visual Studio developers. Gotcha. And finally, speaking of expanding, what's next for IntelliCode? Oh, my goodness. We have so much up our sleeves. So IntelliCode is working with just the top of the line researchers who have been researching developer productivity. And we are working on intelligent snippets. We're also working on completions by example for daytime formatting, as well as regular expressions. So great, I hate daytime formatting. We're also working on, if you're probably familiar with our suggestions feature, it was formerly known as repeated edits. We are working on sharing those with your team, just like we have completions that are shared with your team. So we're working on our team suggestions feature. And we're also working on some other cool features like whole line completions. And so we definitely demoed that last year at Ignite. And we are still working on that experience and hoping to have a preview of that in just a few short months. So we're doing a lot of things to really promote the best practices for your team and to really unblock those onboarding developers to just get them to be as awesome and qualify to sort of focus and get more focus time as anyone else who's been on your team for longer than a day. And we're really trying to help ensure that people can feel like they're doing the most creative work that they want to and sort of removing those tedious tasks. So yeah, and if you have any wants, feel free to go to the IntelliCode GitHub page and provide us with your top feedback of other features you're interested in, because we really want to help every part of the developer experience, including all the knits that you find at the code review time. We want to make it so that it's less onerous and tedious and really, really fast to just sort of save you that time. Sounds great. It's going to be really scary in the next couple of years when we've reached the point where new people starting their new jobs are coming out of their first day. Yeah, I just wrote a whole program in one day, thanks to stuff like IntelliCode. And you're just like, what did you do on your first day? I set up, yes. Now, we're trying to remove that whole sort of configuration hassle, right? People didn't have to just set up everything on their first day. If they didn't have to sort of fight with making sure that they have permission to the right things, if they didn't have to learn, all these different libraries and making sure that they have the right libraries, and if they didn't have to sort of fight with old code and new code, we're really trying to sort of help that experience. And it's not to really assist you per se, but really what we're trying to do is we're like, IntelliCode is really, our mission is really about making sure that you have the focus time to just be creative. That there's just so many aspects to being a developer that changes so quickly. And the half-life of a developer skill, or even learning a coding language, is often just like, I think it was 18 months a few months ago, and now it's even down to nine months. What if you could just sort of harness that wisdom from not only the broader generic community, but also your team, and learn and use those best practices from the team to really sort of help you just sort of save you time from onboarding, save you that extra energy that you're putting in to learn what the practices are, or whatever the styles that exist, or what if you didn't have to do that? What if you just started typing, and you just were able to get all these stars, or get all this help that really just saves you time? And so that is really what we're all about. We're just trying to promote not just common practices, but promote the best practices from your team and from others to really help you be the most productive and creative developer that you want to be. Sounds great. Well, thank you so much for being on the show, Katie. This was super cool tool. I can't wait to, I'm definitely going to be turning it on on my personal repos, because I barely remember the kinds of functions I write. So yeah, so thanks for being here. And until next time, happy coding. Happy coding.