You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now given a path like foo::bar::baz in code, LSP lets you navigate or get hover information on any of those segments except when the first segment refers to a crate.
Happy Case
LSP works for the crate segment too.
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered:
# Description
## Problem
Resolves#5787
## Summary
This is a minor thing, but hover and go-to-definition didn't work in
path segments that referred to crates. For completeness, and for
features we could build later on (for example making auto-import insert
new stuff inside existing paths if possible) I thought it would be nice
to have this working.
![lsp-crate](https://github.com/user-attachments/assets/be6d4308-6387-45c4-aac8-66459d15b746)
## Additional Context
While doing it some code got simplified: the part of a path that
referred to a crate didn't refer to anything (None) and that was the
only case where an Option was needed. Now that we capture all references
that None is gone.
I know we are kind of capturing module attributes twice, one in the def
maps and another in NodeInterner, but otherwise getting a Location from
a ReferenceId would also need def maps to be passed to NodeInterner,
which is a bit less convenient. In any case this information was tracked
like that already, it's just that it was missing for modules that were
crate roots.
Note that the information is still missing for the root module of the
root crate, so that case is handled separately in a couple of places.
Capturing this is doable, but I didn't know where to get the root crate
name from in `CrateDefMap::collect_defs`.
## Documentation
Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.
# PR Checklist
- [x] I have tested the changes locally.
- [x] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
Problem
Right now given a path like
foo::bar::baz
in code, LSP lets you navigate or get hover information on any of those segments except when the first segment refers to a crate.Happy Case
LSP works for the crate segment too.
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response
The text was updated successfully, but these errors were encountered: