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

Support for function call hierarchy #738

Closed
jneira opened this issue Sep 24, 2020 · 10 comments
Closed

Support for function call hierarchy #738

jneira opened this issue Sep 24, 2020 · 10 comments
Labels
Milestone

Comments

@jneira
Copy link
Member

jneira commented Sep 24, 2020

(From mpickering/ghcide#18)

  • It is a feature common in other ides like eclipse or intellij
  • It shows the graph of all transitive calls of a function, in a tree:
    • The nodes are selectable (shows info in the right pane) and navigable with ctrl+click
    • In the right pane other info like the possible multiple calls in the same funcion, with the line number (also navigables to the concrete line)

imagen

imagen

@wz1000
Copy link
Collaborator

wz1000 commented Sep 28, 2020

LSP 3.16 is not out yet

@jneira jneira changed the title Support for call hierarchy support Support for function call hierarchy Sep 28, 2020
@pepeiborra pepeiborra transferred this issue from haskell/ghcide Dec 30, 2020
@alanz
Copy link
Collaborator

alanz commented Jan 3, 2021

LSP 3.16 is not out yet

It is now.

@July541
Copy link
Collaborator

July541 commented May 28, 2021

To whom it may concern, I'm tackling this feature as my GSoC 2021 works. I make this comment to avoid duplication:)

@July541
Copy link
Collaborator

July541 commented Jun 21, 2021

Hello all, currently I am focusing on extract kind and span info from HieAST, and some details baffled me.

  1. the record field has two components, and the RecField is about Int, and another out target a is relevant to ValBind. see https://github.com/July541/haskell-language-server/blob/7a8979d7576e1e5d39e2f32f09511b1090925881/plugins/hls-call-hierarchy-plugin/test/Main.hs#L48
  2. type family and data family are all under FamDec, the span for type family is the whole expression like type family A, but the span for data family for example data family A is just the keyword data family without A. see https://github.com/July541/haskell-language-server/blob/7a8979d7576e1e5d39e2f32f09511b1090925881/plugins/hls-call-hierarchy-plugin/test/Main.hs#L103

@wz1000, it'd be appreciated if you have time to take a look at it.

@July541
Copy link
Collaborator

July541 commented Jul 2, 2021

The original reachable query in HieDb is for the whole graph, which not satisfy the call hierarchy that only requires one-hop vertexes. So I wrote some additional queries in my plugin, it has initial workability but still needs a deeper query to distinguish multi type with the same name like typeclass.


I still take much time to differentiate the behaviors between FOIs(file of interest) and non-FOIs, it seems FOIs can not extract HieAst from Shake, which cause it must require HieDb result.

By the way, VSCode implemented call hierarchy support but ignored the data field, not know why.microsoft/vscode#127853

@pepeiborra
Copy link
Collaborator

The original reachable query in HieDb is for the whole graph, which not satisfy the call hierarchy that only requires one-hop vertexes. So I wrote some additional queries in my plugin, it has initial workability but still needs a deeper query to distinguish multi type with the same name like typeclass.

Would it be better to move this discussion to the #1955 PR? I think that @wz1000 suggested the use of hiedb there.

I still take much time to differentiate the behaviors between FOIs(file of interest) and non-FOIs, it seems FOIs can not extract HieAst from Shake, which cause it must require HieDb result.

Can you clarify this remark? Both FOIs and non-FOIs are able to request HieAst via use GetHieAst. It's only during startup that the hiedb is used to locate the hie file for non FOIs.

@July541
Copy link
Collaborator

July541 commented Jul 4, 2021

Both FOIs and non-FOIs are able to request HieAst via use GetHieAst.

@pepeiborra Can I understand this as GetHieAst has the same result for both FOIs and non-FOIs?

For HieDb discussion, I'll push some code later as support.

@pepeiborra
Copy link
Collaborator

Both FOIs and non-FOIs are able to request HieAst via use GetHieAst.

@pepeiborra Can I understand this as GetHieAst has the same result for both FOIs and non-FOIs?

Yes, as far as I can tell.

@July541
Copy link
Collaborator

July541 commented Jul 11, 2021

To whom it may concern, the call hierarchy has basic functions.🚀🚀🚀

@jneira
Copy link
Member Author

jneira commented Aug 2, 2021

Many, mant thanks @July541 for implementing this long time awaited feature. It has been really welcomed by users.
So closing this with a big 🎉

@jneira jneira closed this as completed Aug 2, 2021
@jneira jneira added this to the 1.3.0 milestone Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants