Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting of intellisense suggestions not optimal in this case #29613

Closed
bpasero opened this issue Jun 27, 2017 · 5 comments
Closed

Sorting of intellisense suggestions not optimal in this case #29613

bpasero opened this issue Jun 27, 2017 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)

Comments

@bpasero
Copy link
Member

bpasero commented Jun 27, 2017

In this case I would expect canceled to show up first:

image

@jrieken
Copy link
Member

jrieken commented Jun 27, 2017

Can you explain why? Do you want to penalise based on word/patten length difference? That usually yields bad results for prefix matches (c -> constructorFunction vs c -> notCool). In the case above both have the same score and we fallback to the initial sorting.

@jrieken jrieken added the info-needed Issue requires more information from poster label Jun 27, 2017
@bpasero
Copy link
Member Author

bpasero commented Jun 27, 2017

@jrieken yeah I see the problem. maybe in this case what I would really want is to sort suggestions by distance, e.g. since canceled is a local variable that is just one line above it could get an extra boost because it is more likely that I want to use it.

@jrieken
Copy link
Member

jrieken commented Jun 27, 2017

since canceled is a local variable that is just one line above it could get an extra boost because it is more likely that I want to use it.

Fully agreed but scoring cannot do that. However, when equal scores are computed (like in this case) we fallback to the sort order the provider influences (via sort text). Moving on to TS/JS

@jrieken jrieken removed the info-needed Issue requires more information from poster label Jun 27, 2017
@jrieken jrieken assigned mjbvz and unassigned jrieken Jun 27, 2017
@mjbvz mjbvz added feature-request Request for new features or functionality javascript JavaScript support issues typescript Typescript support issues labels Jun 30, 2017
@mjbvz
Copy link
Collaborator

mjbvz commented Jun 30, 2017

Yes, typescript currently returns both of these completions with the same weight:

  {
        "name": "cancel",
        "kind": "parameter",
        "kindModifiers": "",
        "sortText": "0"
    },
    {
        "name": "cancelAnimationFrame",
        "kind": "function",
        "kindModifiers": "declare",
        "sortText": "0"
    },

We should give a higher weight to local variables and parameters. I believe this weight would only be used when the filter text of the two items are the same

@mjbvz
Copy link
Collaborator

mjbvz commented Jun 30, 2017

Tracked by microsoft/TypeScript#15024 upstream

@mjbvz mjbvz added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Jun 30, 2017
@mjbvz mjbvz closed this as completed Jun 30, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality javascript JavaScript support issues typescript Typescript support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants