-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add custom project root setting
- Loading branch information
1 parent
fb4b251
commit cf13700
Showing
4 changed files
with
92 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/slow/src/test/scala/tests/CustomProjectRootLspSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package tests | ||
import scala.meta.internal.metals.UserConfiguration | ||
import scala.meta.internal.metals.{BuildInfo => V} | ||
|
||
class CustomProjectRootLspSuite | ||
extends BaseLspSuite("custom-project-root", BloopImportInitializer) { | ||
override def userConfig: UserConfiguration = | ||
UserConfiguration().copy(customProjectRoot = Some("inner/inner/")) | ||
|
||
test("basic") { | ||
cleanWorkspace() | ||
for { | ||
_ <- initialize( | ||
s"""|/build.sbt | ||
|scalaVersion := "${V.scala213}" | ||
|/inner/inner/project.scala | ||
|//> using scala ${V.scala3} | ||
|/inner/inner/Main.scala | ||
|package a | ||
| | ||
|val k = 1 | ||
|val m: Int = "aaa" | ||
|""".stripMargin | ||
) | ||
_ <- server.didOpen("inner/inner/Main.scala") | ||
_ = assert(server.server.bspSession.exists(_.main.isScalaCLI)) | ||
_ = assertEquals( | ||
client.workspaceDiagnostics, | ||
"""|inner/inner/Main.scala:4:14: error: Found: ("aaa" : String) | ||
|Required: Int | ||
|val m: Int = "aaa" | ||
| ^^^^^ | ||
|""".stripMargin, | ||
) | ||
} yield () | ||
} | ||
} |