Dealing with recursive dependencies in Scala Metals language server with bloop

320 views Asked by At

I've been using coc.nvim for a bit and really loving it. Recently I've started working on a relatively large project consisting mostly of Scala code and so installed the coc-metals extension, which automatically installs the language server and other stuff. Works fine in projects with simpler dependency graphs, but importing the full project and building it fails with errors like [coc.nvim] Fatal recursive dependency detected in.... I'm using maven as a build tool, and it builds fine.

I believe the problem is related to bloop. Running bloop projects from the project root gives the same errors. Why does the code build fine just running mvn clean install but not with bloop? Without being able to use bloop from the root, jumping to definitions across projects/modules doesn't work, along with lots of other features of metals & CoC.

Any related issues or ideas at all are much appreciated to help get this working! (Including the VS code tag because it uses the same metals LSP and so the problems should be the same)

Edit: Can confirm that VS code has the exact same issues when installing the Scala (metals) extension.

Edit: Is there perhaps any way I can run metals directly while avoiding anything to do with bloop? IntelliJ can import the project fine, so I know it's not anything wrong with that itself.

1

There are 1 answers

1
João Fé On

Try sbt BSP.

https://scalameta.org/metals/blog/2020/11/06/sbt-BSP-support/#how-do-i-try-it-out

On [neo]vim run :MetalsGenerateBspConfig.