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

Hovers on identifiers *defining* the item/variable are not working #5826

Closed
mkaput opened this issue Jun 19, 2024 · 6 comments · Fixed by #6255
Closed

Hovers on identifiers *defining* the item/variable are not working #5826

mkaput opened this issue Jun 19, 2024 · 6 comments · Fixed by #6255
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed ide This issue refers to CairoLS or editor extensions

Comments

@mkaput
Copy link
Contributor

mkaput commented Jun 19, 2024

Summary

When hovering over identifiers which define items/variables, user expects to get the same hover information as one produced when hovering over identifiers which reference these elements.

See examples:

Expected Actual
Image Image This case shows no hovers at all.
Image image Image This is the legacy hover implementation that we aim to remove.

Proposed solution

This logic only looks for references and completely ignores cases when the identifier under the cursor is actual name of the item/variable. Such condition should be added to this code:

// Get the resolved item info and the syntax node of the definition.
let (definition_item, definition_node) = {
let lookup_items = db.collect_lookup_items_stack(&identifier.as_syntax_node())?;
let (resolved_item, stable_ptr) = find_definition(db, identifier, &lookup_items)?;
let node = stable_ptr.lookup(db.upcast());
(resolved_item, node)
};

@mkaput mkaput added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed ide This issue refers to CairoLS or editor extensions labels Jun 19, 2024
@Villegas2003
Copy link

Hello Marek,

I'm a software developer and a student at Universidad Cenfotec. I have experience working with various technologies, including Angular for frontend development, Springboot for backend development, and MySQL for database management. Additionally, I have a strong interest in blockchain technology and have been eager to apply my knowledge in the Web3 space.

I'm interested in contributing to the Cairo project and would like to help with issue #5826. Could you provide more details on the current status and any guidelines for contributing?

Looking forward to collaborating.

@mkaput
Copy link
Contributor Author

mkaput commented Jul 2, 2024

Hello!

The issue is still open for taking :) I can assign it to you.

As I said, the implementation should extend the snippet provided in issue description. What I imagine, is that that find_definition(...)? call is replaced with match find_definition(...), and in the None case, an extra check is added that:

  1. Handles variables and params (they're not included in lookup item id array). This can be done by walking up AST for appropriate syntax node kinds and then checking if .name() is the same identifier as the one we have on the input.
  2. Otherwise, gets the top-most LookupItemId and checks .name() equality as described.

@mkaput
Copy link
Contributor Author

mkaput commented Jul 10, 2024

Hey @Villegas2003! Any progress on this? May I help you somehow?

@Villegas2003
Copy link

Hello @mkaput, I've been sick the past few weeks. I am going to proceed this week to release the issue. Apologies for the case.

Do you have a discord or telegram to communicate with us?

@mkaput
Copy link
Contributor Author

mkaput commented Jul 18, 2024

We can chat on Scarb's TG channel: https://t.me/+G_YxIv-XTFlhNWU0

@mkaput
Copy link
Contributor Author

mkaput commented Aug 2, 2024

@Villegas2003 any progress? how can I help?

@Draggu Draggu self-assigned this Aug 19, 2024
@Draggu Draggu linked a pull request Aug 26, 2024 that will close this issue
Draggu added a commit that referenced this issue Aug 26, 2024
fix #5826

commit-id:7654b189
Draggu added a commit that referenced this issue Aug 27, 2024
fix #5826

commit-id:7654b189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed ide This issue refers to CairoLS or editor extensions
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants