Skip to content

Jump to definition in Java files is broken, but code assistance still works #7913

@lihaoyi

Description

@lihaoyi

Describe the bug

Download and unpack

Open the folder in VSCode and hit the import build button in the Metals tab

See the third-party libraries have red squigglies, and navigation to them is broken:

Image

However, despite the squigglies and the navigation being broken, pulling up signatures and javadoc works:

Image

Furthermore, the libraries (argparse4j and thymeleaf in this example) do show up in the Metals / Packages / Libraries list

In an equivalent Scala project, such as the one below, no red squigglies are found and both navigation and peek-at-signatures/javadoc works flawlessly:

Furthermore, if I have a Scala module depending on a Java module, then jump-to-definition to the Java module's third-party dependencies works in the downstream Scala module's .scala files, but not in the upstream Java module's .java files

From the symptoms, it seems like we must be properly passing the module local and third-party dependencies to Metals (that's why non-navigation code insights in Java code and navigating to Java module dependencies in Scala code works), but Metals must be failing to wire these things up to the Java file editor's jump-to-definition feature

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

1.6.3

Scala version/s

Extra context or search terms

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions