
Visual Studio IntelliCode - dirkstrauss
https://dirkstrauss.com/visual-studio-intellicode/
======
cromwellian
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.

~~~
jasode
_> , 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](https://imgur.com/a/05d9Ij9)

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

~~~
jasode
_> , 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/](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.)

~~~
Dayshine
Huh, weird.

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

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

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

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

[https://visualstudio.microsoft.com/services/intellicode/](https://visualstudio.microsoft.com/services/intellicode/)

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 ;)

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

------
076ae80a-3c97-4
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.

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

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

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

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

------
greenyouse
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?

[0][https://ai.facebook.com/blog/aroma-ml-for-code-
recommendatio...](https://ai.facebook.com/blog/aroma-ml-for-code-
recommendation)

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

------
onefuncman
>In Visual Studio 2019, hit Ctrl+Q

nope. Who picked this shortcut?

~~~
WorldMaker
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).

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

~~~
WorldMaker
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.)

------
orliesaurus
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?

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

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

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

~~~
YuukiRey
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).

~~~
Dayshine
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 :/

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

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

~~~
zapzupnz
The article states that it is available for Code.

