Fails to index a newly generated (g8) project #7074
-
Hi, I'm struggling with Metals on emacs/lsp-mode/eglot. Starting from a simple project created with diff --git a/build.sbt b/build.sbt
index 79b45fa..48d5529 100644
--- a/build.sbt
+++ b/build.sbt
@@ -8,7 +8,7 @@ lazy val root = (project in file("."))
organization := "com.example",
name := "quickstart",
version := "0.0.1-SNAPSHOT",
- scalaVersion := "3.1.0",
+ scalaVersion := "3.6.2",
libraryDependencies ++= Seq(
"org.http4s" %% "http4s-ember-server" % Http4sVersion,
"org.http4s" %% "http4s-ember-client" % Http4sVersion, I can't have metals working correctly in this project (using either eglot or lsp-mode) while it works perfectly in VS Code. As soon I run emacs on the
The same source code gets compiled by both SBT and Bloop. This is what I can see from metals.log:
that ends up in:
I have no scala 3.5.2 installed (currently I have installed 3.6.2) and I have no idea from where it comes from. I believe that is some sort of misconfiguration that makes metals fail to work correctly with bloop/bsp but I can't pin point the source of it. Wondering if anyone knows what is going on here :) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I think there are two issues:
|
Beta Was this translation helpful? Give feedback.
-
Answering myself for when I will stumble again into this pit. The 'eglot' LSP client needs to know which files are part of the current project. To do so it uses the Emacs native backend that is going to look either for (i) an EDE setup or (ii) a GIT repository. Missing both of them, 'eglot' is blind and will just start a new LSP session for each visited folder resulting in odd errors like disappearing dependencies from a previously loaded class path (as per my issue). To avoid these issues, remember to always create a proper GIT setup for any new Scala project. |
Beta Was this translation helpful? Give feedback.
Answering myself for when I will stumble again into this pit.
The 'eglot' LSP client needs to know which files are part of the current project. To do so it uses the Emacs native backend that is going to look either for (i) an EDE setup or (ii) a GIT repository. Missing both of them, 'eglot' is blind and will just start a new LSP session for each visited folder resulting in odd errors like disappearing dependencies from a previously loaded class path (as per my issue).
To avoid these issues, remember to always create a proper GIT setup for any new Scala project.