Hacker News new | past | comments | ask | show | jobs | submit login
Visual Studio IntelliCode (dirkstrauss.com)
85 points by dirkstrauss 23 days ago | hide | past | web | favorite | 47 comments

I've never seen any IDE as good as IntelliJ IDEA when it comes to Auto suggest, and it has no real AI, just deterministic understanding of the project's source tree and dependencies, an indexed AST, how the type system works, and what's in scope at the cursor. In other words, two classes both called 'List' should not show up when I start typing 'List', if only one of them can possibly be relevant in context. A lot of IDEs, especially in refactoring, for Java often appeared to use string comparison. So you'd do a system wide refactor of say interface 'Foobar', and it would match completely different interfaces called 'Foobar' that had no relation to what's under the cursor.

It's this almost 100% exact matching that develops into a rapid muscle memory where you learn to trust the IDE, and non-deterministic algorithms which have say, a 1% failure rate, tend to be annoying.

>, and it has no real AI, just deterministic understanding of the project's source tree and dependencies, an indexed AST

Right, but because VS Intellicode does not purely work on just the AST tree, that becomes its differentiated advantage. It's not a better way of autocomplete, but a different way that works for some scenarios. Because Intellicode is not deterministic, it is not meant to build muscle-memory like vim, emacs, etc.

I also see some comments in this thread wondering how it compares to Resharper so here's how I'd differentiate them:

Most of the previous autocomplete, "intellisense" type of algorithms work on parsing the AST of the project's source code. The lookup database is therefore scoped to the internal world of that project. Intellicode parses others' source code (e.g. top Github repos) which is out there in the external world.

What Intellicode does is use crowd-sourced data to create a different set of autocomplete suggestions. With that strategy, when one types the dot character "." to trigger a context menu for autocompletion, it's sort of a miniature "pagerank" of the most likely methods or properties instead of a "dumb" alphabetical order.

A concrete example in C# might be the autocomplete of a DateTime type. There are 2 similar properties: ".Now" and ".UtcNow".

What people probably want in many situations to avoid DST bugs is ".UtcNow" instead of ".Now". But in a regular IDE, a dumb alphabetical order means "N" shows up before "U".[0]. Therefore, newbies inadvertently end up with "DateTime.Now" in their code instead of "DateTime.UtcNow".

Something like Intellicode would use machine learning that analyzes the top Github repos and therefore reorder things so ".UtcNow" is higher than ".Now". Of course, this re-ordering could have been manually curated by C# experts into a "best practices database" but Intellicode's idea was to approximate that by using AI applied to others' source code.

[0] VS2017 screenshot example: https://imgur.com/a/05d9Ij9

> What Intellicode does is use crowd-sourced data to create a different set of autocomplete suggestions. With that strategy, when one types the dot character "." to trigger a context menu for autocompletion, it's sort of a miniature "pagerank" of the most likely methods or properties instead of a "dumb" alphabetical order.

Eh, isn't the whole point that intellicode is trained on your own project? Mine is, it suggests things based on our usage.

>, isn't the whole point that intellicode is trained on your own project?

Intellicode may also be trained on your own project but that's definitely not its whole point.

Here's an excerpt from https://visualstudio.microsoft.com/services/intellicode/:

>"IntelliCode recommendations are based on thousands of open source projects on GitHub each with over 100 stars."

Perhaps you were thinking of "IntelliSense" instead of "IntelliCode"? Yes, the older IntelliSENSE could parse your custom classes and types and provide autocomplete for them. IntelliCODE is a different algorithm. (I think Microsoft's naming for them is not self-descriptive and confusing.)

Huh, weird.

I've only ever noticed the "starred" recommendations on our own methods, and it's incredible.

The biggest place I see a lot of great IntelliCode recommendations so far is React development in Typescript in VS Code.

    class ComponentName extends React.|
The top completions in order at that point are Component and PureComponent. It feels more magical than I would have expected, and it is particularly great having that constant reminder of PureComponent, which is very similar to the Now/UtcNow example above.

Most modern autocomplete engines respect camelcase, so N will bring up both Now and UtcNow.

That isn’t how code competition is used. It is t about “saving on typing”, rather, it enables exploration and allows a developer to browse on what they can do next. In that case, your error rate is completely meaningless.

Really it's both, and IntelliJ is the best in the world at supporting both modes. What you're "probably" going to type is at the top of its autocomplete list, but you can still browse through an alphabetical list of what you "could" type below that.

Especially it's a really good memory assistant if you switch between languages often.

That sounds kind of comparable to one of the reasons why gesture interfaces (the waving-your-hands-in-the-air type) have such a hard time catching on: no haptic feedback and not a reliable enough success rate compared to real buttons, or even touchscreens. It doesn't matter if it's 99.9% accurate, it's the 0.1% failure rate that will prevent adoption.

Reliability and predictability matters a lot in interface design

> It doesn't matter if it's 99.9% accurate, it's the 0.1% failure rate that will prevent adoption.

Perfectly said. I've always thought the same way. Basically, I'd rather not use a "pretty good" auto complete, because "pretty good" usually means it does more harm than good (where harm is providing wrong results or doing anything that slows me down overall).

See: Every phones autocorrect and how much annoyance they cause.

Especially when a common word is missing in the dictionary for some ducking reason.

I read that page, watched the vid, and really don't understand what the benefits of this are. Currently use ReSharper and it seems to do a pretty awesome job of predicting what I want.

Whoever is promoting this needs to give better examples...

It's looking at github projects with more than 100 stars:


I guess everybody is wondering why this even exists. Sounds like a typical "solution in search of a problem" to me, and it probably only got green-lit because it mentioned "AI" in the pitch deck ;)

