Visual Studio AI-Assistance: A Developer’s Best Friend

Peter Groenewegen

The Visual Studio family leverages AI to help you stay focused on the creative tasks that get the core logic of your application built.  

For Visual Studio and VS Code, IntelliCode is free and assists with writing, editing and understanding code in popular languages. With IntelliCode, models run locally, meaning that none of your code leaves your machine. This blogpost will focus on IntelliCode.

For users desiring even more AI capabilities, Copilot and Copilot for Business are also supported by Visual Studio and VS Code. Copilot’s models are cloud based. 

Tips, tricks, and engineering story behind IntelliCode. 

Whether you’re a newer developer or experienced, consider this blogpost your jumping off point to get the most from IntelliCode. The team is excited to share tips, tricks and engineering stories that we’ll link to below – content to come soon!  

Writing code 

  • IntelliSense list: Instead of exploring an unsorted list of methods and members, IntelliCode uses AI to place what we believe is most relevant to your code context at the top and places a symbol next to item.
  • Gray text: To help increase productivity and reduce errors, IntelliCode can suggest up to a whole line of code in grey text. Your code context and code style are used to help generate these suggestions.

Editing code

  • Repeated edits: Making several similar but slightly different edits? IntelliCode can detect the pattern and apply the change to other locations – saving you keystrokes and navigation
  • Intent Detection: IntelliCode has learned to assist with common edit patterns such as creating a constructor after creating parameters, or even with editing code that’s just been pasted.

Navigating code

  • API Usage Example: Making a round trip to the browser and fiddling with search to figure out how to use an API is a common workflow. This feature can save you from that by presenting examples of how an API is commonly used.

Navigating Packages 

  • Most Common NuGet Packages: This feature helps you find and use the most used NuGet packages, streamlining the process of finding and adding packages to your projects.

Reviewing code

  • The Visual Studio family is excited to explore AI-assistance for workflows that start with preparing a pull request and end with a successful merge.  

The IntelliCode team is not only excited to help improve your productivity, but also to learn about your scenarios that could be improved with AI.

27 comments

