DEV Community

Jonathan Carter
Jonathan Carter

Posted on • Updated on

Have you tried IntelliCode? If so, what's your favorite (or least favorite!) suggestions so far?

Hey All! My team builds Visual Studio IntelliCode and we're curious to learn how it's working for folks. In particular, are there any examples of contextual suggestions it provided that were really helpful and/or unexpected (in a good way!)? If so, I'd love to hear about it. If possible, it would be really fun if you could share a screenshot that helped illustrate your example within Visual Studio or Visual Studio Code 😊

Additionally, if you've encountered situations where the suggestions didn't seem quite right, or could have been more helpful, that would be extremely helpful to know about as well πŸ‘

Top comments (17)

Collapse
 
babrown93 profile image
Bill

Hey Jonathan,

I've been using it since it was released. I like the fact you can train it based on your projects. That is a really great feature. I've been a long time user of Visual Studio so I am used to IntelliSense which has always been helpful as well as the shortcut keys that allow you to show suggestions as well as peek at method signatures.

Anyway, the fact that I can get project specific suggestions really does make my coding speedier (usually).

I can't really give a for instance, but I have used it a lot and yeah, nice job :).

Generally as a Microsoft Full Stack kind of guy, you cannot beat the proprietary tools, and so much innovation has been happening over the past couple of years, so excited for the future.

Collapse
 
lostintangent profile image
Jonathan Carter

Thanks for the feedback! Out of curiosity: how often have you found yourself re-training the model on your own project? And has your team as a whole begun using the project-specific suggestions?

Collapse
 
sampruden profile image
Sam

I've found myself putting off retraining because it takes a little time. I want to do it more often, but I wait until I hit a milestone because otherwise it interrupts my flow. I don't have a good sense of how important retraining is or how much difference it makes each time, but my completionist nature makes me uncomfortable when I know it's out of date. If it could happen in the background so I didn't have to think about it, that would reduce my mental load.

Thread Thread
 
lostintangent profile image
Jonathan Carter

We’re actually working on support for automatic training, so it’s great to hear this would be valuable to you! Out of curiosity: what would be your ideal experience for training in the background? Periodically running on your local machine? Running as part of a CI/nightly build? Something else?

Also, have you tried sharing a custom model with your team as well? Or are folks individually training their local copies of the project?

Thread Thread
 
sampruden profile image
Sam

I've not used it on any team projects, so I can't speak to that.

I don't know how valuable it is to retrain after small changes to the code. Obviously if small changes don't matter then it can be rarer, and if they do then it should be more frequent. I would like to feel like it's always up to date and Just Workstm without having to worry about that. To that end, I would like to have it updating on my local machine as changes happen, at whatever frequency makes sense.

I don't know what analysis is being done, but could it be iterative as changes happen or does it need to do a full rebuild every time?

My solution that comes in at around 5,000 lines takes about a minute to train. If that number is much larger for bigger solutions, then having the ability to train it on a server through CI or nightlies and pull it down from clients is important. I would like to see both workflows be supported and complementary.

Thread Thread
 
lostintangent profile image
Jonathan Carter

I can’t thank you enough for sharing this detail! Would you be open to setting up a quick chat sometime this week? You’re giving some amazing feedback, and I know that our team would love to learn further about your experiences 😁 If so, feel free to ping me (joncart@microsoft.com) and we can go from there πŸ‘

Thread Thread
 
sampruden profile image
Sam

I'd be happy to, but I'm not sure that I have that much great insight. I've been using it casually on a medium sized personal project - a suite of Roslyn analyzers - but I've not thought about it in too much detail, other than what I've posted here. Would it be easier if I just keep posting things here when I think of them?

Thread Thread
 
lostintangent profile image
Jonathan Carter

Sure! That would be great

Thread Thread
 
sampruden profile image
Sam

I will do!

Collapse
 
sampruden profile image
Sam • Edited

I have another scenario where I would have liked to have a suggestion.

