Skip to content

Commit efca180

Browse files
committed
Introduce lsp-kernel module
1 parent b44f222 commit efca180

12 files changed

+18
-34
lines changed

build.sbt

+16-7
Original file line numberDiff line numberDiff line change
@@ -198,29 +198,38 @@ lazy val core = module("core")
198198
lazy val languageSupport = module("language-support")
199199
.dependsOn(core % "test->test;compile->compile", parser)
200200

201-
// Adapters for language services to LSP, actual LSP server binding, entrypoint
202-
lazy val lsp = module("lsp")
201+
// LSP features that aren't specific to any given lsp library (lsp4j, langoustine)
202+
lazy val lspKernel = module("lsp-kernel")
203203
.settings(
204204
libraryDependencies ++= Seq(
205-
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.24.0",
206205
"io.circe" %% "circe-core" % "0.14.12",
207206
"org.http4s" %% "http4s-ember-client" % "0.23.30",
208-
"org.http4s" %% "http4s-ember-server" % "0.23.30" % Test,
209207
("io.get-coursier" % "coursier_2.13" % "2.1.24")
210208
.exclude("org.scala-lang.modules", "scala-collection-compat_2.13"),
211209
"org.typelevel" %% "cats-tagless-core" % "0.16.3",
212-
).pipe(jsoniterFix),
210+
).pipe(jsoniterFix)
211+
)
212+
.enablePlugins(BuildInfoPlugin)
213+
.settings(
213214
buildInfoPackage := "playground.lsp.buildinfo",
214215
buildInfoKeys ++= Seq(version, scalaBinaryVersion),
216+
)
217+
.dependsOn(languageSupport)
218+
219+
lazy val lsp = module("lsp")
220+
.settings(
221+
libraryDependencies ++= Seq(
222+
"org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.24.0",
223+
"org.http4s" %% "http4s-ember-server" % "0.23.30" % Test,
224+
),
215225
(Test / test) := {
216226
(pluginCore / publishLocal).value
217227
(pluginSample / publishLocal).value
218228

219229
(Test / test).value
220230
},
221231
)
222-
.enablePlugins(BuildInfoPlugin)
223-
.dependsOn(languageSupport)
232+
.dependsOn(lspKernel)
224233

225234
lazy val e2e = module("e2e")
226235
.enablePlugins(BuildInfoPlugin)

modules/lsp/src/main/scala/playground/lsp/TextDocumentManager.scala modules/lsp-kernel/src/main/scala/playground/lsp/TextDocumentManager.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package playground
1+
package playground.lsp
22

33
import cats.data.OptionT
44
import cats.effect.Concurrent

modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala

-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ import cats.~>
1414
import com.google.gson.JsonElement
1515
import com.google.gson.JsonPrimitive
1616
import org.eclipse.lsp4j.*
17-
import org.eclipse.lsp4j.ServerCapabilities
18-
import org.eclipse.lsp4j.TextDocumentSyncKind
1917
import playground.CompilationError
2018
import playground.CompilationFailed
2119
import playground.FileCompiler
2220
import playground.FileRunner
2321
import playground.OperationCompiler
2422
import playground.PreludeCompiler
2523
import playground.ServiceIndex
26-
import playground.TextDocumentManager
2724
import playground.language
2825
import playground.language.CodeLensProvider
2926
import playground.language.CommandProvider

modules/lsp/src/main/scala/playground/lsp/MainServer.scala

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import cats.effect.std
77
import fs2.compression.Compression
88
import fs2.io.file.Files
99
import fs2.io.net.Network
10-
import playground.TextDocumentManager
1110

1211
/** Entrypoint to the language server. This is later adapted to the lsp4j model and used in Main to
1312
* launch. Anything workspace-related goes through this instance so this is what we use for some

modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import org.http4s.headers.Authorization
1515
import playground.FileRunner
1616
import playground.OperationRunner
1717
import playground.ServiceIndex
18-
import playground.TextDocumentManager
1918
import playground.language.CommandResultReporter
2019
import playground.std.StdlibRuntime
2120
import smithy4s.aws.AwsEnvironment

modules/lsp/src/main/scala/playground/lsp/ToUriOps.scala

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.eclipse.lsp4j.TextDocumentItem
55
import org.eclipse.lsp4j.WorkspaceFolder
66
import playground.language.Uri
77

8+
// todo: move to converters?
89
object ToUriOps {
910

1011
implicit final class TextDocumentIdentifierToUriSyntax(

modules/lsp/src/main/scala/playground/lsp/util/KleisliOps.scala

-21
This file was deleted.

0 commit comments

Comments
 (0)