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

When hovering over a variable, show its declaration line #49

Open
certik opened this issue Dec 23, 2024 · 3 comments
Open

When hovering over a variable, show its declaration line #49

certik opened this issue Dec 23, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@certik
Copy link
Contributor

certik commented Dec 23, 2024

Example:

image

Instead of just x, it should show integer :: x.

@certik certik added the enhancement New feature or request label Dec 23, 2024
@Pranavchiku
Copy link
Member

Pranavchiku commented Dec 24, 2024

This is tricky. To do this we need to pass location information of Declaration_t node and that is possible but what if we have integer :: x, y, z and then if I hover on print *, x it will show me integer :: x, y, z

@certik
Copy link
Contributor Author

certik commented Dec 24, 2024

We don't need to pass any AST nodes.

Here is how it should work:

  • you hover over x which is a Var ASR node
  • you lookup the corresponding Symbol ASR node
  • you call a utility function that converts the ttype into Fortran and show it.

So in the example integer :: x, y, z, it will show integer :: x. It can even just show integer, as that is the Fortran print of the ttype, but it might be good to format it as a Fortran declaration.

What it prints will not be the same as in the source code.

Alternatively, we can just show the source code for the Location span in the Symbol ASR, which will show the declaration, however, I would show the actual type computed from ttype. That will be accurate and very useful to users.

@Pranavchiku
Copy link
Member

That is nice, yes, we can do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants