Skip to content

Commit e0a4f22

Browse files
committed
Move LSP tests to kernel
1 parent 039c37c commit e0a4f22

29 files changed

+18
-26
lines changed

CONTRIBUTING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ You'll find these in [`modules/lsp/src/test`](modules/lsp/src/test), and they ru
2828

2929
This doesn't exercise the standard I/O interface of the server, but it's still a decent way to test the composition of all the modules with a filesystem directory ([`modules/lsp/src/test/resources/test-workspaces`](modules/lsp/src/test/resources/test-workspaces)).
3030

31-
To run integration tests, run `lsp/test`.
31+
These are working without any external LSP library like lsp4j or Langoustine.
32+
33+
To run integration tests, run `lsp-kernel/test`.
3234

3335
## Extension integration tests
3436

build.sbt

+11-11
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,14 @@ lazy val lspKernel = module("lsp-kernel")
208208
("io.get-coursier" % "coursier_2.13" % "2.1.24")
209209
.exclude("org.scala-lang.modules", "scala-collection-compat_2.13"),
210210
"org.typelevel" %% "cats-tagless-core" % "0.16.3",
211-
).pipe(jsoniterFix)
211+
"org.http4s" %% "http4s-ember-server" % "0.23.30" % Test,
212+
).pipe(jsoniterFix),
213+
(Test / test) := {
214+
(pluginCore / publishLocal).value
215+
(pluginSample / publishLocal).value
216+
217+
(Test / test).value
218+
},
212219
)
213220
.enablePlugins(BuildInfoPlugin)
214221
.settings(
@@ -220,17 +227,10 @@ lazy val lspKernel = module("lsp-kernel")
220227
lazy val lsp = module("lsp")
221228
.settings(
222229
libraryDependencies ++= Seq(
223-
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.24.0",
224-
"org.http4s" %% "http4s-ember-server" % "0.23.30" % Test,
225-
),
226-
(Test / test) := {
227-
(pluginCore / publishLocal).value
228-
(pluginSample / publishLocal).value
229-
230-
(Test / test).value
231-
},
230+
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.24.0"
231+
)
232232
)
233-
.dependsOn(lspKernel % "test->test;compile->compile")
233+
.dependsOn(lspKernel)
234234

235235
lazy val e2e = module("e2e")
236236
.enablePlugins(BuildInfoPlugin)

modules/lsp/src/test/scala/playground/lsp/EmptyConfigTests.scala modules/lsp-kernel/src/test/scala/playground/lsp/EmptyConfigTests.scala

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package playground.lsp
22

33
import cats.effect.IO
44
import cats.effect.kernel.Resource
5-
import org.eclipse.lsp4j.DidChangeWatchedFilesParams
65
import playground.lsp.harness.LanguageServerIntegrationTests
76
import playground.lsp.harness.TestClient
87
import weaver.*

modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala modules/lsp-kernel/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package playground.lsp
33
import cats.effect.IO
44
import cats.effect.Resource
55
import com.comcast.ip4s.*
6-
import org.eclipse.lsp4j
76
import org.http4s.HttpRoutes
87
import org.http4s.ember.server.EmberServerBuilder
98
import org.http4s.implicits.*

modules/lsp/src/test/scala/playground/lsp/LanguageServerReloadIntegrationTests.scala modules/lsp-kernel/src/test/scala/playground/lsp/LanguageServerReloadIntegrationTests.scala

-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ import cats.effect.IO
44
import cats.syntax.all.*
55
import fs2.io.file.Files
66
import fs2.io.file.Path
7-
import org.eclipse.lsp4j.CodeLensParams
8-
import org.eclipse.lsp4j.DidChangeWatchedFilesParams
9-
import org.eclipse.lsp4j.DocumentDiagnosticParams
10-
import org.eclipse.lsp4j.MessageType
11-
import org.eclipse.lsp4j.TextDocumentIdentifier
127
import playground.PlaygroundConfig
138
import playground.language.Uri
149
import playground.lsp.harness.LanguageServerIntegrationTests

modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala modules/lsp-kernel/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import cats.effect.IO
44
import cats.effect.IOLocal
55
import cats.effect.Resource
66
import cats.syntax.all.*
7-
import org.eclipse.lsp4j.InitializeParams
8-
import org.eclipse.lsp4j.WorkspaceFolder
97
import playground.language.Uri
108
import playground.lsp.LanguageServer
119
import playground.lsp.MainServer
@@ -58,11 +56,10 @@ trait LanguageServerIntegrationTests {
5856
.getEvents
5957
.flatMap { events =>
6058
val initLogs = List(
61-
TestClient
62-
.MessageLog(
63-
MessageType.Info,
64-
s"Hello from Smithy Playground v${BuildInfo.version}! Loading project...",
65-
),
59+
TestClient.MessageLog(
60+
MessageType.Info,
61+
s"Hello from Smithy Playground v${BuildInfo.version}! Loading project...",
62+
),
6663
TestClient.MessageLog(
6764
MessageType.Info,
6865
"Loaded Smithy Playground server with 2 source entries, 0 imports, 2 dependencies and 0 plugins",

0 commit comments

Comments
 (0)