Have you actually used it, or are you judging purely based on speculation?

Also wondering the same thing. What does this accomplishes over Resharper (for example) ?

It's free, for one.

Other than that: this looks absolutely horrible. I don't want AI to make suggestions. I know which methods I want, and which names I want to give stuff.

What about people who don’t know the methods?

Wouldn’t better suggestions be helpful for those learning a language, any language?

I could learn C# or F# in half the time, for example.

This might not be the tool, but I can imagine AI being extremely useful in software development.

If suggestions are to be made i'd rather have them be made by the designers of the APIs/languages, especially those are have been around for some time and have developed better approaches for doing things already possible previously but in a worse way.

For example imagine you have an API that Foos Stuff, the initial version could have been FooStuff but it turned out that after 10 years of active use, the approach was slow for modern use cases and the only way to improve it was to change the API to BeginStuffFooing, ProcessStuffFooing and FinishStuffFooing but still keep the original FooStuff for backwards compatibility.

After 10 years of use, an AI-driven approach that data mines existing codebases (especially popular codebases that are more likely to be mature/old codebases) will be more likely to use FooStuff than Begin/Process/FinishStuffFooing, thus people will be steered towards FooStuff instead of the better approach.

Something that is driven explicitly by the API designer can start recommending Begin/Process/FinishStuffFooing from the moment it is available and recommend against introducing FooStuff in new code (it could even show up a tooltip or whatever with a "here is how to use the new approach if you already know the old approach" link).

Isn't that what the Obsolete attribute is for? Or similar attribute/test driven enforcement of migration to new approaches.

It mines your own codebase, not public ones.

Yes, but it isn't enough information and TBH i do not think that at the language level you can have something that will provide a good enough UX (but then again i'm not in favor of Javadoc-style comments and i believe documentation should lie outside of the source code).

As far as I’m aware (caveat: my knowledge may be slightly out of date here), none of the older .NET async patterns - APM, event based async - have been marked obsolete despite the task based versions being preferable for a long time.

This feature also exists in Visual Studio 2019 and I actually like it. The UI is unobtrusive and the suggestions are very often correct in my fairly extensive experience with it. All the negativity seems to be forgetting that this isn't removing anything, only augmenting an existing feature. Additionally I can see this being very useful to new developers who are less familiar with the language and what can or should be done.

> very useful to new developers who are less familiar with the language

Yes. It almost serves as a pop-up mini-manual, e.g. for all of the valid methods on a class instance whose name you have just have typed. Good for validation but also discovery.

This is just an ad for dirkstrauss' website. uBlock origin blocks 34 ads.

I clicked away as soon as this site asked for permission to send notifications.

I haven nothing against content marketing, but please don't ruin the reading experience.

Now I'm interested to see, how this page looks with ad-blocker disabled.

It just reorders the autocomplete list. This is kind of underwhelming.

I remember reading when Facebook announced Aroma to auto suggest common coding patterns to FB engineers[0]. I haven't used much for code completion before but this idea sounds really interesting. It sounds like the IntelliCode implementation sources suggestions from repos with a higher number of stars so hopefully that helps with noise. For JS I'm sure the variability in style is pretty big.

For people that have been trying IntelliCode for a while does it help much with development? Does it have the ability to suggest larger code snippets or only word by word?


At least up to 2017, VS autocompletion is one word at a time.

>In Visual Studio 2019, hit Ctrl+Q

nope. Who picked this shortcut?

Because Windows has been consistent with Alt+F4 (and Alt+F,X in traditional menu apps, and Alt+Space,C for old fogeys that still use the classic "command menu" even as its icon/click-region continues to disappear from title bars) for decades and "Exit" (or "Close") generally being the Windows command word of choice over "Quit", Ctrl+Q has never meant cohesively "Quit" on Windows as it does on other platforms. I know a lot of Windows applications that use Ctrl+Q for various things having nothing to do with quitting (and Windows-focused Vim users that use/suggest Ctrl+Q for `<Leader>` for similar reasons).

They call it AI, it all looks cool and shiny, but I remember that Visual Studio 2010 was using usage stats already to make auto-complete more useful. Then I think either 2013 or 2015 canned that approach and reverted to a dumb auto-complete (and was a major regression in term of UX). This is merely re-introducing something that already existed.

IntelliCode does give a better UX/feature set than what was ever in previous Visual Studio versions, however. The IntelliCode suggestions have a star icon to make it clearer why they bubbled to the top. The Visual Studio version of IntelliCode supports manually training the suggestions for C# (and soon other languages, if I recall) on personal/corporate/private projects and sharing the subsequent AI/usage models with team members. That ability to get all of a team on a similar model for usage/context-aware suggestions alone will be a big deal for some projects.

(Also, it's built on "AI" techniques like convolutional neural networks rather than pure usage statistics databases, so the performance characteristics are also much better than the past Visual Studio usage databases, especially on machines where it can hardware accelerate it, which supposedly on Windows 10 is most GPUs these days.)

Would be interesting to understand how this works? The paragraph supposedly explaining it, says it grabs code for some of the top GitHub projects to build a model of what good code practices are (I am assuming?). Feels like this sample is way too small to me? Any real life feedback from anyone using this?

Wasn't that what the nefarious Kite extension was trying to do ?

I appreciate all attempts at improving this kind of auto suggesting but for me simple buffer based string completion is still vastly superior to anything VSCode offers out of the box (I work as a front end dev). Way too often VSCode suggets methods and snippets that are totally irrelevant while ignoring a string that's just a few lines await. So far no configuration settings helped with that. So bottom line vim's built-in buffer completion is more efficient at least for the work I do.

TabNine is actually the only thing that I could see myself switching to.

I like Lazarus' approach where it tries its best to provide you intelligent completion but if that fails it also does token/keyword/identifier based completion from what it can find in all open files and remembers from previously open files.

And it always, always, ALWAYS puts any word it knows/guesses that starts with the characters i type at the front before making any other suggestion.

And all that in interactive practically instant speeds. How the hell Visual Studio takes ages (ie. often several seconds) to complete a word i already typed a few moments ago on a 4.2GHz 7700K machine with 32GB of RAM whereas Lazarus happily completes words even on a puny Raspberry Pi, i don't know.

Anyone who writes IDEs should work for at least 6 months with Lazarus to understand how to do things right and if their IDE still provides a worse editing experience (i'm not expecting the entire WYSIWYG GUI and object design as this isn't really something everyone cares about, although it'd be nice) after that then they are doing something very wrong. I have issues with Lazarus with the overall UX being very messy, but the editing experience is the best i've seen.

If you're using Intellicode in Visual Studio with C#, I'm afraid I don't really believe you. Intellicode strongly prioritises nearby code elements.

Could you give an example of a situation where it's completely missing the point?

VS Code's default completion is strictly buffer based, so no sure what you mean there either.

I have a bunch of screenshots I shared in our work slack channel. First of all I am talking about Visual Studio Code rather than Visual Studio. I should have mentioned that, sorry. Intellicode is also available for VSC so I figured it would be relevant here.

The screenshot I posted a while back showed me exporting something at the of the file and I had typed `Det` at which point it suggested some random functions from random APIs. Then I had `Detail` at which point no suggestions were offered. At `Detaile` it finally gave me `DetailedProgress` from the same file about 50 lines higher up.

This is a frequently recurring theme that it takes so long to actually suggest mere names (~ strings).

My understanding is that completion in VS Code for C# is provided by Omnisharp, which yeah, I agree, seems to be slow and inconsistent.

I've written a language server extension for VS Code (not for C#), and the completion lists I provide are better than those I get in C#/F# while writing the server, it's bad :/

Does anyone know if that could be enabled in VS Code?

Not unless there's a specific version made for Code.

The article states that it is available for Code.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact