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

No code navigation when source (and dependency) jar reside in local repo #6693

Open
p-pavel opened this issue Aug 20, 2024 · 4 comments · May be fixed by #6698
Open

No code navigation when source (and dependency) jar reside in local repo #6693

p-pavel opened this issue Aug 20, 2024 · 4 comments · May be fixed by #6698
Labels
bug Something that is making a piece of functionality unusable indexing

Comments

@p-pavel
Copy link

p-pavel commented Aug 20, 2024

Describe the bug

This was discussed in discord channel

metals-test.zip

Attached is the project including local maven repo. This was created with scala-cli.

running vscode/metals in codeThatUsesRepo does not permit code navigation to the sources contained in local repo.

The problem persists with both scala-cli and bloop used as build server.

Code completion and compiling works ok.

I also tried the following:

moved scala-cli generated build server configuration to .bloop
removed .scala-cli .vscode .metals directories
restarted vscode, so metals now uses bloop (I checked) as a build server without any notice of scala-cli around.

The situation is the same: everything works (compiling, completion, running) except source navigation.

bloop configs mention correct location for source jar.

Expected behavior

No response

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

1.3.5+58-ead4e2ec-SNAPSHOT

Extra context or search terms

No response

@p-pavel
Copy link
Author

p-pavel commented Aug 20, 2024

While probably not causing the issue by itself, it's worth noting that having hardcoded repositories in JarSourcesProvider is probably not the best solution:

image

@kasiaMarek

@kasiaMarek
Copy link
Contributor

While probably not causing the issue by itself, it's worth noting that having hardcoded repositories in JarSourcesProvider is probably not the best solution

JarSourcesProvider only serves as a fallback, by default build server should pass sources to Metals. It would be better to get the repositories from the build but I don't think there is a way to get that information from the build server (it isn't a part of the BSP). So this is only a "try something it may work" fallback.

@p-pavel
Copy link
Author

p-pavel commented Aug 21, 2024

While probably not causing the issue by itself, it's worth noting that having hardcoded repositories in JarSourcesProvider is probably not the best solution

JarSourcesProvider only serves as a fallback, by default build server should pass sources to Metals. It would be better to get the repositories from the build but I don't think there is a way to get that information from the build server (it isn't a part of the BSP). So this is only a "try something it may work" fallback.

💯

Agree, that what I said to @tgodzik, but he suggested dropping a note into the issue anyway.

@p-pavel
Copy link
Author

p-pavel commented Aug 21, 2024

Ok. The problem boils down to the fact that here we have completely Scala 3 shop so artefacts are published without scala version postfix (api-sources.jar not api_3-sources.jar).

So the version detected by scala.meta.internal.metals.ScalaVersion.dialectForScalaVersion becomes Scala213Source3 (I'm not sure why). If the jar is published with correct _3 postfix everything works ok.

I'm not sure what the correct behaviour should be in this case, but for us it's easier to republish the jars and make one-line correction to the general build procedure.

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 indexing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants