Repository navigation
fix: prefer non-export definition locations - #20252
Conversation
| .filter(_.source == sym.source) | ||
| .partition(_.tree.symbol.is(Exported)) | ||
|
|
||
| otherDefs.headOption.orElse(exportedDefs.headOption) match |
There was a problem hiding this comment.
What if instead of returning the head option we returned all the locations, in that List(loc) below, so that then downstream can show users a choice of location (i.e. the source of the export and the original)?
Other than that lgtm
There was a problem hiding this comment.
Generally, that makes sense. However, for this particular case it will cause an inconsistency in Metals. If the definition and user's cursor are not in the same file, pc will use Metals's symbol search, and that search will not be able to find the export <smth>.*. So I am not sure that it would be better.
tgodzik
left a comment
There was a problem hiding this comment.
LGTM! We can switch to showing export location also if needed, but that is more complex, since semanticdb doesn't contain the symbols within the file with exports
Backports #20252 to the LTS branch. PR submitted by the release tooling. [skip ci]
fixes: scalameta/metals#5892