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

Distinguish types of calls for call hierarchy? #84100

Open
mjbvz opened this issue Nov 7, 2019 · 6 comments
Open

Distinguish types of calls for call hierarchy? #84100

mjbvz opened this issue Nov 7, 2019 · 6 comments
Assignees
Labels
api callhierarchy feature-request Request for new features or functionality
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Nov 7, 2019

For the call hierarchy, @rbuckton brought up that JavaScript and TypeScript has many different ways of actually invoking a function:

  • New new Foo()
  • Tagged templates: foo`bar`
  • Decorators @foo
  • Property/Element access to accessors obj.foo

My proposal is that TS should return call hierarchy items for all of these cases, but I wanted to check this with you @jrieken. Does that make sense? Should we consider having a way to distinguish different call types?

@jrieken jrieken added api callhierarchy feature-request Request for new features or functionality labels Nov 7, 2019
@jrieken
Copy link
Member

jrieken commented Nov 7, 2019

Yeah, I would say always return all calls but having something like a CallHierarchyCallKind-property on CallHierarchyIncomingCall and CallHierarchyOutgoinhCall sound reasonable. It will be nice if TS starts on this and then we adjust the UX for it

@mjbvz
Copy link
Collaborator Author

mjbvz commented Nov 7, 2019

@rbuckton Are there use cases where it would help users to be able to distinguish these different types of calls?

@rbuckton
Copy link
Member

rbuckton commented Nov 7, 2019

I don't have any specific use cases in mind, but I've seen similar features in other tools (such as Reflector) respect this kind of classification. For accessors especially, it can be useful to distinguish between call sites using the setter and call sites using the getter. Many hierarchy items will only have a single classification (classes can only be new-ed, most functions will only be called, etc.).

@jrieken
Copy link
Member

jrieken commented Nov 8, 2019

For accessors especially, it can be useful to distinguish between call sites using the setter and call sites using the getter.

I like and I believe that it will add value, e.g. the UX can show icons or allow to filter/group by kinds. In fact, there is a similar request to classify reference search results like that too, see #74237.

@rbuckton Would you be OK to invent kinds that make sense for TS and we take that as base to make this vscode API - basically a common denominator that works for multiple languages

@rbuckton
Copy link
Member

rbuckton commented Nov 8, 2019

Possibly, I'll see what I can come up with.

@rbuckton
Copy link
Member

So far it doesn't seem like there's a good reason to distinguish these types using icons:

image

image

However, I could see a use-case for filtering the results, possibly in the upper-right-hand corner of the peek adjacent to the "Calls To"/"Calls From" icon:

image

VS's version of Call Hierarchy does not have filtering, so I am not certain if there would be value in adding that capability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api callhierarchy feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants