Metals: Can't get go to definitions to work in VS-Code

Created on 15 Jun 2019  路  6Comments  路  Source: scalameta/metals

Describe the bug

Fatal recursive dependency detected in 'root': List(root, root) getting this error whenever I run the import build on any .scala file

Getting these in the OUTPUT logs
Empty build targets. Expected at least one build target identifier
tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages to create an empty file at /Users/../Library/Caches/org.scalameta.metals/bsp.trace.json

To Reproduce
I'm pretty new to Scala and have no idea how you would reproduce this, and my guess that its probably related to the project am currently started working on

Installation:

  • Operating system: macOS
  • Editor: Visual Studio Code
  • Metals version: marketplace extention

Additional context
I tried removing .bloop and .metals and restarting VS-Code but nothing changed

Most helpful comment

This error is caused by bloop whenever a dependency of a project is found to be the project itself. You can see that in the definition of root in your build.sbt you apply dependsOn(... root), which is causing that problem.

However, it looks like the project ref in dependsOn is pointing to another project. Is that correct? I imagine that removing it makes your build fail, doesn't it?

Looks like this might be an error in how we resolve that dependency inside sbt. In the meanwhile, I'd recommend trying to modify your build not to use that project ref pointing to an http repository. That is quite a niche feature and it's not trivial to support.

All 6 comments

Hi @mohamedhajr, thanks for reporting!

It seems like an issue with the build structure, how does your build.sbt look like?

This error is caused by bloop whenever a dependency of a project is found to be the project itself. You can see that in the definition of root in your build.sbt you apply dependsOn(... root), which is causing that problem.

However, it looks like the project ref in dependsOn is pointing to another project. Is that correct? I imagine that removing it makes your build fail, doesn't it?

Looks like this might be an error in how we resolve that dependency inside sbt. In the meanwhile, I'd recommend trying to modify your build not to use that project ref pointing to an http repository. That is quite a niche feature and it's not trivial to support.

@jvican Since it's an issue with Bloop should we move it there or just close it if you don't plan on supporting it?

Thank you for reporting! The fix is to refactor build.sbt to avoid cyclic dependencies as explained by @jvican in https://github.com/scalameta/metals/issues/768#issuecomment-502352833. There isn't much we can do about this on the Metals side I'm afraid.

Even in the same Scala file, VSCode is not able to open the definition. Could this be a configuration issue or is this a bug and I should open a new ticket?

Even in the same Scala file, VSCode is not able to open the definition. Could this be a configuration issue or is this a bug and I should open a new ticket?

Most likely a new ticket with more information, this is a pretty specific issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

banzecrew picture banzecrew  路  3Comments

tanishiking picture tanishiking  路  4Comments

oscarvarto picture oscarvarto  路  3Comments

tpolecat picture tpolecat  路  3Comments

laughedelic picture laughedelic  路  3Comments