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

List of function properties should put the Function.prototype methods at the bottom of the list #20283

Closed
mjbvz opened this issue Nov 27, 2017 · 6 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Domain: Completion Lists The issue relates to showing completion lists in an editor Suggestion An idea for TypeScript

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 27, 2017

From @ORESoftware on November 27, 2017 3:4

This is a feature request - the problem is demonstrated in this video

basically, we have a function

interface ItHook {
  (t) => any;
  foo: 3;
  bar: true
}

when we list the function properties, it will list the Function.prototype methods before it lists foo or bar, etc.

https://www.useloom.com/share/1a0f1e84083049ff8f745a3a1f17ac03

You can go to 2:53 in the video to see the problem.

#20274

Copied from original issue: microsoft/vscode#39160

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 27, 2017

For the code:

interface ItHook {
  (t): any;
  foo: 3;
  bar: true
}

function foo(x: ItHook) {
  x.
}

All entries currently have the same sortText:

[Trace  - 13:56:37] Response received: completions (206). Request took 2 ms. Success: true 
Result: [
    {
        "name": "apply",
        "kind": "method",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "arguments",
        "kind": "property",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "bar",
        "kind": "property",
        "kindModifiers": "",
        "sortText": "0"
    },
    {
        "name": "bind",
        "kind": "method",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "call",
        "kind": "method",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "caller",
        "kind": "property",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "foo",
        "kind": "property",
        "kindModifiers": "",
        "sortText": "0"
    },
    {
        "name": "length",
        "kind": "property",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "name",
        "kind": "property",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "prototype",
        "kind": "property",
        "kindModifiers": "declare",
        "sortText": "0"
    },
    {
        "name": "toString",
        "kind": "method",
        "kindModifiers": "declare",
        "sortText": "0"
    }
]

So we end up sorting alphabetically. It may make sense to show sort prototype properties lower in this case

@ORESoftware
Copy link

ORESoftware commented Nov 27, 2017

yes I think it would help to show the top level properties at the top, and the prototype properties at the bottom.

perhaps show the type - typeof x === 'function' at the top, but show the prototype properties at the bottom.

@mhegazy mhegazy added Suggestion An idea for TypeScript Domain: Completion Lists The issue relates to showing completion lists in an editor Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature and removed javascript labels Nov 27, 2017
@RyanCavanaugh RyanCavanaugh added In Discussion Not yet reached consensus and removed Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Nov 28, 2017
@RyanCavanaugh
Copy link
Member

@mhegazy I'd say :shipit: - thoughts?

@mhegazy
Copy link
Contributor

mhegazy commented Nov 28, 2017

We have not changed the sort order historically.. we only omitted members from the list, e.g. built-in Object members. we did not do that for Function, but that was more of a bug than a feature, and ppl seemed to like it and did not mind the additional entries. i personally find changing the order a bit disorienting, and i always assume the list is ordered alphabetically. I would like to know if other users found that the additional entries are too much noise given that we hear ppl complaining about missing properties from on Object.

@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature and removed In Discussion Not yet reached consensus labels Nov 28, 2017
@ORESoftware
Copy link

ORESoftware commented Nov 28, 2017

how about tsconfig.json setting? :)

sortPropertiesPrototypically: true

lol

@RyanCavanaugh
Copy link
Member

This doesn't seem to have gathered any additional feedback, and would no doubt upset the people used to it being in this order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Domain: Completion Lists The issue relates to showing completion lists in an editor Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants