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

Goto-definition does not work on methods if they are exported in a single export-clause #7256

Open
tmiseikis opened this issue Feb 28, 2025 · 1 comment · May be fixed by scala/scala3#22722
Assignees
Labels
bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3

Comments

@tmiseikis
Copy link

Describe the bug

Given the following code:

object Test:
    /** Doc for methodA. */
    def methodA: Unit = ???
    /** Doc for methodB. */
    def methodB: Unit = ???

export Test.{methodA, methodB}

If you navigate with a cursor to "methodA" or "methodB" in the export-clause and try to execute goto-definition or hover on them then it does not work.

If you re-define them in separate export-clauses as follows:

object Test:
    /** Doc for methodA. */
    def methodA: Unit = ???
    /** Doc for methodB. */
    def methodB: Unit = ???

export Test.methodA
export Test.methodB

Then it works:
Image

Expected behavior

I would expect goto definition, hover, and other actions to work when exporting multiple definitions in the export-clause.

Operating system

macOS

Editor/Extension

Nvim (nvim-metals)

Version of Metals

v1.5.1

Extra context or search terms

No response

@kasiaMarek kasiaMarek added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 labels Feb 28, 2025
@kasiaMarek
Copy link
Member

kasiaMarek commented Feb 28, 2025

I checked this on 3.7.0-RC1-bin-20250227-1b0be01-NIGHTLY and there are at least two different bugs here.

For:

export Test.{me@@thodA, methodB}

it seems that the fix from #5892 wasn't applied, and it treats methodA in the export clause as definition. So go to def leads to the same place and there are no docs.

For:

export Test.met@@hodA

no symbol is found here for me, so no definition, no hover, no semantic token. Possibly we handle that wrong after #5892.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants