February 13th, 2023

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

Peter Groenewegen
Senior Software Engineer

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.

Author

Peter Groenewegen
Senior Software Engineer

Peter is a Software Engineer on the Visual Studio IDE team, where he's been integrating ML and AI in developer tools. He currently working on AI tools for developers.

27 comments

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

  • Dandy

    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...

    Read more
    • Aaron YimMicrosoft employee

      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.

  • Dave Bacher

    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...

    Read more
    • Aaron YimMicrosoft employee

      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...

      Read more
  • Zak Dwyer

    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...

    Read more
    • Aaron YimMicrosoft employee

      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...

      Read more
  • Stevie White (Dragnilar) · Edited

    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...

    Read more
    • Aaron YimMicrosoft employee

      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...

      Read more
  • Patrik Huber · Edited

    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...

    Read more
    • Mryam GirmayMicrosoft employee

      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

        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.

  • Andreas Saurwein

    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...

    Read more
    • Aaron YimMicrosoft employee

      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...

      Read more
  • Henry B

    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,...

    Read more
    • Aaron YimMicrosoft employee · Edited

      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...

      Read more
    • A Yorkshire Lass · Edited

      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

        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

        Read more
  • Chuck Ryan

    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š

      You can turn it off in Visual Studio settings.

      • Chuck Ryan

        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

        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.

  • Arman Spr

    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...

    Read more
    • Andreas Saurwein

      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.

  • Dan Friedman

    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 Author

      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...

      Read more