Bug 13103 - Smarter completion matching
Summary: Smarter completion matching
Status: NEW
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: PC Mac OS
: --- enhancement
Target Milestone: master
Assignee: Mike Krüger
URL:
: 15340 ()
Depends on:
Blocks:
 
Reported: 2013-07-08 17:52 UTC by Mikayla Hutchinson [MSFT]
Modified: 2014-11-03 11:00 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 13103 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Mikayla Hutchinson [MSFT] 2013-07-08 17:52:20 UTC
It would be nice if the completion matching were smarter, so instead of matching purely based on the textual similarity, it would alter the match score by other factors, such as the item type, or whether it had been used recently.

For example, suppose that when searching the completion list, we were to compute the following components:

// 1.0 = exact, 0 = no match 
float textSimilarity = ComputeTextSimilarity (completionString, itemText)

// local = 1, keyword = 1, member = 0.8, imported type = 0.6, template = 0.4, importable type = 0.2
float itemKindScore = GetItemKindScore (item); 

// position in Most Recently Used list, scaled between 1.0 = most recent, 0.0 = not used
float mruScore = GetMruScore (item); 

// how frequently the item is used in the file, 1.0 = 10 times, 0.0 = not used
float fileFrequencyScore = GetFileFrequencyScore (item, ast);

Then compute some total score based on these components that would make the completion list more likely to select the thing the user actually wants, e.g.

var totalScore = textSimilarity;
if (textSimilarity > 0f) {
    // exact match outweighs other factors
    if (totalScore == 1f)
        totalScore == 10;

    totalScore = totalScore + itemKindScore + mruScore + fileFrequencyScore;
}

Obviously the various factors would need a lot of tuning, but it could potentially be a lot better than what we have.
Comment 1 Mikayla Hutchinson [MSFT] 2013-10-10 18:32:04 UTC
*** Bug 15340 has been marked as a duplicate of this bug. ***
Comment 2 Eric Weinschenk 2014-10-31 16:06:28 UTC
Hey guys - this is a very important feature to me.

R# provides three completion modes:
(https://www.jetbrains.com/resharper/webhelp/Coding_Assistance__Code_Completion.html)
1. Regular completion -  what you have
2. Smart completion - what you need
3. Import type completion -also needed.

Smart completion is my favorite part of their whole experience. Here are some things I love that it does

Type "MyCircle " and hit "SC" (smart complete) and it will suggest a list of variable names like myCircle and circle and let you choose one from a list.

Type "MyCircle circle =" and hit SC and it will show a list of all circle objects available in the current scope, such as "new MyCircle()" and "MyCircle.Singleton" or just "circle" if one is above.

If i don't know what to type I always just hit ctrl-shift-space and they always have a good suggestion for me, including lambda function stubs (which you have under regular completion, but those should be moved into smart completion).

Thanks.
Comment 3 Mike Krüger 2014-10-31 18:44:22 UTC
The smart completion is a bad idea IMO.

The 'MyCirle ' -> myCicle/circle suggestion is something we had as well - but seems to have regressed in master. I'll treat that as a bug :/.

It was just activateable by 'normal' completion ctrl+space.

I would like to have only 1 completion list and not two - that's why lambda function stubs are there as well.


But we have the import type completion. We have that as command as well as adding them automatically in the 'normal' completion. There is an option for that.
Comment 4 Eric Weinschenk 2014-11-03 11:00:43 UTC
i think the key piece here that I really want is the ability to have a short list of variables in scope matching what i'm calling.

like when I do MyCircle c = "SM" i want to see all the circles in a short list and not see any other types or anything.