class Foo
{
    public int Bar { get; private set; }

    public Foo(int bar)
    {
        this.Bar = ...
    }
}

I would like Intellicode to suggest bar here. On account of the matching name, type, common constructor patterns, and it being the only variable in scope, it should be confidently guessable. Currently I get no Intellicode suggestions in this position.

With plain Intellisense, autocompleting in this position often leads to frustration. Hurrying through this process and using autocompletion I often accidentally end up with this.Bar = this.Bar by accident. That might be user error on my part, but it happens when I'm going fast. Having the sensible one suggested by Intellicode here could reduce my error rate significantly.

Collapse
 
lostintangent profile image
Jonathan Carter

Interesting! When you're typing this line fast, do you actually type this. after the =, or is auto-completion suggesting that and making it easier to accidentally select it?

Collapse
 
sampruden profile image
Sam • Edited

Plain Intellisense is giving me Bar as an option, but I have my code style preferences set to prefer this.Bar so it's getting automatically applied. I'm not typing the this.. Actually I just tried it again now and it's not happening, but it definitely does sometimes. That's something in my VS setup unrelated to Intellicode.

The this. formatting isn't an issue. What matters is that I get Bar when I want bar. There's no bug there, it's just my own clumsiness navigating through the completion list, and sometimes typing fast and capitalising when I don't mean to. I'm badly coordinated, I mess up my typing quite a lot.

bar and Bar look very similar, and are very similar to type. I like my constructor parameters to have camelcase versions of property names. It's a common pattern but typo prone.

If Intellicode always just immediately surfaced the correct one at the top of the list I wouldn't have the opportunity to make the typo, and that would be a quality of life improvement for me.

I don't know, but I guess that this could be quite a big issue for some dyslexic users.

Collapse
 
sampruden profile image
Sam • Edited

I just wrote the following code

if (declarationKind == DeclarationKind.Struct) return GetDeclaration("struct");
if (declarationKind == DeclarationKind.Class) return GetDeclaration("class");

On the first line Intellicode suggested DeclarationKind.Struct. That was a good suggestion. On the second line it suggested DeclarationKind.Struct again. That's a bad suggestion because not only is it unlikely to be what I want to do, it would be unreachable code.

I'd like to see it definitely not do it when it's unreachable. However, even if my if statement didn't return and the second case was reachable, I'd like Intellicode to guess that I'm unlikely to be repeating the same condition. DeclarationKind.Struct could still be starred, but shouldn't be the top priority suggestion.

If it could have seen that my "struct" string was a lowercase version of the name "Struct" and then suggested "class" because it's the lowercase version of "Class", that would be magic.

Collapse
 
lostintangent profile image
Jonathan Carter

That’s great feedback! We currently take a lot of context into account when providing suggestions, but there’s still plenty of room to improve πŸ‘ These are both good examples for us to use to iterate. Keep the feedback coming!

Collapse
 
sampruden profile image
Sam • Edited

I'm liking it so far, but exceptions are an area where it could do better.

Take this simple example.

void Test(object obj)
{
    if (obj == null) throw new ArgumentNullException(nameof(obj));
}

I didn't get any Intellicode suggestions as I wrote that. I would like to see it guess that I'm going to use an ArgumentNullException and guess the nameof(obj) argument.

It looks like the suggestions are all done in small units at the moment, but it would be nice if the whole of throw new ArgumentNullException(nameof(obj)); could be offered as a single suggestion after I finished typing the if.

Pushing that even further, it would be nice if it could recognise that guards are common, so that just pressing ctrl+space on the first blank line of the method offered me the whole line as a single suggestion.

I would also like to see it train continuously in the background so that I don't have to think about retraining.

Collapse
 
ryuheechul profile image
Heechul Ryu

Seems like a cool tool. Let me try. For those of you who are trying to install on VSCode, you can find the extension here

Collapse
 
lostintangent profile image
Jonathan Carter

Definitely let me know how it goes if you get a chance to try it out πŸ‘