Discussion is closed. Login to edit/delete existing comments.

  • Jacob McDowell 3

    Hmm, VS Code, IntelliCode, C# mentioned in the same post. I’m obligated to ask about the status of the C# extension overhaul described in GH issue #5276. A lot of negativity in there but it seems a great deal of it is due to misunderstanding, not realizing the extension predates LSP, still more is just frustration from the silence.

    As a long-time C# and VS Code user, i am looking forward to the modernization of the extension and all of the goodness that will bring – including, presumably, IntelliCode.

    • Aaron YimMicrosoft employee 0

      Hi Jacob, thanks for leaving a comment.

      We’re also excited about modernization of C#/VS Code and the possibilities that come with it.

      On the IntelliCode side, we’ve just launched whole-line autocomplete for JS/TS/Python in VSCode.
      Python support should be installed by default for all users of IntelliCode extension… full JS/TS rollout to come soon (can be enabled in settings for IntelliCode Completions if you want it now).

  • Dan Friedman 6

    You should have saved this post until you had examples to show it could go into more detail. As-is, the post is too high level to be useful to most of us.

    • Peter GroenewegenMicrosoft employee 2

      Hi Dan, thank you for your feedback on my post. I understand your point. We will follow up soon with a more in-depth posts that includes examples to show how the features can be applied in practice. However, I felt it was important to first introduce the concepts and provide a high-level overview.

      If you have specifics you want to learn about, I appreciate your input and will take it into consideration as I work on the next posts. Please stay tuned for more content that goes into greater detail and includes specific examples. Thank you!


      Peter [MSFT]

  • Arman Spr 4

    Why don’t you add artificial intelligence (AI) to C# compiler and kiss principle “Keep it simple, stupid!” Do not add to C# language? For example, a list should be used everywhere, and where it was necessary for the compiler to convert it to a LinkedList behind the scenes, or we should use a class everywhere, where a record or struct function was better, the compiler would apply the changes by itself. and simplify and improve coding for programmers.
    This is just an idea!

    • Andreas Saurwein 4

      Oh please dont. Am all for compiler optimizations, but if they are not deterministic, just dont. One may argue that a list of preferences, like we have already for the warnings/errors, would be an option for compiler optimizations. C/C++ compilers offer such.

  • Chuck Ryan 6

    Personally, I find IntelliCode a distraction.

    The last thing I need while entering my code is the IDE throwing, constantly changing, text suggestions at me. Mostly all it does is break my train of thought and while I have had it on the last few months, to see if I can get used to it, all I have succeeded in doing is get better at ignoring it.

    So, I will pass.

    • Jan Seriš 1

      You can turn it off in Visual Studio settings.

      • Chuck Ryan 0

        Yes… since I stated ‘I had it on the last few months’ in the second sentence, it is implied that it could be turned off.

        • Zak Dwyer 1

          Then it’s simply an issue of preference. There’s a reason you can turn it off – because some people like the time saving over the potential distraction, and vice-versa.

  • Henry B 1

    All too often IntelliCode is a nuisance.
    It totally breaks my “Tab” completion habits and is a WTF when the suggestion is (for whatever reason) to delete code (or reformat LINQ method chains).
    I was a quicker code writer before IntelliCode did see the light, now I am slower because I have to cross-check my edits for accidents.

    Also, it doesn’t seem to care if I try and set it to “ignore” suggestions.

    I’m an experienced developer, so I can understand the intention and reasoning, most of the cases.
    For a beginner, this probably is just madness.

    • A Yorkshire Lass 2

      I’m a beginner and it’s helping me in some ways but in other’s it’s a huge PITA.
      Also I don’t yet have the experience to know whether it’s suggestions are correct or not.

      • Aaron YimMicrosoft employee 0

        Waving from New York to Yorkshire 👋

        We do some compiler filtering on the suggestions, so we shouldn’t be “adding” errors.

        We’ve got a new API Usage Examples feature that may help you assess how a method should be used – give it a shot in 17.6 Preview and let us know what you think?
        Love hearing how we can be more helpful – tweet me @aaronyim or mail me at aayim at microsoft dot com

    • Aaron YimMicrosoft employee 0

      Henry – I hear you!

      Although we do careful user research studies/sensemaking, it’s a fine line between being useful and being disruptive.
      We’re excited about improvements to reduce noise/disruptiveness in version 17.5 of VS (with more to come in version 17.6 – preview available now).
      Consider giving this a 17.6 Preview a shot and let us know how you feel?

      Love hearing how we can be more helpful.
      Feel free to tweet me @aaronyim or mail me at aayim at microsoft dot com

  • Andreas Saurwein 0

    As much as those “intelligent suggestions” are often useful, as often they get in the way. In my opinion the way they are invoked and executed should be more explicit. It really gets in the way of writing code, especially when you use other extensions that also provide suggestions, help, whatever, to be inserted where you are adding code.
    Currently there is a lot of overlap in functionality and one has to choose which one is of more value and disable the rest.
    An unified interface would be called for. Something like the Roslyn analyzers maybe.

    • Aaron YimMicrosoft employee 0

      Hey Andreas, thanks for taking the time to leave a comment.

      I hear you! Although we do careful user research studies/sensemaking, it’s a fine line between being useful and being disruptive. We’re excited about improvements to reduce noise/disruptiveness in version 17.5 of VS (with more to come in version 17.6).

      Thanks for your patience while we pioneer new ways of using an IDE… and feel free to tweet me @aaronyim or email us at aayim at microsoft dot com with more detail/examples… love hearing about where we can do better.

  • Patrik Huber 0

    I’m on the latest VS 2022 (17.4.5) and I have to say I unfortunately find IntelliCode, or the auto-complete in general, very sub-par, to say it gently. The suggestion list, including the top suggestions, are most of the time weird Boost macros or other standard-library or third-party types, functions and macros, even when the actual top choice would be an obvious local variable or function. In my code at least, if a namespace and a local variable have a similar name (start with the same characters), it also always highlights the namespace as the first choice. Also, CamelHump (or camel_hump with snake case) doesn’t work at all (if you don’t know what it is: It means you type the starting letters of each word in a function, and the auto-complete will suggest that as the top answer then). For example if you have an object of type Dog called dog, and it contains a member function “get_my_dog()”, you would type “dog.gmd”+tab it should auto-complete to dog.get_my_dog() instantly. Or if your type is called “BigDog” and you type “BD” (and ctrl+space to force the auto-complete drop-down) it should offer “BigDog” at the top. None of that works at all in my projects. They are modern C++ projects that I open with File->Open CMakeLists.txt. I do have IntelliCode enabled.
    I have to say that VisualAssist and ReSharper++ do all of these things mostly flawlessly but I was really hoping by now I wouldn’t need either of these anymore :-).

    • Mryam GirmayMicrosoft employee 2

      Hi Patrik, thank you for your feedback. We have added Reimagined Member List that brings up to ten matching type items on the top of the member list. I believe that is what’s affecting your top suggestions, and you can read more about it in C++ Reimagined Member List.

      • Patrik Huber 0

        Thank you Mryam – I just updated to 17.5 and will give this a go!

        It’s noteworthy though that VisualAssist has done this for decades and it doesn’t require any smart AI code completion – the camel-hump for example is a simple “deterministic” logic. That being said, all the recent & upcoming AI coding helpers are for sure exciting.

  • Stevie White (Dragnilar) 0

    Hi Peter,

    I appreciate the work MS is continuing to do to enhance the Intellisense and developer experience in Visual Studio. However, I am at the point where I think MS’ experiment with using AI in VS may require rethinking. To date, I have not had any positive experiences with Intellicode versus using JetBrains’ famous extension.

    I will have to echo the feedback provided by Chuck Ryan, Henry B and Andreas S. Franci Gonçalves. And to add to their lists of problems I have with Intellicode, it also causes a lot of intermittent errors in Visual Studio. I tried to be more diligent about reporting them in the past, but eventually I got to the point where I gave up on Intellicode and uninstalled it.

    Another way to look at it: I really do not like the way Intellicode’s suggestions integrates into the VS workflow. It would be so much more helpful, but I am at a loss as to how you could improve it so that it integrates better into the general usage patterns that which people use for VS. This part of the extension is its most problematic, since it feels like it adds an extra “burden” on top of the work we do inside of the application. Your team may need to do some broader studies to set up requirements and/or get inspiration on how to better smooth out a developer adopting intellicode into their workflow.

    • Aaron YimMicrosoft employee 0

      Hey Stevie, thanks for taking the time to leave a comment.

      I hear you! Although we do careful user research studies/sensemaking, it’s a fine line between being useful and being disruptive. We’re excited about improvements to stability and being in the user’s flow in version 17.5 of VS (more refinement to come in version 17.6 – available for Public Preview here).

      Thanks for your patience while we pioneer new ways of using an IDE… and feel free to tweet me @aaronyim or email us at aayim at microsoft dot com with more detail/examples… love hearing about where we can do better.

      Appreciate you.

  • Zak Dwyer 0

    Despite the negativity surrounding IntelliCode, I think it does more help than harm. Sometimes I’ll get a brain fart and the AI suggestion will help jog my memory. Often it has saved me a huge amount of time – main examples are when I’ve written properties and then it suggests a fully-formed constructor. Another example is changing references from one property/variable to another – navigate to the variable, change it once, and then every time you go to the next change it will automatically suggest it. Once in a while it comes up with a solution that was even more ingenious than I would have came up with, and other times it suggests things like “List UsersUsers = new List()”.

    • Aaron YimMicrosoft employee 0

      Zak,

      Thanks for taking the time to leave a comment, glad we’re of help.
      Two trains of thought here:

      1) RE: navigating to the next variable & changing it, we’re working on a new experience that makes it easier to navigate to next location & apply (i.e. tab to go to next location, tab to apply, etc.)

      2) RE: goofy suggestions, feel free to tweet the bad (and the good) to me @aaronyim. Love hearing how we can better help.

  • Dave Bacher 0

    1. In a .NET 7 Blazor project, the AI is prioritizing deprecated features with stars pretty consistently.
    2. In a .NET 7 Blazor project, the AI needs a higher repetition penalty because it’s suggesting the previously typed line of code more often than not, particularly in the builder.Services.Add section of program.cs (this happens with Generic Host applications as well)
    3. When adding Entity Framework, it will never suggest data annotations.
    4. When defining POCO’s, it will suggest the same handful of properties – which are often irrelevant to the specific class being defined, but common in Microsoft demonstration code.
    5. When defining POCO’s, it will never suggest data annotation attributes or other useful things.
    6. It often suggests things like – and this is real – “int intintintint(int intint) {get; set;}” that aside from being comically repetitive – also is simultaneously comically wrong.
    7. It suggests a lot of anti-pattern and other code smells, presumably because of the training material.
    8. I also can’t recall a single occurrence of it generating code that is both correct and compilable. It occasionally generates near miss code that only needs minor correction.
    9. Due to C# file structure, it doesn’t have enough context in most cases to generate proper in-context code. Things like using many smaller classes aren’t good for the Open AI models – they want large, monolithic anti-patterns to have a shot at having enough context to point at the right spot. The typical taking C# and breaking it into classes and components makes it less likely Open AI’s models can generate good code.
    10. Every Open AI generation has a token [AB] that exists in corpus and a token [BC] – for any arbitrary ABC adjacent in output, both [AB] and [BC] must have non-zero occurrence. This is what gives coherence – [ABC] very likely exists in corpus for any given training data. This is why Chat GPT is useful to Bing. What this means is that every “generated” code fragment is made up of chains of tokens that appeared in the corpus, and it’s an open question how long the chains can get, but assuming it’s Open AI’s model – which it is – we know they can stretch 200+ tokens, in some cases, over on the GPT side. We also know that this varies with diversity of context, etc. and we know the code is less diverse than the English language model.
    I’m just saying – this feature is genuinely bad in its current state. Not only is it sometimes copying identifiable code from the corpus, but its also nearly never right on its suggestions and has a focus on deprecated features when writing .NET Core apps using MVC or Blazor. I don’t understand how Microsoft isn’t running into this constantly internally – it’s almost as if since your management sunk billions into Open AI, you’re trying to integrate it to earn points with them or something. Meanwhile, for most common coding things, I find Code Rush or similar tools are more useful than the AI model at reducing replicated code. And some of this could be done at a C# level, when you look at add ins.
    Just as an example, there are plenty of tools for automating INotifyPropertyChange and IObservable – since the AI never suggests plausible, compilable or executable code for these major patterns, these other tools add way more value. But as with Sydney / Bing, Microsoft’s focus isn’t on generating correct information – working, viable code – their focus is on recouping senior management’s investment in Open AI.
    But at a least, you should be able to negatively reinforce deprecated code in most Open AI models and ramp up the repetitition penalty, also – you need some more diversity in the entity framework scenarios that you’re training on so that the model can at least plagiarize more correct code. It appears the WPF and UWP code also isn’t very well trained, as well, and has similar issues but I don’t use it as often. On the JavaScript side, I’m also getting wrong and bad suggestions more often than correct ones – it’s also favoring deprecated properties in some libraries.
    It is the single largest source of instability in the analyzers when I am on a shakey network – bar none.
    Also, the feature does not stay off – turning it off disables it for some period of time, but it always eventually turns itself back on. I’m working on nailing down the condition, but it appears it might be when Visual Studio Installer pickes up a new version of the IDE. If I turn this feature off, I would very much appreciate it staying off. I’m less annoyed by some of the other stuff – but it genuinely appears, in this case, you toggle the setting back to on intentionally periodically as a “hey, I know you didn’t like this, but what about now” sort of a test. That’s fine, but as it does actively crash Roslyn regularly when your calls out to the API fail, I would really appreciate it if you’d leave the feature off until I intentionally re-activate it.

    • Aaron YimMicrosoft employee 0

      Hi Dave,

      I’m hearing a couple things:

      1) That we should improve our performance for .NET 7 Blazor / EntityFramework; hang tight here – we’re working on it.
      Other than .NET7 Blazor / EntityFramework (web app work) is there any other type of code that you write?
      Curious what kinds of scenarios we’re doing poorly in (we know niche codebases to be more problematic).

      2) That you’re running into repetition – we’ve done a fair bit of work here… but helpful to hear that it’s still occurring to you in the real world for ya 🙁 You’re always welcome to tweet me or email me at aayim @ microsoft . com if you see something that’s just bad.

      3) RE: re-enabling, please file a bug the next time you run into this. Settings state should be retained between versions.

  • Dandy 0

    For me, this sort of assistance has now reached the point where it’s just trying too hard and I now spend more time undoing what it does, than I would have spent had it not inserted anything at all.

    I’m getting increasing frustrated lately just making corrections to some of the auto-suggest things that the editor is adding as I’m typing; for example, if I’m entering a “)” and the editor can’t figure out where the matching “(” is, it’ll insert it where my cursor is (the “(” it couldn’t find, that is, not the “)” I just typed), shuffle some of the nearby code inside that opening parens, then follow that with the closing parens (which is the only character that ultimately should’ve been added). God help me if I’m working on skeleton code, typing in class names that I haven’t defined yet (but intend to soon) – then it starts making all sorts of bad suggestions and inserts bad stuff that I have to delete.

    I’m told there’s options to disable that. A one-click button needs to be given prominence; hiding it 7 levels deep in an options tree isn’t going to incite me to turn it off only temporarily.

    • Aaron YimMicrosoft employee 0

      That sounds really frustrating. There should be a purple lightbulb in the bottom left of your editor window that should make it easily to temporarily disable the feature. There’s also an option to wait for pauses in typing before showing a completion that should help you with the bouncing suggestions as you type.

Feedback usabilla icon