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

TypeScript autocompletion unexpectedly prefers hyphens #63100

Closed
saschanaz opened this issue Nov 14, 2018 · 6 comments
Closed

TypeScript autocompletion unexpectedly prefers hyphens #63100

saschanaz opened this issue Nov 14, 2018 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug javascript JavaScript support issues suggest IntelliSense, Auto Complete typescript Typescript support issues verified Verification succeeded
Milestone

Comments

@saschanaz
Copy link

saschanaz commented Nov 14, 2018

  • VSCode Version: 1.29.0
  • OS Version: Windows 10

Steps to Reproduce:

Try autocompletion with hyphen-containing members. Here, "type" should appear first rather than second.

image

Does this issue occur when all extensions are disabled?: Yes

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 14, 2018

Simple repo:

const a = {
    x: 1,
    'x-y': 2
};

a.|

@jrieken Seems like a suggest sort issue. The entries that TS returns have the same sort text in this case

@mjbvz mjbvz assigned jrieken and unassigned mjbvz Nov 14, 2018
@mjbvz mjbvz added the suggest IntelliSense, Auto Complete label Nov 14, 2018
@jrieken
Copy link
Member

jrieken commented Nov 15, 2018

Yeah, that's weird. A 100%-match should win over a prefix match...

@jrieken jrieken added this to the November 2018 milestone Nov 15, 2018
@jrieken
Copy link
Member

jrieken commented Nov 15, 2018

This is what happens:

  • a.| and suggestion x: nothing will be replaced/overwritten, nothing to score against
  • a.| and suggestion x-y: that suggestion has filter text .x-y and replaces . so we score . against .x-y which gives good score

Something similar happens with a.x and a._x_ vs a_.x_ (foo is the scoring range). Not sure what to do here, the rules are that longer scores are better but in this case it's not visible what being scored against...

@jrieken jrieken added the under-discussion Issue is under discussion for relevance, priority, approach label Nov 15, 2018
@jrieken jrieken removed this from the November 2018 milestone Nov 16, 2018
@vscodebot vscodebot bot removed the new release label Nov 20, 2018
@jrieken
Copy link
Member

jrieken commented Nov 29, 2018

cc @chrisdias

@jrieken
Copy link
Member

jrieken commented Nov 29, 2018

@mjbvz When having those bracket-member suggestions TypeScript could return a replace-range for all completions so that they all replace the leading dot and hence have the same ranking offset. Not sure what else to do there...

@mjbvz mjbvz modified the milestones: November 2018, December 2018 Nov 29, 2018
@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug typescript Typescript support issues javascript JavaScript support issues and removed under-discussion Issue is under discussion for relevance, priority, approach labels Nov 29, 2018
@mjbvz mjbvz modified the milestones: December 2018, November 2018 Nov 29, 2018
@mjbvz mjbvz closed this as completed in beb5998 Nov 29, 2018
mjbvz added a commit that referenced this issue Nov 30, 2018
@jrieken
Copy link
Member

jrieken commented Nov 30, 2018

👏 thanks @mjbvz

@jrieken jrieken added the verified Verification succeeded label Dec 6, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug javascript JavaScript support issues suggest IntelliSense, Auto Complete typescript Typescript support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants