-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
SCIP index symbols for struct/enum/const/static/impl nested in functions do not include function name #18771
Comments
The information whether something is inside function (or anything with body) is whether the module is a block module (this exists in hir-def, but adding it to hir should be easy enough). The problem is that block modules usually have no names. Handling it can be done by special-casing block modules to look at the name of the enclosing definitions. |
@ChayimFriedman2 Thanks for the info, glad this is in the representation. I've attempted to write a method to get the info, but got stuck going from
Would really appreciate it if on of you rust-analyzer experts would solve this part - feel free to push a commit to this branch adding such a function. I'm happy to make the moniker.rs changes based upon it. |
I believe we don't actually have an association from block to its container, only block to its parent module (which may be a block again). |
Indeed; but we do preserve an association between a block and its |
Thanks for the further info @ChayimFriedman2 ! I tried for about 15 minutes to sort out how to write the code for this by referencing this seemingly related code I found by searching for I would prefer to not block merging #18758 on this concern. It takes SCIP's symbol information from being wildly out of spec to only having a few known flaws. If we are blocking merge on this concern, then I would really appreciate it if someone that knows rust-analyzer better than me could update |
I don't think we should block on that either. |
This is demonstrated in tests included in #18758
The reason I did not fix this in that PR is that
hir
representation only appears to know what module these definitions are in, and not whether they are contained in a function. I am not familiar enough with rust-analyzer internals to provide such information. The fix would involve a change to theenclosing_definition
method or the methods it calls.The text was updated successfully, but these errors were encountered: