mirror of https://github.com/sbt/sbt.git
Merge pull request #5538 from adpi2/topic/build-server-protocol
Topic/build server protocol
This commit is contained in:
commit
e165629d74
|
|
@ -10,4 +10,4 @@ npm-debug.log
|
|||
.idea
|
||||
.bloop
|
||||
.metals
|
||||
metals.sbt
|
||||
/project/metals.sbt
|
||||
|
|
|
|||
|
|
@ -731,6 +731,8 @@ lazy val commandProj = (project in file("main-command"))
|
|||
exclude[DirectMissingMethodProblem]("sbt.Exec.copy$default$*"),
|
||||
// internal
|
||||
exclude[ReversedMissingMethodProblem]("sbt.internal.client.ServerConnection.*"),
|
||||
exclude[MissingTypesProblem]("sbt.internal.server.ServerConnection*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.server.ServerConnection.*")
|
||||
),
|
||||
unmanagedSources in (Compile, headerCreate) := {
|
||||
val old = (unmanagedSources in (Compile, headerCreate)).value
|
||||
|
|
@ -889,7 +891,7 @@ lazy val mainProj = (project in file("main"))
|
|||
exclude[IncompatibleSignatureProblem]("sbt.internal.Inspect.*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.ProjectIndex.*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.BuildIndex.*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.server.LanguageServerReporter.*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.server.BuildServerReporter.*"),
|
||||
exclude[VirtualStaticMemberProblem]("sbt.internal.server.LanguageServerProtocol.*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.librarymanagement.IvyXml.*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.ScriptedPlugin.*Settings"),
|
||||
|
|
@ -907,6 +909,7 @@ lazy val mainProj = (project in file("main"))
|
|||
exclude[MissingClassProblem]("sbt.internal.FileManagement"),
|
||||
exclude[MissingClassProblem]("sbt.internal.FileManagement$"),
|
||||
exclude[MissingClassProblem]("sbt.internal.FileManagement$CopiedFileTreeRepository"),
|
||||
exclude[MissingClassProblem]("sbt.internal.server.LanguageServerReporter*"),
|
||||
// false positives
|
||||
exclude[DirectMissingMethodProblem]("sbt.plugins.IvyPlugin.requires"),
|
||||
exclude[DirectMissingMethodProblem]("sbt.plugins.JUnitXmlReportPlugin.requires"),
|
||||
|
|
@ -941,12 +944,14 @@ lazy val mainProj = (project in file("main"))
|
|||
exclude[IncompatibleSignatureProblem]("sbt.ProjectExtra.inScope"),
|
||||
exclude[MissingTypesProblem]("sbt.internal.Load*"),
|
||||
exclude[IncompatibleSignatureProblem]("sbt.internal.Load*"),
|
||||
exclude[MissingTypesProblem]("sbt.internal.server.NetworkChannel"),
|
||||
// IvyConfiguration was replaced by InlineIvyConfiguration in the generic
|
||||
// signature, this does not break compatibility regardless of what
|
||||
// cast a compiler might have inserted based on the old signature
|
||||
// since we're returning the same values as before.
|
||||
exclude[IncompatibleSignatureProblem]("sbt.Classpaths.mkIvyConfiguration"),
|
||||
exclude[IncompatibleMethTypeProblem]("sbt.internal.server.Definition*"),
|
||||
exclude[IncompatibleTemplateDefProblem]("sbt.internal.server.LanguageServerProtocol")
|
||||
)
|
||||
)
|
||||
.configure(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.client
|
||||
|
||||
import java.io.{ File, InputStream, OutputStream }
|
||||
import java.net.Socket
|
||||
|
||||
import sbt.Exit
|
||||
import sbt.io.syntax._
|
||||
import sbt.protocol.ClientSocket
|
||||
|
||||
import scala.sys.process.Process
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
class BspClient private (sbtServer: Socket) {
|
||||
|
||||
private def transferTo(input: InputStream, output: OutputStream): Unit = {
|
||||
val buffer = Array.ofDim[Byte](1024)
|
||||
while (true) {
|
||||
val size = input.read(buffer)
|
||||
output.write(buffer, 0, size)
|
||||
output.flush()
|
||||
}
|
||||
}
|
||||
|
||||
private def run(): Exit = {
|
||||
try {
|
||||
val redirection = new Thread {
|
||||
override def run(): Unit = transferTo(sbtServer.getInputStream, System.out)
|
||||
}
|
||||
|
||||
redirection.start()
|
||||
transferTo(System.in, sbtServer.getOutputStream)
|
||||
|
||||
Exit(0)
|
||||
} catch {
|
||||
case NonFatal(_) => Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object BspClient {
|
||||
def run(configuration: xsbti.AppConfiguration): Exit = {
|
||||
val baseDirectory = configuration.baseDirectory
|
||||
val portFile = baseDirectory / "project" / "target" / "active.json"
|
||||
try {
|
||||
if (!portFile.exists) {
|
||||
forkServer(baseDirectory, portFile)
|
||||
}
|
||||
val (socket, _) = ClientSocket.socket(portFile)
|
||||
new BspClient(socket).run()
|
||||
} catch {
|
||||
case NonFatal(_) => Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forks another instance of sbt in the background.
|
||||
* This instance must be shutdown explicitly via `sbt -client shutdown`
|
||||
*/
|
||||
def forkServer(baseDirectory: File, portfile: File): Unit = {
|
||||
val args = List[String]()
|
||||
val launchOpts = List("-Xms2048M", "-Xmx2048M", "-Xss2M")
|
||||
|
||||
val launcherJarString = sys.props.get("java.class.path") match {
|
||||
case Some(cp) =>
|
||||
cp.split(File.pathSeparator)
|
||||
.headOption
|
||||
.getOrElse(sys.error("launcher JAR classpath not found"))
|
||||
case _ => sys.error("property java.class.path expected")
|
||||
}
|
||||
|
||||
val cmd = "java" :: launchOpts ::: "-jar" :: launcherJarString :: args
|
||||
val process = Process(cmd, baseDirectory).run()
|
||||
|
||||
while (process.isAlive() && !portfile.exists) Thread.sleep(100)
|
||||
|
||||
if (!process.isAlive()) sys.error("sbt server exited")
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ class NetworkClient(configuration: xsbti.AppConfiguration, arguments: List[Strin
|
|||
def onNotification(msg: JsonRpcNotificationMessage): Unit = {
|
||||
def splitToMessage: Vector[(Level.Value, String)] =
|
||||
(msg.method, msg.params) match {
|
||||
case ("window/logMessage", Some(json)) =>
|
||||
case ("build/logMessage", Some(json)) =>
|
||||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
Converter.fromJson[LogMessageParams](json) match {
|
||||
case Success(params) => splitLogMessage(params)
|
||||
|
|
|
|||
|
|
@ -10,22 +10,26 @@ package internal
|
|||
package server
|
||||
|
||||
import java.io.{ File, IOException }
|
||||
import java.net.{ SocketTimeoutException, InetAddress, ServerSocket, Socket }
|
||||
import java.lang.management.ManagementFactory
|
||||
import java.net.{ InetAddress, ServerSocket, Socket, SocketTimeoutException }
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.nio.file.attribute.{ UserPrincipal, AclEntry, AclEntryPermission, AclEntryType }
|
||||
import java.nio.file.attribute.{ AclEntry, AclEntryPermission, AclEntryType, UserPrincipal }
|
||||
import java.security.SecureRandom
|
||||
import java.math.BigInteger
|
||||
|
||||
import scala.concurrent.{ Future, Promise }
|
||||
import scala.util.{ Try, Success, Failure }
|
||||
import scala.util.{ Failure, Success, Try }
|
||||
import sbt.internal.protocol.{ PortFile, TokenFile }
|
||||
import sbt.util.Logger
|
||||
import sbt.io.IO
|
||||
import sbt.io.syntax._
|
||||
import sjsonnew.support.scalajson.unsafe.{ Converter, CompactPrinter }
|
||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter }
|
||||
import sbt.internal.protocol.codec._
|
||||
import sbt.internal.util.ErrorHandling
|
||||
import sbt.internal.util.Util.isWindows
|
||||
import org.scalasbt.ipcsocket._
|
||||
import sbt.internal.bsp.BuildServerConnection
|
||||
import xsbti.AppConfiguration
|
||||
|
||||
private[sbt] sealed trait ServerInstance {
|
||||
def shutdown(): Unit
|
||||
|
|
@ -85,6 +89,7 @@ private[sbt] object Server {
|
|||
serverSocketOpt = Option(serverSocket)
|
||||
log.info(s"sbt server started at ${connection.shortName}")
|
||||
writePortfile()
|
||||
writeBspConnectionDetails()
|
||||
running.set(true)
|
||||
p.success(())
|
||||
while (running.get()) {
|
||||
|
|
@ -194,6 +199,15 @@ private[sbt] object Server {
|
|||
IO.write(portfile, CompactPrinter(json))
|
||||
}
|
||||
|
||||
private[this] def writeBspConnectionDetails(): Unit = {
|
||||
import bsp.codec.JsonProtocol._
|
||||
val sbtVersion = appConfiguration.provider.id.version
|
||||
val launcherJar = ManagementFactory.getRuntimeMXBean.getClassPath
|
||||
val details = BuildServerConnection.details(sbtVersion, launcherJar)
|
||||
val json = Converter.toJson(details).get
|
||||
IO.write(bspConnectionFile, CompactPrinter(json), append = false)
|
||||
}
|
||||
|
||||
private[sbt] def prepareSocketfile(): Unit = {
|
||||
if (socketfile.exists) {
|
||||
IO.delete(socketfile)
|
||||
|
|
@ -211,7 +225,9 @@ private[sbt] case class ServerConnection(
|
|||
portfile: File,
|
||||
tokenfile: File,
|
||||
socketfile: File,
|
||||
pipeName: String
|
||||
pipeName: String,
|
||||
bspConnectionFile: File,
|
||||
appConfiguration: AppConfiguration
|
||||
) {
|
||||
def shortName: String = {
|
||||
connectionType match {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ package server
|
|||
import sjsonnew.JsonFormat
|
||||
import sbt.internal.protocol._
|
||||
import sbt.util.Logger
|
||||
import sbt.protocol.{ SettingQuery => Q, CompletionParams => CP }
|
||||
import sbt.protocol.{ CompletionParams => CP, SettingQuery => Q }
|
||||
import sbt.internal.langserver.{ CancelRequestParams => CRP }
|
||||
|
||||
/**
|
||||
|
|
@ -64,6 +64,7 @@ trait ServerCallback {
|
|||
def jsonRpcRespondError(execId: Option[String], code: Long, message: String): Unit
|
||||
def jsonRpcNotify[A: JsonFormat](method: String, params: A): Unit
|
||||
def appendExec(exec: Exec): Boolean
|
||||
def appendExec(commandLine: String, requestId: Option[String]): Boolean
|
||||
def log: Logger
|
||||
def name: String
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ package sbt
|
|||
|
||||
import java.io.{ File, PrintWriter }
|
||||
import java.net.{ URI, URL, URLClassLoader }
|
||||
import java.nio.file.{ Path => NioPath, Paths }
|
||||
import java.nio.file.{ Paths, Path => NioPath }
|
||||
import java.util.Optional
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
|
@ -43,9 +43,11 @@ import sbt.internal.librarymanagement.mavenint.{
|
|||
import sbt.internal.librarymanagement.{ CustomHttp => _, _ }
|
||||
import sbt.internal.nio.{ CheckBuildSources, Globs }
|
||||
import sbt.internal.server.{
|
||||
BspCompileTask,
|
||||
BuildServerProtocol,
|
||||
BuildServerReporter,
|
||||
Definition,
|
||||
LanguageServerProtocol,
|
||||
LanguageServerReporter,
|
||||
ServerHandler
|
||||
}
|
||||
import sbt.internal.testing.TestLogger
|
||||
|
|
@ -198,9 +200,10 @@ object Defaults extends BuildCommon {
|
|||
},
|
||||
fileConverter := MappedFileConverter(rootPaths.value, allowMachinePath.value),
|
||||
fullServerHandlers := {
|
||||
(Vector(LanguageServerProtocol.handler(fileConverter.value))
|
||||
++ serverHandlers.value
|
||||
++ Vector(ServerHandler.fallback))
|
||||
Seq(
|
||||
LanguageServerProtocol.handler(fileConverter.value),
|
||||
BuildServerProtocol.handler(sbtVersion.value)
|
||||
) ++ serverHandlers.value :+ ServerHandler.fallback
|
||||
},
|
||||
uncachedStamper := Stamps.uncachedStamps(fileConverter.value),
|
||||
reusableStamper := Stamps.timeWrapLibraryStamps(uncachedStamper.value, fileConverter.value),
|
||||
|
|
@ -237,7 +240,7 @@ object Defaults extends BuildCommon {
|
|||
bgCopyClasspath :== true,
|
||||
closeClassLoaders :== SysProp.closeClassLoaders,
|
||||
allowZombieClassLoaders :== true,
|
||||
)
|
||||
) ++ BuildServerProtocol.globalSettings
|
||||
|
||||
private[sbt] lazy val globalIvyCore: Seq[Setting[_]] =
|
||||
Seq(
|
||||
|
|
@ -383,7 +386,8 @@ object Defaults extends BuildCommon {
|
|||
sys.env.contains("CI") || SysProp.ci,
|
||||
// watch related settings
|
||||
pollInterval :== Watch.defaultPollInterval,
|
||||
) ++ LintUnused.lintSettings ++ DefaultBackgroundJobService.backgroundJobServiceSettings
|
||||
) ++ LintUnused.lintSettings
|
||||
++ DefaultBackgroundJobService.backgroundJobServiceSettings
|
||||
)
|
||||
|
||||
def defaultTestTasks(key: Scoped): Seq[Setting[_]] =
|
||||
|
|
@ -640,7 +644,7 @@ object Defaults extends BuildCommon {
|
|||
compile := compileTask.value,
|
||||
internalDependencyConfigurations := InternalDependencies.configurations.value,
|
||||
manipulateBytecode := compileIncremental.value,
|
||||
compileIncremental := (compileIncrementalTask tag (Tags.Compile, Tags.CPU)).value,
|
||||
compileIncremental := compileIncrementalTask.tag(Tags.Compile, Tags.CPU).value,
|
||||
printWarnings := printWarningsTask.value,
|
||||
compileAnalysisFilename := {
|
||||
// Here, if the user wants cross-scala-versioning, we also append it
|
||||
|
|
@ -1850,8 +1854,10 @@ object Defaults extends BuildCommon {
|
|||
analysis
|
||||
}
|
||||
def compileIncrementalTask = Def.task {
|
||||
// TODO - Should readAnalysis + saveAnalysis be scoped by the compile task too?
|
||||
compileIncrementalTaskImpl(streams.value, (compileInputs in compile).value)
|
||||
BspCompileTask.compute(bspTargetIdentifier.value, thisProjectRef.value, configuration.value) {
|
||||
// TODO - Should readAnalysis + saveAnalysis be scoped by the compile task too?
|
||||
compileIncrementalTaskImpl(streams.value, (compileInputs in compile).value)
|
||||
}
|
||||
}
|
||||
private val incCompiler = ZincUtil.defaultIncrementalCompiler
|
||||
private[this] def compileIncrementalTaskImpl(s: TaskStreams, ci: Inputs): CompileResult = {
|
||||
|
|
@ -1873,7 +1879,7 @@ object Defaults extends BuildCommon {
|
|||
val prev = i.previousResult
|
||||
prev.analysis.toOption map { analysis =>
|
||||
i.setup.reporter match {
|
||||
case r: LanguageServerReporter =>
|
||||
case r: BuildServerReporter =>
|
||||
r.resetPrevious(analysis)
|
||||
case _ => ()
|
||||
}
|
||||
|
|
@ -1936,7 +1942,8 @@ object Defaults extends BuildCommon {
|
|||
)
|
||||
},
|
||||
compilerReporter := {
|
||||
new LanguageServerReporter(
|
||||
new BuildServerReporter(
|
||||
bspTargetIdentifier.value,
|
||||
maxErrors.value,
|
||||
streams.value.log,
|
||||
foldMappers(sourcePositionMappers.value),
|
||||
|
|
@ -2174,7 +2181,7 @@ object Classpaths {
|
|||
classpathConfiguration.?.value,
|
||||
update.value
|
||||
)
|
||||
)
|
||||
) ++ BuildServerProtocol.configSettings
|
||||
private[this] def classpaths: Seq[Setting[_]] =
|
||||
Seq(
|
||||
externalDependencyClasspath := concat(unmanagedClasspath, managedClasspath).value,
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import sbt.Def.ScopedKey
|
|||
import sbt.KeyRanks._
|
||||
import sbt.internal.InMemoryCacheStore.CacheStoreFactoryFactory
|
||||
import sbt.internal._
|
||||
import sbt.internal.bsp._
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.internal.io.WatchState
|
||||
import sbt.internal.librarymanagement.{ CompatibilityWarningOptions, IvySbt }
|
||||
|
|
@ -338,6 +339,20 @@ object Keys {
|
|||
val closeClassLoaders = settingKey[Boolean]("Close classloaders in run and test when the task completes.").withRank(DSetting)
|
||||
val allowZombieClassLoaders = settingKey[Boolean]("Allow a classloader that has previously been closed by `run` or `test` to continue loading classes.")
|
||||
|
||||
val bspTargetIdentifier = settingKey[BuildTargetIdentifier]("Id for BSP build target.").withRank(DSetting)
|
||||
val bspWorkspace = settingKey[Map[BuildTargetIdentifier, Scope]]("Mapping of BSP build targets to sbt scopes").withRank(DSetting)
|
||||
val bspInternalDependencyConfigurations = settingKey[Seq[(ProjectRef, Set[String])]]("The project configurations that this configuration depends on, possibly transitivly").withRank(DSetting)
|
||||
val bspWorkspaceBuildTargets = taskKey[Seq[BuildTarget]]("List all the BSP build targets").withRank(DTask)
|
||||
val bspBuildTarget = taskKey[BuildTarget]("Description of the BSP build targets").withRank(DTask)
|
||||
val bspBuildTargetSources = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetSourcesItem = taskKey[SourcesItem]("").withRank(DTask)
|
||||
val bspBuildTargetDependencySources = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetDependencySourcesItem = taskKey[DependencySourcesItem]("").withRank(DTask)
|
||||
val bspBuildTargetCompile = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetCompileItem = taskKey[Int]("").withRank(DTask)
|
||||
val bspBuildTargetScalacOptions = inputKey[Unit]("").withRank(DTask)
|
||||
val bspBuildTargetScalacOptionsItem = taskKey[ScalacOptionsItem]("").withRank(DTask)
|
||||
|
||||
val useCoursier = settingKey[Boolean]("Use Coursier for dependency resolution.").withRank(BSetting)
|
||||
val csrCacheDirectory = settingKey[File]("Coursier cache directory. Uses -Dsbt.coursier.home or Coursier's default.").withRank(CSetting)
|
||||
val csrMavenProfiles = settingKey[Set[String]]("").withRank(CSetting)
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import sbt.compiler.EvalImports
|
|||
import sbt.internal.Aggregation.AnyKeys
|
||||
import sbt.internal.CommandStrings.BootCommand
|
||||
import sbt.internal._
|
||||
import sbt.internal.client.BspClient
|
||||
import sbt.internal.inc.ScalaInstance
|
||||
import sbt.internal.nio.CheckBuildSources
|
||||
import sbt.internal.util.Types.{ const, idFun }
|
||||
|
|
@ -51,18 +52,23 @@ private[sbt] object xMain {
|
|||
val clientModByEnv = SysProp.client
|
||||
val userCommands = configuration.arguments.map(_.trim)
|
||||
val isClient: String => Boolean = cmd => (cmd == DashClient) || (cmd == DashDashClient)
|
||||
Terminal.withStreams {
|
||||
if (clientModByEnv || userCommands.exists(isClient)) {
|
||||
val args = userCommands.toList.filterNot(isClient)
|
||||
NetworkClient.run(configuration, args)
|
||||
Exit(0)
|
||||
} else {
|
||||
val state = StandardMain.initialState(
|
||||
configuration,
|
||||
Seq(defaults, early),
|
||||
runEarly(DefaultsCommand) :: runEarly(InitCommand) :: BootCommand :: Nil
|
||||
)
|
||||
StandardMain.runManaged(state)
|
||||
val isBsp: String => Boolean = cmd => (cmd == "-bsp") || (cmd == "--bsp")
|
||||
if (userCommands.exists(isBsp)) {
|
||||
BspClient.run(configuration)
|
||||
} else {
|
||||
Terminal.withStreams {
|
||||
if (clientModByEnv || userCommands.exists(isClient)) {
|
||||
val args = userCommands.toList.filterNot(isClient)
|
||||
NetworkClient.run(configuration, args)
|
||||
Exit(0)
|
||||
} else {
|
||||
val state = StandardMain.initialState(
|
||||
configuration,
|
||||
Seq(defaults, early),
|
||||
runEarly(DefaultsCommand) :: runEarly(InitCommand) :: BootCommand :: Nil
|
||||
)
|
||||
StandardMain.runManaged(state)
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ package sbt
|
|||
|
||||
import sbt.internal.{ Load, LoadedBuildUnit }
|
||||
import sbt.internal.util.{ AttributeKey, Dag, Types }
|
||||
|
||||
import sbt.librarymanagement.{ Configuration, ConfigRef }
|
||||
|
||||
import sbt.librarymanagement.{ ConfigRef, Configuration }
|
||||
import Types.const
|
||||
import Def.Initialize
|
||||
import java.net.URI
|
||||
|
|
@ -23,6 +21,16 @@ object ScopeFilter {
|
|||
type ConfigurationFilter = AxisFilter[ConfigKey]
|
||||
type TaskFilter = AxisFilter[AttributeKey[_]]
|
||||
|
||||
/**
|
||||
* Construct a Scope filter from a sequence of individual scopes.
|
||||
*/
|
||||
def in(scopes: Seq[Scope]): ScopeFilter = {
|
||||
val scopeSet = scopes.toSet
|
||||
new ScopeFilter {
|
||||
override private[ScopeFilter] def apply(data: Data): Scope => Boolean = scopeSet.contains
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a Scope filter from filters for the individual axes.
|
||||
* If a project filter is not supplied, the enclosing project is selected.
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ private[sbt] final class CommandExchange {
|
|||
val tokenfile = serverDir / h / "token.json"
|
||||
val socketfile = serverDir / h / "sock"
|
||||
val pipeName = "sbt-server-" + h
|
||||
val bspConnectionFile = s.baseDir / ".bsp" / "sbt.json"
|
||||
val connection = ServerConnection(
|
||||
connectionType,
|
||||
host,
|
||||
|
|
@ -156,6 +157,8 @@ private[sbt] final class CommandExchange {
|
|||
tokenfile,
|
||||
socketfile,
|
||||
pipeName,
|
||||
bspConnectionFile,
|
||||
s.configuration
|
||||
)
|
||||
val serverInstance = Server.start(connection, onIncomingSocket, s.log)
|
||||
// don't throw exception when it times out
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.server
|
||||
|
||||
import sbt._
|
||||
import sbt.internal.bsp._
|
||||
import sbt.librarymanagement.Configuration
|
||||
import sjsonnew.support.scalajson.unsafe.Converter
|
||||
import xsbti.compile.CompileResult
|
||||
import xsbti.{ CompileFailed, Problem, Severity }
|
||||
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
object BspCompileTask {
|
||||
import sbt.internal.bsp.codec.JsonProtocol._
|
||||
|
||||
private lazy val exchange = StandardMain.exchange
|
||||
|
||||
def compute(targetId: BuildTargetIdentifier, project: ProjectRef, config: Configuration)(
|
||||
compile: => CompileResult
|
||||
): CompileResult = {
|
||||
val task = BspCompileTask(targetId, project, config)
|
||||
try {
|
||||
notifyStart(task)
|
||||
val result = compile
|
||||
notifySuccess(task, result)
|
||||
result
|
||||
} catch {
|
||||
case NonFatal(cause) =>
|
||||
val compileFailed = cause match {
|
||||
case failed: CompileFailed => Some(failed)
|
||||
case _ => None
|
||||
}
|
||||
notifyFailure(task, compileFailed)
|
||||
throw cause
|
||||
}
|
||||
}
|
||||
|
||||
private def apply(
|
||||
targetId: BuildTargetIdentifier,
|
||||
project: ProjectRef,
|
||||
config: Configuration
|
||||
): BspCompileTask = {
|
||||
val taskId = TaskId(BuildServerTasks.uniqueId, Vector())
|
||||
val targetName = BuildTargetName.fromScope(project.project, config.name)
|
||||
BspCompileTask(targetId, targetName, taskId, System.currentTimeMillis())
|
||||
}
|
||||
|
||||
private def notifyStart(task: BspCompileTask): Unit = {
|
||||
val message = s"Compiling ${task.targetName}"
|
||||
val data = Converter.toJsonUnsafe(CompileTask(task.targetId))
|
||||
val params = TaskStartParams(task.id, task.startTimeMillis, message, "compile-task", data)
|
||||
exchange.notifyEvent("build/taskStart", params)
|
||||
}
|
||||
|
||||
private def notifySuccess(task: BspCompileTask, result: CompileResult): Unit = {
|
||||
import collection.JavaConverters._
|
||||
val endTimeMillis = System.currentTimeMillis()
|
||||
val elapsedTimeMillis = endTimeMillis - task.startTimeMillis
|
||||
val problems = result match {
|
||||
case compileResult: CompileResult =>
|
||||
val sourceInfos = compileResult.analysis().readSourceInfos().getAllSourceInfos.asScala
|
||||
sourceInfos.values.flatMap(_.getReportedProblems).toSeq
|
||||
case _ => Seq()
|
||||
}
|
||||
val report = compileReport(problems, task.targetId, elapsedTimeMillis)
|
||||
val params = TaskFinishParams(
|
||||
task.id,
|
||||
endTimeMillis,
|
||||
s"Compiled ${task.targetName}",
|
||||
StatusCode.Success,
|
||||
"compile-report",
|
||||
Converter.toJsonUnsafe(report)
|
||||
)
|
||||
exchange.notifyEvent("build/taskFinish", params)
|
||||
}
|
||||
|
||||
private def notifyFailure(task: BspCompileTask, cause: Option[CompileFailed]): Unit = {
|
||||
val endTimeMillis = System.currentTimeMillis()
|
||||
val elapsedTimeMillis = endTimeMillis - task.startTimeMillis
|
||||
val problems = cause.map(_.problems().toSeq).getOrElse(Seq.empty[Problem])
|
||||
val report = compileReport(problems, task.targetId, elapsedTimeMillis)
|
||||
val params = TaskFinishParams(
|
||||
task.id,
|
||||
endTimeMillis,
|
||||
s"Compiled ${task.targetName}",
|
||||
StatusCode.Error,
|
||||
"compile-report",
|
||||
Converter.toJsonUnsafe(report)
|
||||
)
|
||||
exchange.notifyEvent("build/taskFinish", params)
|
||||
}
|
||||
|
||||
private def compileReport(
|
||||
problems: Seq[Problem],
|
||||
targetId: BuildTargetIdentifier,
|
||||
elapsedTimeMillis: Long
|
||||
): CompileReport = {
|
||||
val countBySeverity = problems.groupBy(_.severity()).mapValues(_.size)
|
||||
val warnings = countBySeverity.getOrElse(Severity.Warn, 0)
|
||||
val errors = countBySeverity.getOrElse(Severity.Error, 0)
|
||||
CompileReport(targetId, None, errors, warnings, Some(elapsedTimeMillis.toInt))
|
||||
}
|
||||
}
|
||||
|
||||
case class BspCompileTask private (
|
||||
targetId: BuildTargetIdentifier,
|
||||
targetName: String,
|
||||
id: TaskId,
|
||||
startTimeMillis: Long
|
||||
)
|
||||
|
|
@ -0,0 +1,310 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt
|
||||
package internal
|
||||
package server
|
||||
|
||||
import java.net.URI
|
||||
|
||||
import sbt.BuildSyntax._
|
||||
import sbt.Def._
|
||||
import sbt.Keys._
|
||||
import sbt.ScopeFilter.Make._
|
||||
import sbt.SlashSyntax0._
|
||||
import sbt.internal.bsp._
|
||||
import sbt.internal.langserver.ErrorCodes
|
||||
import sbt.internal.protocol.JsonRpcRequestMessage
|
||||
import sbt.librarymanagement.Configuration
|
||||
import sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
import sjsonnew.support.scalajson.unsafe.Converter
|
||||
|
||||
object BuildServerProtocol {
|
||||
import sbt.internal.bsp.codec.JsonProtocol._
|
||||
private val bspTargetConfigs = Set("compile", "test")
|
||||
private val capabilities = BuildServerCapabilities(
|
||||
CompileProvider(BuildServerConnection.languages),
|
||||
dependencySourcesProvider = true
|
||||
)
|
||||
|
||||
lazy val globalSettings: Seq[Def.Setting[_]] = Seq(
|
||||
bspWorkspace := Def.settingDyn {
|
||||
val loadedBuild = Keys.loadedBuild.value
|
||||
val scopes: Seq[Scope] = loadedBuild.allProjectRefs.flatMap {
|
||||
case (ref, _) =>
|
||||
bspTargetConfigs.toSeq.map(name => Scope.Global.in(ref, ConfigKey(name)))
|
||||
}
|
||||
Def.setting {
|
||||
val targetIds = scopes
|
||||
.map(_ / Keys.bspTargetIdentifier)
|
||||
.map(_ ?) // bspTargetIdentifier might no be defined if the JvmPlugin is disabled
|
||||
.join
|
||||
.value
|
||||
.flatten
|
||||
targetIds.zip(scopes).toMap
|
||||
}
|
||||
}.value,
|
||||
bspWorkspaceBuildTargets := Def.taskDyn {
|
||||
val workspace = Keys.bspWorkspace.value
|
||||
val state = Keys.state.value
|
||||
val allTargets = ScopeFilter.in(workspace.values.toSeq)
|
||||
Def.task {
|
||||
val buildTargets = Keys.bspBuildTarget.all(allTargets).value.toVector
|
||||
state.respondEvent(WorkspaceBuildTargetsResult(buildTargets))
|
||||
buildTargets
|
||||
}
|
||||
}.value,
|
||||
// https://github.com/build-server-protocol/build-server-protocol/blob/master/docs/specification.md#build-target-sources-request
|
||||
bspBuildTargetSources := Def.inputTaskDyn {
|
||||
val s = state.value
|
||||
val workspace = bspWorkspace.value
|
||||
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
|
||||
val filter = ScopeFilter.in(targets.map(workspace))
|
||||
// run the worker task concurrently
|
||||
Def.task {
|
||||
import sbt.internal.bsp.codec.JsonProtocol._
|
||||
val items = bspBuildTargetSourcesItem.all(filter).value
|
||||
val result = SourcesResult(items.toVector)
|
||||
s.respondEvent(result)
|
||||
}
|
||||
}.evaluated,
|
||||
bspBuildTargetSources / aggregate := false,
|
||||
bspBuildTargetDependencySources := Def.inputTaskDyn {
|
||||
val s = state.value
|
||||
val workspace = bspWorkspace.value
|
||||
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
|
||||
val filter = ScopeFilter.in(targets.map(workspace))
|
||||
// run the worker task concurrently
|
||||
Def.task {
|
||||
import sbt.internal.bsp.codec.JsonProtocol._
|
||||
val items = bspBuildTargetDependencySourcesItem.all(filter).value
|
||||
val result = DependencySourcesResult(items.toVector)
|
||||
s.respondEvent(result)
|
||||
}
|
||||
}.evaluated,
|
||||
bspBuildTargetDependencySources / aggregate := false,
|
||||
bspBuildTargetCompile := Def.inputTaskDyn {
|
||||
val s: State = state.value
|
||||
val workspace = bspWorkspace.value
|
||||
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
|
||||
val filter = ScopeFilter.in(targets.map(workspace))
|
||||
Def.task {
|
||||
import sbt.internal.bsp.codec.JsonProtocol._
|
||||
val statusCode = Keys.bspBuildTargetCompileItem.all(filter).value.max
|
||||
s.respondEvent(BspCompileResult(None, statusCode))
|
||||
}
|
||||
}.evaluated,
|
||||
bspBuildTargetCompile / aggregate := false,
|
||||
bspBuildTargetScalacOptions := Def.inputTaskDyn {
|
||||
val s = state.value
|
||||
val workspace = bspWorkspace.value
|
||||
val targets = spaceDelimited().parsed.map(uri => BuildTargetIdentifier(URI.create(uri)))
|
||||
val filter = ScopeFilter.in(targets.map(workspace))
|
||||
Def.task {
|
||||
val items = bspBuildTargetScalacOptionsItem.all(filter).value
|
||||
val result = ScalacOptionsResult(items.toVector)
|
||||
s.respondEvent(result)
|
||||
}
|
||||
}.evaluated,
|
||||
bspBuildTargetScalacOptions / aggregate := false
|
||||
)
|
||||
|
||||
// This will be scoped to Compile, Test, etc
|
||||
lazy val configSettings: Seq[Def.Setting[_]] = Seq(
|
||||
bspTargetIdentifier := {
|
||||
val ref = thisProjectRef.value
|
||||
val c = configuration.value
|
||||
toId(ref, c)
|
||||
},
|
||||
bspBuildTarget := buildTargetTask.value,
|
||||
bspBuildTargetSourcesItem := {
|
||||
val id = bspTargetIdentifier.value
|
||||
val dirs = unmanagedSourceDirectories.value
|
||||
val managed = managedSources.value
|
||||
val items = (dirs.toVector map { dir =>
|
||||
SourceItem(dir.toURI, SourceItemKind.Directory, generated = false)
|
||||
}) ++
|
||||
(managed.toVector map { x =>
|
||||
SourceItem(x.toURI, SourceItemKind.File, generated = true)
|
||||
})
|
||||
SourcesItem(id, items)
|
||||
},
|
||||
bspBuildTargetDependencySourcesItem := dependencySourcesItemTask.value,
|
||||
bspBuildTargetCompileItem := bspCompileTask.value,
|
||||
bspBuildTargetScalacOptionsItem := scalacOptionsTask.value,
|
||||
bspInternalDependencyConfigurations := internalDependencyConfigurationsSetting.value
|
||||
)
|
||||
|
||||
def handler(sbtVersion: String): ServerHandler = ServerHandler { callback =>
|
||||
ServerIntent(
|
||||
{
|
||||
case r: JsonRpcRequestMessage if r.method == "build/initialize" =>
|
||||
val _ = Converter.fromJson[InitializeBuildParams](json(r)).get
|
||||
val response = InitializeBuildResult(
|
||||
"sbt",
|
||||
sbtVersion,
|
||||
BuildServerConnection.bspVersion,
|
||||
capabilities,
|
||||
None
|
||||
)
|
||||
callback.jsonRpcRespond(response, Some(r.id)); ()
|
||||
|
||||
case r: JsonRpcRequestMessage if r.method == "workspace/buildTargets" =>
|
||||
val _ = callback.appendExec(Keys.bspWorkspaceBuildTargets.key.toString, Some(r.id))
|
||||
|
||||
case r: JsonRpcRequestMessage if r.method == "build/shutdown" =>
|
||||
()
|
||||
|
||||
case r: JsonRpcRequestMessage if r.method == "build/exit" =>
|
||||
val _ = callback.appendExec("shutdown", Some(r.id))
|
||||
|
||||
case r: JsonRpcRequestMessage if r.method == "buildTarget/sources" =>
|
||||
val param = Converter.fromJson[SourcesParams](json(r)).get
|
||||
val targets = param.targets.map(_.uri).mkString(" ")
|
||||
val command = Keys.bspBuildTargetSources.key
|
||||
val _ = callback.appendExec(s"$command $targets", Some(r.id))
|
||||
|
||||
case r if r.method == "buildTarget/dependencySources" =>
|
||||
val param = Converter.fromJson[DependencySourcesParams](json(r)).get
|
||||
val targets = param.targets.map(_.uri).mkString(" ")
|
||||
val command = Keys.bspBuildTargetDependencySources.key
|
||||
val _ = callback.appendExec(s"$command $targets", Some(r.id))
|
||||
|
||||
case r if r.method == "buildTarget/compile" =>
|
||||
val param = Converter.fromJson[CompileParams](json(r)).get
|
||||
callback.log.info(param.toString)
|
||||
val targets = param.targets.map(_.uri).mkString(" ")
|
||||
val command = Keys.bspBuildTargetCompile.key
|
||||
val _ = callback.appendExec(s"$command $targets", Some(r.id))
|
||||
|
||||
case r: JsonRpcRequestMessage if r.method == "buildTarget/scalacOptions" =>
|
||||
val param = Converter.fromJson[ScalacOptionsParams](json(r)).get
|
||||
val targets = param.targets.map(_.uri).mkString(" ")
|
||||
val command = Keys.bspBuildTargetScalacOptions.key
|
||||
val _ = callback.appendExec(s"$command $targets", Some(r.id))
|
||||
},
|
||||
PartialFunction.empty
|
||||
)
|
||||
}
|
||||
|
||||
private def json(r: JsonRpcRequestMessage): JValue =
|
||||
r.params.getOrElse(
|
||||
throw LangServerError(
|
||||
ErrorCodes.InvalidParams,
|
||||
s"param is expected on '${r.method}' method."
|
||||
)
|
||||
)
|
||||
|
||||
private def buildTargetTask: Def.Initialize[Task[BuildTarget]] = Def.taskDyn {
|
||||
val buildTargetIdentifier = Keys.bspTargetIdentifier.value
|
||||
val thisProject = Keys.thisProject.value
|
||||
val thisProjectRef = Keys.thisProjectRef.value
|
||||
val thisConfig = Keys.configuration.value
|
||||
val scalaJars = Keys.scalaInstance.value.allJars.map(_.toURI.toString)
|
||||
val compileData = ScalaBuildTarget(
|
||||
scalaOrganization = scalaOrganization.value,
|
||||
scalaVersion = scalaVersion.value,
|
||||
scalaBinaryVersion = scalaBinaryVersion.value,
|
||||
platform = ScalaPlatform.JVM,
|
||||
jars = scalaJars.toVector
|
||||
)
|
||||
val configuration = Keys.configuration.value
|
||||
val displayName = BuildTargetName.fromScope(thisProject.id, configuration.name)
|
||||
val baseDirectory = Keys.baseDirectory.value.toURI
|
||||
val projectDependencies = for {
|
||||
(dep, configs) <- Keys.bspInternalDependencyConfigurations.value
|
||||
config <- configs
|
||||
if (dep != thisProjectRef || config != thisConfig.name) && bspTargetConfigs.contains(config)
|
||||
} yield Keys.bspTargetIdentifier.in(dep, ConfigKey(config))
|
||||
val capabilities = BuildTargetCapabilities(canCompile = true, canTest = false, canRun = false)
|
||||
val tags = BuildTargetTag.fromConfig(configuration.name)
|
||||
Def.task {
|
||||
BuildTarget(
|
||||
buildTargetIdentifier,
|
||||
Some(displayName),
|
||||
Some(baseDirectory),
|
||||
tags,
|
||||
capabilities,
|
||||
BuildServerConnection.languages,
|
||||
projectDependencies.join.value.toVector,
|
||||
dataKind = Some("scala"),
|
||||
data = Some(Converter.toJsonUnsafe(compileData)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private def scalacOptionsTask: Def.Initialize[Task[ScalacOptionsItem]] = Def.taskDyn {
|
||||
val target = Keys.bspTargetIdentifier.value
|
||||
val scalacOptions = Keys.scalacOptions.value
|
||||
val classDirectory = Keys.classDirectory.value
|
||||
val externalDependencyClasspath = Keys.externalDependencyClasspath.value
|
||||
|
||||
val internalDependencyClasspath = for {
|
||||
(ref, configs) <- bspInternalDependencyConfigurations.value
|
||||
config <- configs
|
||||
} yield Keys.classDirectory.in(ref, ConfigKey(config))
|
||||
|
||||
Def.task {
|
||||
val classpath = internalDependencyClasspath.join.value.distinct ++
|
||||
externalDependencyClasspath.map(_.data)
|
||||
ScalacOptionsItem(
|
||||
target,
|
||||
scalacOptions.toVector,
|
||||
classpath.map(_.toURI).toVector,
|
||||
classDirectory.toURI
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private def dependencySourcesItemTask: Def.Initialize[Task[DependencySourcesItem]] = Def.task {
|
||||
val targetId = Keys.bspTargetIdentifier.value
|
||||
val updateReport = Keys.updateClassifiers.value
|
||||
val sources = for {
|
||||
configuration <- updateReport.configurations.view
|
||||
module <- configuration.modules.view
|
||||
(artifact, file) <- module.artifacts
|
||||
classifier <- artifact.classifier if classifier == "sources"
|
||||
} yield file.toURI
|
||||
DependencySourcesItem(targetId, sources.distinct.toVector)
|
||||
}
|
||||
|
||||
private def bspCompileTask: Def.Initialize[Task[Int]] = Def.task {
|
||||
import sbt.Project._
|
||||
Keys.compile.result.value match {
|
||||
case Value(_) => StatusCode.Success
|
||||
case Inc(_) =>
|
||||
// Cancellation is not yet implemented
|
||||
StatusCode.Error
|
||||
}
|
||||
}
|
||||
|
||||
private def internalDependencyConfigurationsSetting = Def.settingDyn {
|
||||
val directDependencies = Keys.internalDependencyConfigurations.value
|
||||
val ref = Keys.thisProjectRef.value
|
||||
val thisConfig = Keys.configuration.value
|
||||
val transitiveDependencies = for {
|
||||
(dep, configs) <- directDependencies
|
||||
config <- configs if dep != ref || config != thisConfig.name
|
||||
} yield Keys.bspInternalDependencyConfigurations.in(dep, ConfigKey(config))
|
||||
Def.setting {
|
||||
val allDependencies = directDependencies ++ transitiveDependencies.join.value.flatten
|
||||
allDependencies
|
||||
.groupBy(_._1)
|
||||
.mapValues { deps =>
|
||||
deps.flatMap { case (_, configs) => configs }.toSet
|
||||
}
|
||||
.toSeq
|
||||
}
|
||||
}
|
||||
|
||||
private def toId(ref: ProjectReference, config: Configuration): BuildTargetIdentifier =
|
||||
ref match {
|
||||
case ProjectRef(build, project) =>
|
||||
BuildTargetIdentifier(new URI(s"$build#$project/${config.id}"))
|
||||
case _ => sys.error(s"unexpected $ref")
|
||||
}
|
||||
}
|
||||
|
|
@ -5,25 +5,16 @@
|
|||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt
|
||||
package internal
|
||||
package server
|
||||
package sbt.internal.server
|
||||
|
||||
import java.io.File
|
||||
import sbt.StandardMain
|
||||
import sbt.internal.bsp._
|
||||
import sbt.internal.inc.ManagedLoggedReporter
|
||||
import sbt.internal.util.ManagedLogger
|
||||
import xsbti.{ FileConverter, Problem, Position => XPosition, Severity }
|
||||
import xsbti.compile.CompileAnalysis
|
||||
import sbt.internal.langserver.{
|
||||
PublishDiagnosticsParams,
|
||||
Position,
|
||||
Diagnostic,
|
||||
Range,
|
||||
DiagnosticSeverity
|
||||
}
|
||||
import sbt.internal.inc.JavaInterfaceUtil._
|
||||
import xsbti.{ BasicVirtualFileRef, FileConverter, Problem, Severity, Position => XPosition }
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
/**
|
||||
* Defines a compiler reporter that uses event logging provided by a `ManagedLogger`.
|
||||
|
|
@ -32,15 +23,21 @@ import scala.collection.JavaConverters._
|
|||
* @param logger The event managed logger.
|
||||
* @param sourcePositionMapper The position mapper.
|
||||
*/
|
||||
class LanguageServerReporter(
|
||||
class BuildServerReporter(
|
||||
buildTarget: BuildTargetIdentifier,
|
||||
maximumErrors: Int,
|
||||
logger: ManagedLogger,
|
||||
sourcePositionMapper: XPosition => XPosition = identity[XPosition],
|
||||
converter: FileConverter
|
||||
) extends ManagedLoggedReporter(maximumErrors, logger, sourcePositionMapper) {
|
||||
import sbt.internal.bsp.codec.JsonProtocol._
|
||||
import sbt.internal.inc.JavaInterfaceUtil._
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
lazy val exchange = StandardMain.exchange
|
||||
|
||||
private[sbt] lazy val problemsByFile = new mutable.HashMap[File, mutable.ListBuffer[Problem]]
|
||||
private[sbt] lazy val problemsByFile = new mutable.HashMap[String, mutable.ListBuffer[Problem]]
|
||||
|
||||
override def reset(): Unit = {
|
||||
super.reset()
|
||||
|
|
@ -49,10 +46,10 @@ class LanguageServerReporter(
|
|||
|
||||
override def log(problem: Problem): Unit = {
|
||||
val pos = problem.position
|
||||
pos.sourceFile.toOption foreach { sourceFile: File =>
|
||||
problemsByFile.get(sourceFile) match {
|
||||
case Some(xs: mutable.ListBuffer[Problem]) => problemsByFile(sourceFile) = xs :+ problem
|
||||
case _ => problemsByFile(sourceFile) = mutable.ListBuffer(problem)
|
||||
pos.sourcePath().toOption foreach { sourcePath =>
|
||||
problemsByFile.get(sourcePath) match {
|
||||
case Some(xs: mutable.ListBuffer[Problem]) => problemsByFile(sourcePath) = xs :+ problem
|
||||
case _ => problemsByFile(sourcePath) = mutable.ListBuffer(problem)
|
||||
}
|
||||
}
|
||||
super.log(problem)
|
||||
|
|
@ -80,24 +77,34 @@ class LanguageServerReporter(
|
|||
}
|
||||
|
||||
private[sbt] def resetPrevious(analysis: CompileAnalysis): Unit = {
|
||||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
val files = analysis.readSourceInfos.getAllSourceInfos.keySet.asScala
|
||||
files foreach { f =>
|
||||
val p = converter.toPath(f)
|
||||
val params = PublishDiagnosticsParams(p.toUri.toString, Vector())
|
||||
exchange.notifyEvent("textDocument/publishDiagnostics", params)
|
||||
files foreach { file =>
|
||||
val params = PublishDiagnosticsParams(
|
||||
TextDocumentIdentifier(converter.toPath(file).toUri),
|
||||
buildTarget,
|
||||
None,
|
||||
diagnostics = Vector(),
|
||||
reset = true
|
||||
)
|
||||
exchange.notifyEvent("build/publishDiagnostics", params)
|
||||
}
|
||||
}
|
||||
|
||||
private[sbt] def aggregateProblems(problem: Problem): Unit = {
|
||||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
val pos = problem.position
|
||||
pos.sourceFile.toOption foreach { sourceFile: File =>
|
||||
problemsByFile.get(sourceFile) match {
|
||||
pos.sourcePath().toOption foreach { sourcePath: String =>
|
||||
problemsByFile.get(sourcePath) match {
|
||||
case Some(xs: mutable.ListBuffer[Problem]) =>
|
||||
val ds = toDiagnostics(xs)
|
||||
val params = PublishDiagnosticsParams(sbt.io.IO.toURI(sourceFile).toString, ds)
|
||||
exchange.notifyEvent("textDocument/publishDiagnostics", params)
|
||||
val diagnostics = toDiagnostics(xs)
|
||||
val absolutePath = converter.toPath(new BasicVirtualFileRef(sourcePath) {})
|
||||
val params = PublishDiagnosticsParams(
|
||||
TextDocumentIdentifier(absolutePath.toUri),
|
||||
buildTarget,
|
||||
originId = None,
|
||||
diagnostics,
|
||||
reset = true
|
||||
)
|
||||
exchange.notifyEvent("build/publishDiagnostics", params)
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
|
|
@ -112,7 +119,7 @@ class LanguageServerReporter(
|
|||
} yield {
|
||||
val line = line0.toLong - 1L
|
||||
val pointer = pointer0.toLong
|
||||
val r = (
|
||||
val range = (
|
||||
pos.startLine.toOption,
|
||||
pos.startColumn.toOption,
|
||||
pos.endLine.toOption,
|
||||
|
|
@ -124,7 +131,7 @@ class LanguageServerReporter(
|
|||
Range(Position(line, pointer), Position(line, pointer + 1))
|
||||
}
|
||||
Diagnostic(
|
||||
r,
|
||||
range,
|
||||
Option(toDiagnosticSeverity(problem.severity)),
|
||||
None,
|
||||
Option("sbt"),
|
||||
|
|
@ -9,24 +9,30 @@ package sbt
|
|||
package internal
|
||||
package server
|
||||
|
||||
import sjsonnew.JsonFormat
|
||||
import sjsonnew.support.scalajson.unsafe.Converter
|
||||
import sbt.protocol.Serialization
|
||||
import sbt.protocol.{ CompletionParams => CP, SettingQuery => Q }
|
||||
import sbt.internal.langserver.{ CancelRequestParams => CRP }
|
||||
import sbt.internal.langserver._
|
||||
import sbt.internal.protocol._
|
||||
import sbt.internal.protocol.codec._
|
||||
import sbt.internal.langserver._
|
||||
import sbt.internal.util.ObjectEvent
|
||||
import sbt.util.Logger
|
||||
import scala.concurrent.ExecutionContext
|
||||
import sbt.protocol.{ CompletionParams => CP, SettingQuery => Q }
|
||||
import sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
import sjsonnew.support.scalajson.unsafe.Converter
|
||||
import xsbti.FileConverter
|
||||
|
||||
private[sbt] final case class LangServerError(code: Long, message: String)
|
||||
extends Throwable(message)
|
||||
|
||||
private[sbt] object LanguageServerProtocol {
|
||||
lazy val internalJsonProtocol = new InitializeOptionFormats with sjsonnew.BasicJsonProtocol {}
|
||||
private val internalJsonProtocol = new sbt.internal.langserver.codec.JsonProtocol
|
||||
with sbt.protocol.codec.JsonProtocol with sjsonnew.BasicJsonProtocol with InitializeOptionFormats
|
||||
|
||||
import internalJsonProtocol._
|
||||
|
||||
def json(r: JsonRpcRequestMessage): JValue =
|
||||
r.params.getOrElse(
|
||||
throw LangServerError(
|
||||
ErrorCodes.InvalidParams,
|
||||
s"param is expected on '${r.method}' method."
|
||||
)
|
||||
)
|
||||
|
||||
lazy val serverCapabilities: ServerCapabilities = {
|
||||
ServerCapabilities(
|
||||
|
|
@ -36,162 +42,54 @@ private[sbt] object LanguageServerProtocol {
|
|||
)
|
||||
}
|
||||
|
||||
def handler(converter: FileConverter): ServerHandler =
|
||||
ServerHandler({
|
||||
case callback: ServerCallback =>
|
||||
import callback._
|
||||
ServerIntent(
|
||||
{
|
||||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
import internalJsonProtocol._
|
||||
def json(r: JsonRpcRequestMessage) =
|
||||
r.params.getOrElse(
|
||||
throw LangServerError(
|
||||
ErrorCodes.InvalidParams,
|
||||
s"param is expected on '${r.method}' method."
|
||||
)
|
||||
def handler(converter: FileConverter): ServerHandler = ServerHandler { callback =>
|
||||
import callback._
|
||||
ServerIntent(
|
||||
{
|
||||
case r: JsonRpcRequestMessage if r.method == "initialize" =>
|
||||
if (authOptions(ServerAuthentication.Token)) {
|
||||
val param = Converter.fromJson[InitializeParams](json(r)).get
|
||||
val optionJson = param.initializationOptions.getOrElse(
|
||||
throw LangServerError(
|
||||
ErrorCodes.InvalidParams,
|
||||
"initializationOptions is expected on 'initialize' param."
|
||||
)
|
||||
)
|
||||
val opt = Converter.fromJson[InitializeOption](optionJson).get
|
||||
val token = opt.token.getOrElse(sys.error("'token' is missing."))
|
||||
if (authenticate(token)) ()
|
||||
else throw LangServerError(ErrorCodes.InvalidRequest, "invalid token")
|
||||
} else ()
|
||||
setInitialized(true)
|
||||
appendExec("collectAnalyses", None)
|
||||
jsonRpcRespond(InitializeResult(serverCapabilities), Some(r.id))
|
||||
|
||||
{
|
||||
case r: JsonRpcRequestMessage if r.method == "initialize" =>
|
||||
if (authOptions(ServerAuthentication.Token)) {
|
||||
val param = Converter.fromJson[InitializeParams](json(r)).get
|
||||
val optionJson = param.initializationOptions.getOrElse(
|
||||
throw LangServerError(
|
||||
ErrorCodes.InvalidParams,
|
||||
"initializationOptions is expected on 'initialize' param."
|
||||
)
|
||||
)
|
||||
val opt = Converter.fromJson[InitializeOption](optionJson).get
|
||||
val token = opt.token.getOrElse(sys.error("'token' is missing."))
|
||||
if (authenticate(token)) ()
|
||||
else throw LangServerError(ErrorCodes.InvalidRequest, "invalid token")
|
||||
} else ()
|
||||
setInitialized(true)
|
||||
appendExec(Exec(s"collectAnalyses", None, Some(CommandSource(name))))
|
||||
jsonRpcRespond(InitializeResult(serverCapabilities), Option(r.id))
|
||||
case r: JsonRpcRequestMessage if r.method == "textDocument/definition" =>
|
||||
val _ = Definition.lspDefinition(json(r), r.id, CommandSource(name), converter, log)(
|
||||
StandardMain.executionContext
|
||||
)
|
||||
|
||||
case r: JsonRpcRequestMessage if r.method == "textDocument/definition" =>
|
||||
implicit val executionContext: ExecutionContext = StandardMain.executionContext
|
||||
Definition.lspDefinition(json(r), r.id, CommandSource(name), converter, log)
|
||||
()
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/exec" =>
|
||||
val param = Converter.fromJson[SbtExecParams](json(r)).get
|
||||
appendExec(Exec(param.commandLine, Some(r.id), Some(CommandSource(name))))
|
||||
()
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/setting" =>
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val param = Converter.fromJson[Q](json(r)).get
|
||||
onSettingQuery(Option(r.id), param)
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/cancelRequest" =>
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val param = Converter.fromJson[CRP](json(r)).get
|
||||
onCancellationRequest(Option(r.id), param)
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/completion" =>
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val param = Converter.fromJson[CP](json(r)).get
|
||||
onCompletionRequest(Option(r.id), param)
|
||||
}
|
||||
}, {
|
||||
case n: JsonRpcNotificationMessage if n.method == "textDocument/didSave" =>
|
||||
appendExec(Exec(";Test/compile; collectAnalyses", None, Some(CommandSource(name))))
|
||||
()
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/exec" =>
|
||||
val param = Converter.fromJson[SbtExecParams](json(r)).get
|
||||
val _ = appendExec(param.commandLine, Some(r.id))
|
||||
|
||||
/** Implements Language Server Protocol <https://github.com/Microsoft/language-server-protocol>. */
|
||||
private[sbt] trait LanguageServerProtocol { self: NetworkChannel =>
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/setting" =>
|
||||
val param = Converter.fromJson[Q](json(r)).get
|
||||
onSettingQuery(Option(r.id), param)
|
||||
|
||||
lazy val internalJsonProtocol = new InitializeOptionFormats with sjsonnew.BasicJsonProtocol {}
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/cancelRequest" =>
|
||||
val param = Converter.fromJson[CancelRequestParams](json(r)).get
|
||||
onCancellationRequest(Option(r.id), param)
|
||||
|
||||
protected def authenticate(token: String): Boolean
|
||||
protected def authOptions: Set[ServerAuthentication]
|
||||
protected def setInitialized(value: Boolean): Unit
|
||||
protected def log: Logger
|
||||
protected def onSettingQuery(execId: Option[String], req: Q): Unit
|
||||
protected def onCompletionRequest(execId: Option[String], cp: CP): Unit
|
||||
protected def onCancellationRequest(execId: Option[String], crp: CRP): Unit
|
||||
case r: JsonRpcRequestMessage if r.method == "sbt/completion" =>
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val param = Converter.fromJson[CP](json(r)).get
|
||||
onCompletionRequest(Option(r.id), param)
|
||||
|
||||
protected lazy val callbackImpl: ServerCallback = new ServerCallback {
|
||||
def jsonRpcRespond[A: JsonFormat](event: A, execId: Option[String]): Unit =
|
||||
self.respondResult(event, execId)
|
||||
|
||||
def jsonRpcRespondError(execId: Option[String], code: Long, message: String): Unit =
|
||||
self.respondError(code, message, execId)
|
||||
|
||||
def jsonRpcNotify[A: JsonFormat](method: String, params: A): Unit =
|
||||
self.jsonRpcNotify(method, params)
|
||||
|
||||
def appendExec(exec: Exec): Boolean = self.append(exec)
|
||||
def log: Logger = self.log
|
||||
def name: String = self.name
|
||||
private[sbt] def authOptions: Set[ServerAuthentication] = self.authOptions
|
||||
private[sbt] def authenticate(token: String): Boolean = self.authenticate(token)
|
||||
private[sbt] def setInitialized(value: Boolean): Unit = self.setInitialized(value)
|
||||
private[sbt] def onSettingQuery(execId: Option[String], req: Q): Unit =
|
||||
self.onSettingQuery(execId, req)
|
||||
private[sbt] def onCompletionRequest(execId: Option[String], cp: CP): Unit =
|
||||
self.onCompletionRequest(execId, cp)
|
||||
private[sbt] def onCancellationRequest(execId: Option[String], crp: CancelRequestParams): Unit =
|
||||
self.onCancellationRequest(execId, crp)
|
||||
}
|
||||
|
||||
/**
|
||||
* This reacts to various events that happens inside sbt, sometime
|
||||
* in response to the previous requests.
|
||||
* The type information has been erased because it went through logging.
|
||||
*/
|
||||
protected def onObjectEvent(event: ObjectEvent[_]): Unit = {
|
||||
// import sbt.internal.langserver.codec.JsonProtocol._
|
||||
|
||||
val msgContentType = event.contentType
|
||||
msgContentType match {
|
||||
// LanguageServerReporter sends PublishDiagnosticsParams
|
||||
case "sbt.internal.langserver.PublishDiagnosticsParams" =>
|
||||
// val p = event.message.asInstanceOf[PublishDiagnosticsParams]
|
||||
// jsonRpcNotify("textDocument/publishDiagnostics", p)
|
||||
case "xsbti.Problem" =>
|
||||
() // ignore
|
||||
case _ =>
|
||||
// log.debug(event)
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
/** Respond back to Language Server's client. */
|
||||
private[sbt] def jsonRpcRespond[A: JsonFormat](event: A, execId: String): Unit = {
|
||||
val response =
|
||||
JsonRpcResponseMessage("2.0", execId, Option(Converter.toJson[A](event).get), None)
|
||||
val bytes = Serialization.serializeResponseMessage(response)
|
||||
publishBytes(bytes)
|
||||
}
|
||||
|
||||
/** Respond back to Language Server's client. */
|
||||
private[sbt] def jsonRpcRespondError(
|
||||
execId: String,
|
||||
err: JsonRpcResponseError
|
||||
): Unit = {
|
||||
val m = JsonRpcResponseMessage("2.0", execId, None, Option(err))
|
||||
val bytes = Serialization.serializeResponseMessage(m)
|
||||
publishBytes(bytes)
|
||||
}
|
||||
|
||||
/** Notify to Language Server's client. */
|
||||
private[sbt] def jsonRpcNotify[A: JsonFormat](method: String, params: A): Unit = {
|
||||
val m =
|
||||
JsonRpcNotificationMessage("2.0", method, Option(Converter.toJson[A](params).get))
|
||||
log.debug(s"jsonRpcNotify: $m")
|
||||
val bytes = Serialization.serializeNotificationMessage(m)
|
||||
publishBytes(bytes)
|
||||
}
|
||||
|
||||
def logMessage(level: String, message: String): Unit = {
|
||||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
jsonRpcNotify(
|
||||
"window/logMessage",
|
||||
LogMessageParams(MessageType.fromLevelString(level), message)
|
||||
}, {
|
||||
case n: JsonRpcNotificationMessage if n.method == "textDocument/didSave" =>
|
||||
val _ = appendExec(";Test/compile; collectAnalyses", None)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,15 +12,16 @@ package server
|
|||
import java.net.{ Socket, SocketTimeoutException }
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
import sbt.internal.langserver.{ CancelRequestParams, ErrorCodes }
|
||||
import sbt.internal.langserver.{ CancelRequestParams, ErrorCodes, LogMessageParams, MessageType }
|
||||
import sbt.internal.protocol.{
|
||||
JsonRpcNotificationMessage,
|
||||
JsonRpcRequestMessage,
|
||||
JsonRpcResponseError
|
||||
JsonRpcResponseError,
|
||||
JsonRpcResponseMessage
|
||||
}
|
||||
import sbt.internal.util.ObjectEvent
|
||||
import sbt.internal.util.codec.JValueFormats
|
||||
import sbt.internal.util.complete.Parser
|
||||
import sbt.internal.util.ObjectEvent
|
||||
import sbt.protocol._
|
||||
import sbt.util.Logger
|
||||
import sjsonnew._
|
||||
|
|
@ -34,13 +35,12 @@ import scala.util.control.NonFatal
|
|||
final class NetworkChannel(
|
||||
val name: String,
|
||||
connection: Socket,
|
||||
structure: BuildStructure,
|
||||
protected val structure: BuildStructure,
|
||||
auth: Set[ServerAuthentication],
|
||||
instance: ServerInstance,
|
||||
handlers: Seq[ServerHandler],
|
||||
val log: Logger
|
||||
) extends CommandChannel
|
||||
with LanguageServerProtocol {
|
||||
) extends CommandChannel { self =>
|
||||
import NetworkChannel._
|
||||
|
||||
private val running = new AtomicBoolean(true)
|
||||
|
|
@ -58,6 +58,34 @@ final class NetworkChannel(
|
|||
private lazy val jsonFormat = new sjsonnew.BasicJsonProtocol with JValueFormats {}
|
||||
private val pendingRequests: mutable.Map[String, JsonRpcRequestMessage] = mutable.Map()
|
||||
|
||||
private lazy val callback: ServerCallback = new ServerCallback {
|
||||
def jsonRpcRespond[A: JsonFormat](event: A, execId: Option[String]): Unit =
|
||||
self.respondResult(event, execId)
|
||||
|
||||
def jsonRpcRespondError(execId: Option[String], code: Long, message: String): Unit =
|
||||
self.respondError(code, message, execId)
|
||||
|
||||
def jsonRpcNotify[A: JsonFormat](method: String, params: A): Unit =
|
||||
self.jsonRpcNotify(method, params)
|
||||
|
||||
def appendExec(commandLine: String, execId: Option[String]): Boolean =
|
||||
self.append(Exec(commandLine, execId, Some(CommandSource(name))))
|
||||
|
||||
def appendExec(exec: Exec): Boolean = self.append(exec)
|
||||
|
||||
def log: Logger = self.log
|
||||
def name: String = self.name
|
||||
private[sbt] def authOptions: Set[ServerAuthentication] = self.authOptions
|
||||
private[sbt] def authenticate(token: String): Boolean = self.authenticate(token)
|
||||
private[sbt] def setInitialized(value: Boolean): Unit = self.setInitialized(value)
|
||||
private[sbt] def onSettingQuery(execId: Option[String], req: SettingQuery): Unit =
|
||||
self.onSettingQuery(execId, req)
|
||||
private[sbt] def onCompletionRequest(execId: Option[String], cp: CompletionParams): Unit =
|
||||
self.onCompletionRequest(execId, cp)
|
||||
private[sbt] def onCancellationRequest(execId: Option[String], crp: CancelRequestParams): Unit =
|
||||
self.onCancellationRequest(execId, crp)
|
||||
}
|
||||
|
||||
def setContentType(ct: String): Unit = synchronized { _contentType = ct }
|
||||
def contentType: String = _contentType
|
||||
|
||||
|
|
@ -171,11 +199,11 @@ final class NetworkChannel(
|
|||
}
|
||||
|
||||
private lazy val intents = {
|
||||
val cb = callbackImpl
|
||||
handlers.toVector map { h =>
|
||||
h.handler(cb)
|
||||
h.handler(callback)
|
||||
}
|
||||
}
|
||||
|
||||
lazy val onRequestMessage: PartialFunction[JsonRpcRequestMessage, Unit] =
|
||||
intents.foldLeft(PartialFunction.empty[JsonRpcRequestMessage, Unit]) {
|
||||
case (f, i) => f orElse i.onRequest
|
||||
|
|
@ -522,6 +550,73 @@ final class NetworkChannel(
|
|||
running.set(false)
|
||||
out.close()
|
||||
}
|
||||
|
||||
/**
|
||||
* This reacts to various events that happens inside sbt, sometime
|
||||
* in response to the previous requests.
|
||||
* The type information has been erased because it went through logging.
|
||||
*/
|
||||
protected def onObjectEvent(event: ObjectEvent[_]): Unit = {
|
||||
// import sbt.internal.langserver.codec.JsonProtocol._
|
||||
|
||||
val msgContentType = event.contentType
|
||||
msgContentType match {
|
||||
// LanguageServerReporter sends PublishDiagnosticsParams
|
||||
case "sbt.internal.langserver.PublishDiagnosticsParams" =>
|
||||
// val p = event.message.asInstanceOf[PublishDiagnosticsParams]
|
||||
// jsonRpcNotify("textDocument/publishDiagnostics", p)
|
||||
case "xsbti.Problem" =>
|
||||
() // ignore
|
||||
case _ =>
|
||||
// log.debug(event)
|
||||
()
|
||||
}
|
||||
}
|
||||
|
||||
/** Respond back to Language Server's client. */
|
||||
private[sbt] def jsonRpcRespond[A: JsonFormat](event: A, execId: String): Unit = {
|
||||
val m =
|
||||
JsonRpcResponseMessage("2.0", execId, Option(Converter.toJson[A](event).get), None)
|
||||
val bytes = Serialization.serializeResponseMessage(m)
|
||||
publishBytes(bytes)
|
||||
}
|
||||
|
||||
/** Respond back to Language Server's client. */
|
||||
private[sbt] def jsonRpcRespondError[A: JsonFormat](
|
||||
execId: String,
|
||||
code: Long,
|
||||
message: String,
|
||||
data: A,
|
||||
): Unit = {
|
||||
val err = JsonRpcResponseError(code, message, Converter.toJson[A](data).get)
|
||||
jsonRpcRespondError(execId, err)
|
||||
}
|
||||
|
||||
private[sbt] def jsonRpcRespondError(
|
||||
execId: String,
|
||||
err: JsonRpcResponseError
|
||||
): Unit = {
|
||||
val m = JsonRpcResponseMessage("2.0", execId, None, Option(err))
|
||||
val bytes = Serialization.serializeResponseMessage(m)
|
||||
publishBytes(bytes)
|
||||
}
|
||||
|
||||
/** Notify to Language Server's client. */
|
||||
private[sbt] def jsonRpcNotify[A: JsonFormat](method: String, params: A): Unit = {
|
||||
val m =
|
||||
JsonRpcNotificationMessage("2.0", method, Option(Converter.toJson[A](params).get))
|
||||
log.debug(s"jsonRpcNotify: $m")
|
||||
val bytes = Serialization.serializeNotificationMessage(m)
|
||||
publishBytes(bytes)
|
||||
}
|
||||
|
||||
def logMessage(level: String, message: String): Unit = {
|
||||
import sbt.internal.langserver.codec.JsonProtocol._
|
||||
jsonRpcNotify(
|
||||
"build/logMessage",
|
||||
LogMessageParams(MessageType.fromLevelString(level), message)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
object NetworkChannel {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Compile Response
|
||||
* @param originId An optional request id to know the origin of this report.
|
||||
* @param statusCode A status code for the execution.
|
||||
*/
|
||||
final class BspCompileResult private (
|
||||
val originId: Option[String],
|
||||
val statusCode: Int) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BspCompileResult => (this.originId == x.originId) && (this.statusCode == x.statusCode)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.BspCompileResult".##) + originId.##) + statusCode.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BspCompileResult(" + originId + ", " + statusCode + ")"
|
||||
}
|
||||
private[this] def copy(originId: Option[String] = originId, statusCode: Int = statusCode): BspCompileResult = {
|
||||
new BspCompileResult(originId, statusCode)
|
||||
}
|
||||
def withOriginId(originId: Option[String]): BspCompileResult = {
|
||||
copy(originId = originId)
|
||||
}
|
||||
def withOriginId(originId: String): BspCompileResult = {
|
||||
copy(originId = Option(originId))
|
||||
}
|
||||
def withStatusCode(statusCode: Int): BspCompileResult = {
|
||||
copy(statusCode = statusCode)
|
||||
}
|
||||
}
|
||||
object BspCompileResult {
|
||||
|
||||
def apply(originId: Option[String], statusCode: Int): BspCompileResult = new BspCompileResult(originId, statusCode)
|
||||
def apply(originId: String, statusCode: Int): BspCompileResult = new BspCompileResult(Option(originId), statusCode)
|
||||
}
|
||||
56
protocol/src/main/contraband-scala/sbt/internal/bsp/BspConnectionDetails.scala
generated
Normal file
56
protocol/src/main/contraband-scala/sbt/internal/bsp/BspConnectionDetails.scala
generated
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* https://build-server-protocol.github.io/docs/server-discovery.html
|
||||
* @param name The name of the build tool
|
||||
* @param version The version of the build tool
|
||||
* @param bspVersion The bsp version of the build tool
|
||||
* @param languages A collection of languages supported by this BSP server
|
||||
* @param argv Command arguments runnable via system processes to start a BSP server
|
||||
*/
|
||||
final class BspConnectionDetails private (
|
||||
val name: String,
|
||||
val version: String,
|
||||
val bspVersion: String,
|
||||
val languages: Vector[String],
|
||||
val argv: Vector[String]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BspConnectionDetails => (this.name == x.name) && (this.version == x.version) && (this.bspVersion == x.bspVersion) && (this.languages == x.languages) && (this.argv == x.argv)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BspConnectionDetails".##) + name.##) + version.##) + bspVersion.##) + languages.##) + argv.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BspConnectionDetails(" + name + ", " + version + ", " + bspVersion + ", " + languages + ", " + argv + ")"
|
||||
}
|
||||
private[this] def copy(name: String = name, version: String = version, bspVersion: String = bspVersion, languages: Vector[String] = languages, argv: Vector[String] = argv): BspConnectionDetails = {
|
||||
new BspConnectionDetails(name, version, bspVersion, languages, argv)
|
||||
}
|
||||
def withName(name: String): BspConnectionDetails = {
|
||||
copy(name = name)
|
||||
}
|
||||
def withVersion(version: String): BspConnectionDetails = {
|
||||
copy(version = version)
|
||||
}
|
||||
def withBspVersion(bspVersion: String): BspConnectionDetails = {
|
||||
copy(bspVersion = bspVersion)
|
||||
}
|
||||
def withLanguages(languages: Vector[String]): BspConnectionDetails = {
|
||||
copy(languages = languages)
|
||||
}
|
||||
def withArgv(argv: Vector[String]): BspConnectionDetails = {
|
||||
copy(argv = argv)
|
||||
}
|
||||
}
|
||||
object BspConnectionDetails {
|
||||
|
||||
def apply(name: String, version: String, bspVersion: String, languages: Vector[String], argv: Vector[String]): BspConnectionDetails = new BspConnectionDetails(name, version, bspVersion, languages, argv)
|
||||
}
|
||||
36
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildClientCapabilities.scala
generated
Normal file
36
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildClientCapabilities.scala
generated
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** @param languageIds The languages that this client supports.
|
||||
The ID strings for each language is defined in the LSP.
|
||||
The server must never respond with build targets for other
|
||||
languages than those that appear in this list. */
|
||||
final class BuildClientCapabilities private (
|
||||
val languageIds: Vector[String]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BuildClientCapabilities => (this.languageIds == x.languageIds)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.BuildClientCapabilities".##) + languageIds.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BuildClientCapabilities(" + languageIds + ")"
|
||||
}
|
||||
private[this] def copy(languageIds: Vector[String] = languageIds): BuildClientCapabilities = {
|
||||
new BuildClientCapabilities(languageIds)
|
||||
}
|
||||
def withLanguageIds(languageIds: Vector[String]): BuildClientCapabilities = {
|
||||
copy(languageIds = languageIds)
|
||||
}
|
||||
}
|
||||
object BuildClientCapabilities {
|
||||
|
||||
def apply(languageIds: Vector[String]): BuildClientCapabilities = new BuildClientCapabilities(languageIds)
|
||||
}
|
||||
48
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildServerCapabilities.scala
generated
Normal file
48
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildServerCapabilities.scala
generated
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param compileProvider The languages the server supports compilation via method buildTarget/compile.
|
||||
* @param dependencySourcesProvider The server provides sources for library dependencies
|
||||
via method buildTarget/dependencySources
|
||||
*/
|
||||
final class BuildServerCapabilities private (
|
||||
val compileProvider: Option[sbt.internal.bsp.CompileProvider],
|
||||
val dependencySourcesProvider: Option[Boolean]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BuildServerCapabilities => (this.compileProvider == x.compileProvider) && (this.dependencySourcesProvider == x.dependencySourcesProvider)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildServerCapabilities".##) + compileProvider.##) + dependencySourcesProvider.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BuildServerCapabilities(" + compileProvider + ", " + dependencySourcesProvider + ")"
|
||||
}
|
||||
private[this] def copy(compileProvider: Option[sbt.internal.bsp.CompileProvider] = compileProvider, dependencySourcesProvider: Option[Boolean] = dependencySourcesProvider): BuildServerCapabilities = {
|
||||
new BuildServerCapabilities(compileProvider, dependencySourcesProvider)
|
||||
}
|
||||
def withCompileProvider(compileProvider: Option[sbt.internal.bsp.CompileProvider]): BuildServerCapabilities = {
|
||||
copy(compileProvider = compileProvider)
|
||||
}
|
||||
def withCompileProvider(compileProvider: sbt.internal.bsp.CompileProvider): BuildServerCapabilities = {
|
||||
copy(compileProvider = Option(compileProvider))
|
||||
}
|
||||
def withDependencySourcesProvider(dependencySourcesProvider: Option[Boolean]): BuildServerCapabilities = {
|
||||
copy(dependencySourcesProvider = dependencySourcesProvider)
|
||||
}
|
||||
def withDependencySourcesProvider(dependencySourcesProvider: Boolean): BuildServerCapabilities = {
|
||||
copy(dependencySourcesProvider = Option(dependencySourcesProvider))
|
||||
}
|
||||
}
|
||||
object BuildServerCapabilities {
|
||||
|
||||
def apply(compileProvider: Option[sbt.internal.bsp.CompileProvider], dependencySourcesProvider: Option[Boolean]): BuildServerCapabilities = new BuildServerCapabilities(compileProvider, dependencySourcesProvider)
|
||||
def apply(compileProvider: sbt.internal.bsp.CompileProvider, dependencySourcesProvider: Boolean): BuildServerCapabilities = new BuildServerCapabilities(Option(compileProvider), Option(dependencySourcesProvider))
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Build target
|
||||
* @param id The target’s unique identifier
|
||||
* @param displayName A human readable name for this target.
|
||||
May be presented in the user interface.
|
||||
Should be unique if possible.
|
||||
The id.uri is used if None.
|
||||
* @param baseDirectory The directory where this target belongs to. Multiple build targets are allowed to map
|
||||
to the same base directory, and a build target is not required to have a base directory.
|
||||
A base directory does not determine the sources of a target, see buildTarget/sources.
|
||||
* @param tags Free-form string tags to categorize or label this build target.
|
||||
For example, can be used by the client to:
|
||||
- customize how the target should be translated into the client's project model.
|
||||
- group together different but related targets in the user interface.
|
||||
- display icons or colors in the user interface.
|
||||
Pre-defined tags are listed in `BuildTargetTag` but clients and servers
|
||||
are free to define new tags for custom purposes.
|
||||
* @param capabilities The capabilities of this build target.
|
||||
* @param languageIds The set of languages that this target contains.
|
||||
The ID string for each language is defined in the LSP.
|
||||
* @param dependencies The direct upstream build target dependencies of this build target
|
||||
* @param dataKind Kind of data to expect in the `data` field. If this field is not set, the kind of data is not specified.
|
||||
* @param data Language-specific metadata about this target.
|
||||
See ScalaBuildTarget as an example.
|
||||
*/
|
||||
final class BuildTarget private (
|
||||
val id: sbt.internal.bsp.BuildTargetIdentifier,
|
||||
val displayName: Option[String],
|
||||
val baseDirectory: Option[java.net.URI],
|
||||
val tags: Vector[String],
|
||||
val capabilities: sbt.internal.bsp.BuildTargetCapabilities,
|
||||
val languageIds: Vector[String],
|
||||
val dependencies: Vector[sbt.internal.bsp.BuildTargetIdentifier],
|
||||
val dataKind: Option[String],
|
||||
val data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BuildTarget => (this.id == x.id) && (this.displayName == x.displayName) && (this.baseDirectory == x.baseDirectory) && (this.tags == x.tags) && (this.capabilities == x.capabilities) && (this.languageIds == x.languageIds) && (this.dependencies == x.dependencies) && (this.dataKind == x.dataKind) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildTarget".##) + id.##) + displayName.##) + baseDirectory.##) + tags.##) + capabilities.##) + languageIds.##) + dependencies.##) + dataKind.##) + data.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BuildTarget(" + id + ", " + displayName + ", " + baseDirectory + ", " + tags + ", " + capabilities + ", " + languageIds + ", " + dependencies + ", " + dataKind + ", " + data + ")"
|
||||
}
|
||||
private[this] def copy(id: sbt.internal.bsp.BuildTargetIdentifier = id, displayName: Option[String] = displayName, baseDirectory: Option[java.net.URI] = baseDirectory, tags: Vector[String] = tags, capabilities: sbt.internal.bsp.BuildTargetCapabilities = capabilities, languageIds: Vector[String] = languageIds, dependencies: Vector[sbt.internal.bsp.BuildTargetIdentifier] = dependencies, dataKind: Option[String] = dataKind, data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue] = data): BuildTarget = {
|
||||
new BuildTarget(id, displayName, baseDirectory, tags, capabilities, languageIds, dependencies, dataKind, data)
|
||||
}
|
||||
def withId(id: sbt.internal.bsp.BuildTargetIdentifier): BuildTarget = {
|
||||
copy(id = id)
|
||||
}
|
||||
def withDisplayName(displayName: Option[String]): BuildTarget = {
|
||||
copy(displayName = displayName)
|
||||
}
|
||||
def withDisplayName(displayName: String): BuildTarget = {
|
||||
copy(displayName = Option(displayName))
|
||||
}
|
||||
def withBaseDirectory(baseDirectory: Option[java.net.URI]): BuildTarget = {
|
||||
copy(baseDirectory = baseDirectory)
|
||||
}
|
||||
def withBaseDirectory(baseDirectory: java.net.URI): BuildTarget = {
|
||||
copy(baseDirectory = Option(baseDirectory))
|
||||
}
|
||||
def withTags(tags: Vector[String]): BuildTarget = {
|
||||
copy(tags = tags)
|
||||
}
|
||||
def withCapabilities(capabilities: sbt.internal.bsp.BuildTargetCapabilities): BuildTarget = {
|
||||
copy(capabilities = capabilities)
|
||||
}
|
||||
def withLanguageIds(languageIds: Vector[String]): BuildTarget = {
|
||||
copy(languageIds = languageIds)
|
||||
}
|
||||
def withDependencies(dependencies: Vector[sbt.internal.bsp.BuildTargetIdentifier]): BuildTarget = {
|
||||
copy(dependencies = dependencies)
|
||||
}
|
||||
def withDataKind(dataKind: Option[String]): BuildTarget = {
|
||||
copy(dataKind = dataKind)
|
||||
}
|
||||
def withDataKind(dataKind: String): BuildTarget = {
|
||||
copy(dataKind = Option(dataKind))
|
||||
}
|
||||
def withData(data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): BuildTarget = {
|
||||
copy(data = data)
|
||||
}
|
||||
def withData(data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): BuildTarget = {
|
||||
copy(data = Option(data))
|
||||
}
|
||||
}
|
||||
object BuildTarget {
|
||||
|
||||
def apply(id: sbt.internal.bsp.BuildTargetIdentifier, displayName: Option[String], baseDirectory: Option[java.net.URI], tags: Vector[String], capabilities: sbt.internal.bsp.BuildTargetCapabilities, languageIds: Vector[String], dependencies: Vector[sbt.internal.bsp.BuildTargetIdentifier], dataKind: Option[String], data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): BuildTarget = new BuildTarget(id, displayName, baseDirectory, tags, capabilities, languageIds, dependencies, dataKind, data)
|
||||
def apply(id: sbt.internal.bsp.BuildTargetIdentifier, displayName: String, baseDirectory: java.net.URI, tags: Vector[String], capabilities: sbt.internal.bsp.BuildTargetCapabilities, languageIds: Vector[String], dependencies: Vector[sbt.internal.bsp.BuildTargetIdentifier], dataKind: String, data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): BuildTarget = new BuildTarget(id, Option(displayName), Option(baseDirectory), tags, capabilities, languageIds, dependencies, Option(dataKind), Option(data))
|
||||
}
|
||||
45
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildTargetCapabilities.scala
generated
Normal file
45
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildTargetCapabilities.scala
generated
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param canCompile This target can be compiled by the BSP server.
|
||||
* @param canTest This target can be tested by the BSP server.
|
||||
* @param canRun This target can be run by the BSP server.
|
||||
*/
|
||||
final class BuildTargetCapabilities private (
|
||||
val canCompile: Boolean,
|
||||
val canTest: Boolean,
|
||||
val canRun: Boolean) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BuildTargetCapabilities => (this.canCompile == x.canCompile) && (this.canTest == x.canTest) && (this.canRun == x.canRun)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.BuildTargetCapabilities".##) + canCompile.##) + canTest.##) + canRun.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BuildTargetCapabilities(" + canCompile + ", " + canTest + ", " + canRun + ")"
|
||||
}
|
||||
private[this] def copy(canCompile: Boolean = canCompile, canTest: Boolean = canTest, canRun: Boolean = canRun): BuildTargetCapabilities = {
|
||||
new BuildTargetCapabilities(canCompile, canTest, canRun)
|
||||
}
|
||||
def withCanCompile(canCompile: Boolean): BuildTargetCapabilities = {
|
||||
copy(canCompile = canCompile)
|
||||
}
|
||||
def withCanTest(canTest: Boolean): BuildTargetCapabilities = {
|
||||
copy(canTest = canTest)
|
||||
}
|
||||
def withCanRun(canRun: Boolean): BuildTargetCapabilities = {
|
||||
copy(canRun = canRun)
|
||||
}
|
||||
}
|
||||
object BuildTargetCapabilities {
|
||||
|
||||
def apply(canCompile: Boolean, canTest: Boolean, canRun: Boolean): BuildTargetCapabilities = new BuildTargetCapabilities(canCompile, canTest, canRun)
|
||||
}
|
||||
36
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildTargetIdentifier.scala
generated
Normal file
36
protocol/src/main/contraband-scala/sbt/internal/bsp/BuildTargetIdentifier.scala
generated
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Build Target Identifier
|
||||
* @param uri The target's Uri
|
||||
*/
|
||||
final class BuildTargetIdentifier private (
|
||||
val uri: java.net.URI) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: BuildTargetIdentifier => (this.uri == x.uri)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.BuildTargetIdentifier".##) + uri.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"BuildTargetIdentifier(" + uri + ")"
|
||||
}
|
||||
private[this] def copy(uri: java.net.URI = uri): BuildTargetIdentifier = {
|
||||
new BuildTargetIdentifier(uri)
|
||||
}
|
||||
def withUri(uri: java.net.URI): BuildTargetIdentifier = {
|
||||
copy(uri = uri)
|
||||
}
|
||||
}
|
||||
object BuildTargetIdentifier {
|
||||
|
||||
def apply(uri: java.net.URI): BuildTargetIdentifier = new BuildTargetIdentifier(uri)
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Compile Request
|
||||
* @param targets A sequence of build targets to compile
|
||||
* @param originId An optional unique identifier generated by the client to identify this request.
|
||||
The server may include this id in triggered notifications or response.
|
||||
* @param arguments Optional arguments to the compilation process
|
||||
*/
|
||||
final class CompileParams private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier],
|
||||
val originId: Option[String],
|
||||
val arguments: Vector[String]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: CompileParams => (this.targets == x.targets) && (this.originId == x.originId) && (this.arguments == x.arguments)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.CompileParams".##) + targets.##) + originId.##) + arguments.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"CompileParams(" + targets + ", " + originId + ", " + arguments + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets, originId: Option[String] = originId, arguments: Vector[String] = arguments): CompileParams = {
|
||||
new CompileParams(targets, originId, arguments)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): CompileParams = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
def withOriginId(originId: Option[String]): CompileParams = {
|
||||
copy(originId = originId)
|
||||
}
|
||||
def withOriginId(originId: String): CompileParams = {
|
||||
copy(originId = Option(originId))
|
||||
}
|
||||
def withArguments(arguments: Vector[String]): CompileParams = {
|
||||
copy(arguments = arguments)
|
||||
}
|
||||
}
|
||||
object CompileParams {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], originId: Option[String], arguments: Vector[String]): CompileParams = new CompileParams(targets, originId, arguments)
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier], originId: String, arguments: Vector[String]): CompileParams = new CompileParams(targets, Option(originId), arguments)
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
final class CompileProvider private (
|
||||
val languageIds: Vector[String]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: CompileProvider => (this.languageIds == x.languageIds)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.CompileProvider".##) + languageIds.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"CompileProvider(" + languageIds + ")"
|
||||
}
|
||||
private[this] def copy(languageIds: Vector[String] = languageIds): CompileProvider = {
|
||||
new CompileProvider(languageIds)
|
||||
}
|
||||
def withLanguageIds(languageIds: Vector[String]): CompileProvider = {
|
||||
copy(languageIds = languageIds)
|
||||
}
|
||||
}
|
||||
object CompileProvider {
|
||||
|
||||
def apply(languageIds: Vector[String]): CompileProvider = new CompileProvider(languageIds)
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param target The build target that was compiled
|
||||
* @param originId An optional request id to know the origin of this report
|
||||
* @param errors The total number of reported errors compiling this target.
|
||||
* @param warnings The total number of reported warnings compiling the target.
|
||||
* @param time The total number of milliseconds it took to compile the target.
|
||||
*/
|
||||
final class CompileReport private (
|
||||
val target: sbt.internal.bsp.BuildTargetIdentifier,
|
||||
val originId: Option[String],
|
||||
val errors: Int,
|
||||
val warnings: Int,
|
||||
val time: Option[Int]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: CompileReport => (this.target == x.target) && (this.originId == x.originId) && (this.errors == x.errors) && (this.warnings == x.warnings) && (this.time == x.time)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.CompileReport".##) + target.##) + originId.##) + errors.##) + warnings.##) + time.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"CompileReport(" + target + ", " + originId + ", " + errors + ", " + warnings + ", " + time + ")"
|
||||
}
|
||||
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target, originId: Option[String] = originId, errors: Int = errors, warnings: Int = warnings, time: Option[Int] = time): CompileReport = {
|
||||
new CompileReport(target, originId, errors, warnings, time)
|
||||
}
|
||||
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): CompileReport = {
|
||||
copy(target = target)
|
||||
}
|
||||
def withOriginId(originId: Option[String]): CompileReport = {
|
||||
copy(originId = originId)
|
||||
}
|
||||
def withOriginId(originId: String): CompileReport = {
|
||||
copy(originId = Option(originId))
|
||||
}
|
||||
def withErrors(errors: Int): CompileReport = {
|
||||
copy(errors = errors)
|
||||
}
|
||||
def withWarnings(warnings: Int): CompileReport = {
|
||||
copy(warnings = warnings)
|
||||
}
|
||||
def withTime(time: Option[Int]): CompileReport = {
|
||||
copy(time = time)
|
||||
}
|
||||
def withTime(time: Int): CompileReport = {
|
||||
copy(time = Option(time))
|
||||
}
|
||||
}
|
||||
object CompileReport {
|
||||
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, originId: Option[String], errors: Int, warnings: Int, time: Option[Int]): CompileReport = new CompileReport(target, originId, errors, warnings, time)
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, originId: String, errors: Int, warnings: Int, time: Int): CompileReport = new CompileReport(target, Option(originId), errors, warnings, Option(time))
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** Compile Notifications */
|
||||
final class CompileTask private (
|
||||
val target: sbt.internal.bsp.BuildTargetIdentifier) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: CompileTask => (this.target == x.target)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.CompileTask".##) + target.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"CompileTask(" + target + ")"
|
||||
}
|
||||
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target): CompileTask = {
|
||||
new CompileTask(target)
|
||||
}
|
||||
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): CompileTask = {
|
||||
copy(target = target)
|
||||
}
|
||||
}
|
||||
object CompileTask {
|
||||
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier): CompileTask = new CompileTask(target)
|
||||
}
|
||||
42
protocol/src/main/contraband-scala/sbt/internal/bsp/DependencySourcesItem.scala
generated
Normal file
42
protocol/src/main/contraband-scala/sbt/internal/bsp/DependencySourcesItem.scala
generated
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** @param sources List of resources containing source files of the target's dependencies.
|
||||
Can be source files, jar files, zip files, or directories */
|
||||
final class DependencySourcesItem private (
|
||||
val target: Option[sbt.internal.bsp.BuildTargetIdentifier],
|
||||
val sources: Vector[java.net.URI]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: DependencySourcesItem => (this.target == x.target) && (this.sources == x.sources)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.DependencySourcesItem".##) + target.##) + sources.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"DependencySourcesItem(" + target + ", " + sources + ")"
|
||||
}
|
||||
private[this] def copy(target: Option[sbt.internal.bsp.BuildTargetIdentifier] = target, sources: Vector[java.net.URI] = sources): DependencySourcesItem = {
|
||||
new DependencySourcesItem(target, sources)
|
||||
}
|
||||
def withTarget(target: Option[sbt.internal.bsp.BuildTargetIdentifier]): DependencySourcesItem = {
|
||||
copy(target = target)
|
||||
}
|
||||
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): DependencySourcesItem = {
|
||||
copy(target = Option(target))
|
||||
}
|
||||
def withSources(sources: Vector[java.net.URI]): DependencySourcesItem = {
|
||||
copy(sources = sources)
|
||||
}
|
||||
}
|
||||
object DependencySourcesItem {
|
||||
|
||||
def apply(target: Option[sbt.internal.bsp.BuildTargetIdentifier], sources: Vector[java.net.URI]): DependencySourcesItem = new DependencySourcesItem(target, sources)
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, sources: Vector[java.net.URI]): DependencySourcesItem = new DependencySourcesItem(Option(target), sources)
|
||||
}
|
||||
33
protocol/src/main/contraband-scala/sbt/internal/bsp/DependencySourcesParams.scala
generated
Normal file
33
protocol/src/main/contraband-scala/sbt/internal/bsp/DependencySourcesParams.scala
generated
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** Dependency Sources Request */
|
||||
final class DependencySourcesParams private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: DependencySourcesParams => (this.targets == x.targets)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.DependencySourcesParams".##) + targets.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"DependencySourcesParams(" + targets + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets): DependencySourcesParams = {
|
||||
new DependencySourcesParams(targets)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): DependencySourcesParams = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
}
|
||||
object DependencySourcesParams {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): DependencySourcesParams = new DependencySourcesParams(targets)
|
||||
}
|
||||
33
protocol/src/main/contraband-scala/sbt/internal/bsp/DependencySourcesResult.scala
generated
Normal file
33
protocol/src/main/contraband-scala/sbt/internal/bsp/DependencySourcesResult.scala
generated
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** Dependency Sources Result */
|
||||
final class DependencySourcesResult private (
|
||||
val items: Vector[sbt.internal.bsp.DependencySourcesItem]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: DependencySourcesResult => (this.items == x.items)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.DependencySourcesResult".##) + items.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"DependencySourcesResult(" + items + ")"
|
||||
}
|
||||
private[this] def copy(items: Vector[sbt.internal.bsp.DependencySourcesItem] = items): DependencySourcesResult = {
|
||||
new DependencySourcesResult(items)
|
||||
}
|
||||
def withItems(items: Vector[sbt.internal.bsp.DependencySourcesItem]): DependencySourcesResult = {
|
||||
copy(items = items)
|
||||
}
|
||||
}
|
||||
object DependencySourcesResult {
|
||||
|
||||
def apply(items: Vector[sbt.internal.bsp.DependencySourcesItem]): DependencySourcesResult = new DependencySourcesResult(items)
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Represents a diagnostic, such as a compiler error or warning.
|
||||
* Diagnostic objects are only valid in the scope of a resource.
|
||||
* @param range The range at which the message applies.
|
||||
* @param severity The diagnostic's severity. Can be omitted. If omitted it is up to the
|
||||
client to interpret diagnostics as error, warning, info or hint.
|
||||
* @param code The diagnostic's code. Can be omitted.
|
||||
* @param source A human-readable string describing the source of this
|
||||
diagnostic, e.g. 'typescript' or 'super lint'.
|
||||
* @param message The diagnostic's message.
|
||||
*/
|
||||
final class Diagnostic private (
|
||||
val range: sbt.internal.bsp.Range,
|
||||
val severity: Option[Long],
|
||||
val code: Option[String],
|
||||
val source: Option[String],
|
||||
val message: String) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: Diagnostic => (this.range == x.range) && (this.severity == x.severity) && (this.code == x.code) && (this.source == x.source) && (this.message == x.message)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.Diagnostic".##) + range.##) + severity.##) + code.##) + source.##) + message.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"Diagnostic(" + range + ", " + severity + ", " + code + ", " + source + ", " + message + ")"
|
||||
}
|
||||
private[this] def copy(range: sbt.internal.bsp.Range = range, severity: Option[Long] = severity, code: Option[String] = code, source: Option[String] = source, message: String = message): Diagnostic = {
|
||||
new Diagnostic(range, severity, code, source, message)
|
||||
}
|
||||
def withRange(range: sbt.internal.bsp.Range): Diagnostic = {
|
||||
copy(range = range)
|
||||
}
|
||||
def withSeverity(severity: Option[Long]): Diagnostic = {
|
||||
copy(severity = severity)
|
||||
}
|
||||
def withSeverity(severity: Long): Diagnostic = {
|
||||
copy(severity = Option(severity))
|
||||
}
|
||||
def withCode(code: Option[String]): Diagnostic = {
|
||||
copy(code = code)
|
||||
}
|
||||
def withCode(code: String): Diagnostic = {
|
||||
copy(code = Option(code))
|
||||
}
|
||||
def withSource(source: Option[String]): Diagnostic = {
|
||||
copy(source = source)
|
||||
}
|
||||
def withSource(source: String): Diagnostic = {
|
||||
copy(source = Option(source))
|
||||
}
|
||||
def withMessage(message: String): Diagnostic = {
|
||||
copy(message = message)
|
||||
}
|
||||
}
|
||||
object Diagnostic {
|
||||
|
||||
def apply(range: sbt.internal.bsp.Range, severity: Option[Long], code: Option[String], source: Option[String], message: String): Diagnostic = new Diagnostic(range, severity, code, source, message)
|
||||
def apply(range: sbt.internal.bsp.Range, severity: Long, code: String, source: String, message: String): Diagnostic = new Diagnostic(range, Option(severity), Option(code), Option(source), message)
|
||||
}
|
||||
56
protocol/src/main/contraband-scala/sbt/internal/bsp/InitializeBuildParams.scala
generated
Normal file
56
protocol/src/main/contraband-scala/sbt/internal/bsp/InitializeBuildParams.scala
generated
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Initialize Build Request
|
||||
* @param displayName Name of the client
|
||||
* @param version The version of the client
|
||||
* @param bspVersion The BSP version that the client speaks
|
||||
* @param rootUri The rootUri of the workspace
|
||||
* @param capabilities The capabilities of the client
|
||||
*/
|
||||
final class InitializeBuildParams private (
|
||||
val displayName: String,
|
||||
val version: String,
|
||||
val bspVersion: String,
|
||||
val rootUri: java.net.URI,
|
||||
val capabilities: sbt.internal.bsp.BuildClientCapabilities) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: InitializeBuildParams => (this.displayName == x.displayName) && (this.version == x.version) && (this.bspVersion == x.bspVersion) && (this.rootUri == x.rootUri) && (this.capabilities == x.capabilities)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.InitializeBuildParams".##) + displayName.##) + version.##) + bspVersion.##) + rootUri.##) + capabilities.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"InitializeBuildParams(" + displayName + ", " + version + ", " + bspVersion + ", " + rootUri + ", " + capabilities + ")"
|
||||
}
|
||||
private[this] def copy(displayName: String = displayName, version: String = version, bspVersion: String = bspVersion, rootUri: java.net.URI = rootUri, capabilities: sbt.internal.bsp.BuildClientCapabilities = capabilities): InitializeBuildParams = {
|
||||
new InitializeBuildParams(displayName, version, bspVersion, rootUri, capabilities)
|
||||
}
|
||||
def withDisplayName(displayName: String): InitializeBuildParams = {
|
||||
copy(displayName = displayName)
|
||||
}
|
||||
def withVersion(version: String): InitializeBuildParams = {
|
||||
copy(version = version)
|
||||
}
|
||||
def withBspVersion(bspVersion: String): InitializeBuildParams = {
|
||||
copy(bspVersion = bspVersion)
|
||||
}
|
||||
def withRootUri(rootUri: java.net.URI): InitializeBuildParams = {
|
||||
copy(rootUri = rootUri)
|
||||
}
|
||||
def withCapabilities(capabilities: sbt.internal.bsp.BuildClientCapabilities): InitializeBuildParams = {
|
||||
copy(capabilities = capabilities)
|
||||
}
|
||||
}
|
||||
object InitializeBuildParams {
|
||||
|
||||
def apply(displayName: String, version: String, bspVersion: String, rootUri: java.net.URI, capabilities: sbt.internal.bsp.BuildClientCapabilities): InitializeBuildParams = new InitializeBuildParams(displayName, version, bspVersion, rootUri, capabilities)
|
||||
}
|
||||
59
protocol/src/main/contraband-scala/sbt/internal/bsp/InitializeBuildResult.scala
generated
Normal file
59
protocol/src/main/contraband-scala/sbt/internal/bsp/InitializeBuildResult.scala
generated
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param displayName Name of the server
|
||||
* @param version The version of the server
|
||||
* @param bspVersion The BSP version that the server speaks
|
||||
* @param capabilities The capabilities of the build server
|
||||
* @param data Additional metadata about the server
|
||||
*/
|
||||
final class InitializeBuildResult private (
|
||||
val displayName: String,
|
||||
val version: String,
|
||||
val bspVersion: String,
|
||||
val capabilities: sbt.internal.bsp.BuildServerCapabilities,
|
||||
val data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: InitializeBuildResult => (this.displayName == x.displayName) && (this.version == x.version) && (this.bspVersion == x.bspVersion) && (this.capabilities == x.capabilities) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.InitializeBuildResult".##) + displayName.##) + version.##) + bspVersion.##) + capabilities.##) + data.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"InitializeBuildResult(" + displayName + ", " + version + ", " + bspVersion + ", " + capabilities + ", " + data + ")"
|
||||
}
|
||||
private[this] def copy(displayName: String = displayName, version: String = version, bspVersion: String = bspVersion, capabilities: sbt.internal.bsp.BuildServerCapabilities = capabilities, data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue] = data): InitializeBuildResult = {
|
||||
new InitializeBuildResult(displayName, version, bspVersion, capabilities, data)
|
||||
}
|
||||
def withDisplayName(displayName: String): InitializeBuildResult = {
|
||||
copy(displayName = displayName)
|
||||
}
|
||||
def withVersion(version: String): InitializeBuildResult = {
|
||||
copy(version = version)
|
||||
}
|
||||
def withBspVersion(bspVersion: String): InitializeBuildResult = {
|
||||
copy(bspVersion = bspVersion)
|
||||
}
|
||||
def withCapabilities(capabilities: sbt.internal.bsp.BuildServerCapabilities): InitializeBuildResult = {
|
||||
copy(capabilities = capabilities)
|
||||
}
|
||||
def withData(data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): InitializeBuildResult = {
|
||||
copy(data = data)
|
||||
}
|
||||
def withData(data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): InitializeBuildResult = {
|
||||
copy(data = Option(data))
|
||||
}
|
||||
}
|
||||
object InitializeBuildResult {
|
||||
|
||||
def apply(displayName: String, version: String, bspVersion: String, capabilities: sbt.internal.bsp.BuildServerCapabilities, data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): InitializeBuildResult = new InitializeBuildResult(displayName, version, bspVersion, capabilities, data)
|
||||
def apply(displayName: String, version: String, bspVersion: String, capabilities: sbt.internal.bsp.BuildServerCapabilities, data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): InitializeBuildResult = new InitializeBuildResult(displayName, version, bspVersion, capabilities, Option(data))
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Position in a text document expressed as zero-based line and zero-based character offset.
|
||||
* A position is between two characters like an 'insert' cursor in a editor.
|
||||
* @param line Line position in a document (zero-based).
|
||||
* @param character Character offset on a line in a document (zero-based).
|
||||
*/
|
||||
final class Position private (
|
||||
val line: Long,
|
||||
val character: Long) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: Position => (this.line == x.line) && (this.character == x.character)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.Position".##) + line.##) + character.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"Position(" + line + ", " + character + ")"
|
||||
}
|
||||
private[this] def copy(line: Long = line, character: Long = character): Position = {
|
||||
new Position(line, character)
|
||||
}
|
||||
def withLine(line: Long): Position = {
|
||||
copy(line = line)
|
||||
}
|
||||
def withCharacter(character: Long): Position = {
|
||||
copy(character = character)
|
||||
}
|
||||
}
|
||||
object Position {
|
||||
|
||||
def apply(line: Long, character: Long): Position = new Position(line, character)
|
||||
}
|
||||
63
protocol/src/main/contraband-scala/sbt/internal/bsp/PublishDiagnosticsParams.scala
generated
Normal file
63
protocol/src/main/contraband-scala/sbt/internal/bsp/PublishDiagnosticsParams.scala
generated
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Publish Diagnostics
|
||||
* @param textDocument The document where the diagnostics are published.
|
||||
* @param buildTarget The build target where the diagnostics origin.
|
||||
It is valid for one text to belong to multiple build targets,
|
||||
for example sources that are compiled against multiple platforms (JVM, JavaScript).
|
||||
* @param originId The request id that originated this notification
|
||||
* @param diagnostics The diagnostics to be published by the client
|
||||
* @param reset Whether the client should clear the previous diagnostics
|
||||
mapped to the same `textDocument` and buildTarget
|
||||
*/
|
||||
final class PublishDiagnosticsParams private (
|
||||
val textDocument: sbt.internal.bsp.TextDocumentIdentifier,
|
||||
val buildTarget: sbt.internal.bsp.BuildTargetIdentifier,
|
||||
val originId: Option[String],
|
||||
val diagnostics: Vector[sbt.internal.bsp.Diagnostic],
|
||||
val reset: Boolean) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: PublishDiagnosticsParams => (this.textDocument == x.textDocument) && (this.buildTarget == x.buildTarget) && (this.originId == x.originId) && (this.diagnostics == x.diagnostics) && (this.reset == x.reset)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.PublishDiagnosticsParams".##) + textDocument.##) + buildTarget.##) + originId.##) + diagnostics.##) + reset.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"PublishDiagnosticsParams(" + textDocument + ", " + buildTarget + ", " + originId + ", " + diagnostics + ", " + reset + ")"
|
||||
}
|
||||
private[this] def copy(textDocument: sbt.internal.bsp.TextDocumentIdentifier = textDocument, buildTarget: sbt.internal.bsp.BuildTargetIdentifier = buildTarget, originId: Option[String] = originId, diagnostics: Vector[sbt.internal.bsp.Diagnostic] = diagnostics, reset: Boolean = reset): PublishDiagnosticsParams = {
|
||||
new PublishDiagnosticsParams(textDocument, buildTarget, originId, diagnostics, reset)
|
||||
}
|
||||
def withTextDocument(textDocument: sbt.internal.bsp.TextDocumentIdentifier): PublishDiagnosticsParams = {
|
||||
copy(textDocument = textDocument)
|
||||
}
|
||||
def withBuildTarget(buildTarget: sbt.internal.bsp.BuildTargetIdentifier): PublishDiagnosticsParams = {
|
||||
copy(buildTarget = buildTarget)
|
||||
}
|
||||
def withOriginId(originId: Option[String]): PublishDiagnosticsParams = {
|
||||
copy(originId = originId)
|
||||
}
|
||||
def withOriginId(originId: String): PublishDiagnosticsParams = {
|
||||
copy(originId = Option(originId))
|
||||
}
|
||||
def withDiagnostics(diagnostics: Vector[sbt.internal.bsp.Diagnostic]): PublishDiagnosticsParams = {
|
||||
copy(diagnostics = diagnostics)
|
||||
}
|
||||
def withReset(reset: Boolean): PublishDiagnosticsParams = {
|
||||
copy(reset = reset)
|
||||
}
|
||||
}
|
||||
object PublishDiagnosticsParams {
|
||||
|
||||
def apply(textDocument: sbt.internal.bsp.TextDocumentIdentifier, buildTarget: sbt.internal.bsp.BuildTargetIdentifier, originId: Option[String], diagnostics: Vector[sbt.internal.bsp.Diagnostic], reset: Boolean): PublishDiagnosticsParams = new PublishDiagnosticsParams(textDocument, buildTarget, originId, diagnostics, reset)
|
||||
def apply(textDocument: sbt.internal.bsp.TextDocumentIdentifier, buildTarget: sbt.internal.bsp.BuildTargetIdentifier, originId: String, diagnostics: Vector[sbt.internal.bsp.Diagnostic], reset: Boolean): PublishDiagnosticsParams = new PublishDiagnosticsParams(textDocument, buildTarget, Option(originId), diagnostics, reset)
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* A range in a text document expressed as (zero-based) start and end positions. A range is comparable to a selection in an editor.
|
||||
* Therefore the end position is exclusive.
|
||||
* @param start The range's start position.
|
||||
* @param end The range's end position.
|
||||
*/
|
||||
final class Range private (
|
||||
val start: sbt.internal.bsp.Position,
|
||||
val end: sbt.internal.bsp.Position) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: Range => (this.start == x.start) && (this.end == x.end)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.Range".##) + start.##) + end.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"Range(" + start + ", " + end + ")"
|
||||
}
|
||||
private[this] def copy(start: sbt.internal.bsp.Position = start, end: sbt.internal.bsp.Position = end): Range = {
|
||||
new Range(start, end)
|
||||
}
|
||||
def withStart(start: sbt.internal.bsp.Position): Range = {
|
||||
copy(start = start)
|
||||
}
|
||||
def withEnd(end: sbt.internal.bsp.Position): Range = {
|
||||
copy(end = end)
|
||||
}
|
||||
}
|
||||
object Range {
|
||||
|
||||
def apply(start: sbt.internal.bsp.Position, end: sbt.internal.bsp.Position): Range = new Range(start, end)
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Contains sbt-specific metadata for providing editor support for sbt build files.
|
||||
* This metadata is embedded in the data: Option[Json] field of the BuildTarget definition
|
||||
* when the dataKind field contains "sbt".
|
||||
* @param sbtVersion The sbt version. Useful to support version-dependent syntax.
|
||||
* @param autoImports A sequence of Scala imports that are automatically imported in the sbt build files.
|
||||
* @param scalaBuildTarget The Scala build target describing the scala
|
||||
version and scala jars used by this sbt version.
|
||||
* @param parent An optional parent if the target has an sbt meta project.
|
||||
* @param children The inverse of parent, list of targets that have this build target
|
||||
defined as their parent. It can contain normal project targets or
|
||||
sbt build targets if this target represents an sbt meta-meta build.
|
||||
*/
|
||||
final class SbtBuildTarget private (
|
||||
val sbtVersion: String,
|
||||
val autoImports: Vector[String],
|
||||
val scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget,
|
||||
val parent: Option[sbt.internal.bsp.BuildTargetIdentifier],
|
||||
val children: Vector[sbt.internal.bsp.BuildTargetIdentifier]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: SbtBuildTarget => (this.sbtVersion == x.sbtVersion) && (this.autoImports == x.autoImports) && (this.scalaBuildTarget == x.scalaBuildTarget) && (this.parent == x.parent) && (this.children == x.children)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.SbtBuildTarget".##) + sbtVersion.##) + autoImports.##) + scalaBuildTarget.##) + parent.##) + children.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"SbtBuildTarget(" + sbtVersion + ", " + autoImports + ", " + scalaBuildTarget + ", " + parent + ", " + children + ")"
|
||||
}
|
||||
private[this] def copy(sbtVersion: String = sbtVersion, autoImports: Vector[String] = autoImports, scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget = scalaBuildTarget, parent: Option[sbt.internal.bsp.BuildTargetIdentifier] = parent, children: Vector[sbt.internal.bsp.BuildTargetIdentifier] = children): SbtBuildTarget = {
|
||||
new SbtBuildTarget(sbtVersion, autoImports, scalaBuildTarget, parent, children)
|
||||
}
|
||||
def withSbtVersion(sbtVersion: String): SbtBuildTarget = {
|
||||
copy(sbtVersion = sbtVersion)
|
||||
}
|
||||
def withAutoImports(autoImports: Vector[String]): SbtBuildTarget = {
|
||||
copy(autoImports = autoImports)
|
||||
}
|
||||
def withScalaBuildTarget(scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget): SbtBuildTarget = {
|
||||
copy(scalaBuildTarget = scalaBuildTarget)
|
||||
}
|
||||
def withParent(parent: Option[sbt.internal.bsp.BuildTargetIdentifier]): SbtBuildTarget = {
|
||||
copy(parent = parent)
|
||||
}
|
||||
def withParent(parent: sbt.internal.bsp.BuildTargetIdentifier): SbtBuildTarget = {
|
||||
copy(parent = Option(parent))
|
||||
}
|
||||
def withChildren(children: Vector[sbt.internal.bsp.BuildTargetIdentifier]): SbtBuildTarget = {
|
||||
copy(children = children)
|
||||
}
|
||||
}
|
||||
object SbtBuildTarget {
|
||||
|
||||
def apply(sbtVersion: String, autoImports: Vector[String], scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget, parent: Option[sbt.internal.bsp.BuildTargetIdentifier], children: Vector[sbt.internal.bsp.BuildTargetIdentifier]): SbtBuildTarget = new SbtBuildTarget(sbtVersion, autoImports, scalaBuildTarget, parent, children)
|
||||
def apply(sbtVersion: String, autoImports: Vector[String], scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget, parent: sbt.internal.bsp.BuildTargetIdentifier, children: Vector[sbt.internal.bsp.BuildTargetIdentifier]): SbtBuildTarget = new SbtBuildTarget(sbtVersion, autoImports, scalaBuildTarget, Option(parent), children)
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Contains scala-specific metadata for compiling a target containing Scala sources.
|
||||
* This metadata is embedded in the data: Option[Json] field of the BuildTarget definition,
|
||||
* when the dataKind field contains "scala".
|
||||
* @param scalaOrganization The Scala organization that is used for a target.
|
||||
* @param scalaVersion The scala version to compile this target
|
||||
* @param scalaBinaryVersion The binary version of scalaVersion.
|
||||
For example, 2.12 if scalaVersion is 2.12.4.
|
||||
* @param platform The target platform for this target
|
||||
* @param jars A sequence of Scala jars such as scala-library, scala-compiler and scala-reflect.
|
||||
*/
|
||||
final class ScalaBuildTarget private (
|
||||
val scalaOrganization: String,
|
||||
val scalaVersion: String,
|
||||
val scalaBinaryVersion: String,
|
||||
val platform: Int,
|
||||
val jars: Vector[String]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: ScalaBuildTarget => (this.scalaOrganization == x.scalaOrganization) && (this.scalaVersion == x.scalaVersion) && (this.scalaBinaryVersion == x.scalaBinaryVersion) && (this.platform == x.platform) && (this.jars == x.jars)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalaBuildTarget".##) + scalaOrganization.##) + scalaVersion.##) + scalaBinaryVersion.##) + platform.##) + jars.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"ScalaBuildTarget(" + scalaOrganization + ", " + scalaVersion + ", " + scalaBinaryVersion + ", " + platform + ", " + jars + ")"
|
||||
}
|
||||
private[this] def copy(scalaOrganization: String = scalaOrganization, scalaVersion: String = scalaVersion, scalaBinaryVersion: String = scalaBinaryVersion, platform: Int = platform, jars: Vector[String] = jars): ScalaBuildTarget = {
|
||||
new ScalaBuildTarget(scalaOrganization, scalaVersion, scalaBinaryVersion, platform, jars)
|
||||
}
|
||||
def withScalaOrganization(scalaOrganization: String): ScalaBuildTarget = {
|
||||
copy(scalaOrganization = scalaOrganization)
|
||||
}
|
||||
def withScalaVersion(scalaVersion: String): ScalaBuildTarget = {
|
||||
copy(scalaVersion = scalaVersion)
|
||||
}
|
||||
def withScalaBinaryVersion(scalaBinaryVersion: String): ScalaBuildTarget = {
|
||||
copy(scalaBinaryVersion = scalaBinaryVersion)
|
||||
}
|
||||
def withPlatform(platform: Int): ScalaBuildTarget = {
|
||||
copy(platform = platform)
|
||||
}
|
||||
def withJars(jars: Vector[String]): ScalaBuildTarget = {
|
||||
copy(jars = jars)
|
||||
}
|
||||
}
|
||||
object ScalaBuildTarget {
|
||||
|
||||
def apply(scalaOrganization: String, scalaVersion: String, scalaBinaryVersion: String, platform: Int, jars: Vector[String]): ScalaBuildTarget = new ScalaBuildTarget(scalaOrganization, scalaVersion, scalaBinaryVersion, platform, jars)
|
||||
}
|
||||
57
protocol/src/main/contraband-scala/sbt/internal/bsp/ScalacOptionsItem.scala
generated
Normal file
57
protocol/src/main/contraband-scala/sbt/internal/bsp/ScalacOptionsItem.scala
generated
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param options Additional arguments to the compiler.
|
||||
For example, -deprecation.
|
||||
* @param classpath The dependency classpath for this target, must be
|
||||
identical to what is passed as arguments to
|
||||
the -classpath flag in the command line interface
|
||||
of scalac.
|
||||
* @param classDirectory The output directory for classfiles produced by this target
|
||||
*/
|
||||
final class ScalacOptionsItem private (
|
||||
val target: sbt.internal.bsp.BuildTargetIdentifier,
|
||||
val options: Vector[String],
|
||||
val classpath: Vector[java.net.URI],
|
||||
val classDirectory: Option[java.net.URI]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: ScalacOptionsItem => (this.target == x.target) && (this.options == x.options) && (this.classpath == x.classpath) && (this.classDirectory == x.classDirectory)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.ScalacOptionsItem".##) + target.##) + options.##) + classpath.##) + classDirectory.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"ScalacOptionsItem(" + target + ", " + options + ", " + classpath + ", " + classDirectory + ")"
|
||||
}
|
||||
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target, options: Vector[String] = options, classpath: Vector[java.net.URI] = classpath, classDirectory: Option[java.net.URI] = classDirectory): ScalacOptionsItem = {
|
||||
new ScalacOptionsItem(target, options, classpath, classDirectory)
|
||||
}
|
||||
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): ScalacOptionsItem = {
|
||||
copy(target = target)
|
||||
}
|
||||
def withOptions(options: Vector[String]): ScalacOptionsItem = {
|
||||
copy(options = options)
|
||||
}
|
||||
def withClasspath(classpath: Vector[java.net.URI]): ScalacOptionsItem = {
|
||||
copy(classpath = classpath)
|
||||
}
|
||||
def withClassDirectory(classDirectory: Option[java.net.URI]): ScalacOptionsItem = {
|
||||
copy(classDirectory = classDirectory)
|
||||
}
|
||||
def withClassDirectory(classDirectory: java.net.URI): ScalacOptionsItem = {
|
||||
copy(classDirectory = Option(classDirectory))
|
||||
}
|
||||
}
|
||||
object ScalacOptionsItem {
|
||||
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, options: Vector[String], classpath: Vector[java.net.URI], classDirectory: Option[java.net.URI]): ScalacOptionsItem = new ScalacOptionsItem(target, options, classpath, classDirectory)
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, options: Vector[String], classpath: Vector[java.net.URI], classDirectory: java.net.URI): ScalacOptionsItem = new ScalacOptionsItem(target, options, classpath, Option(classDirectory))
|
||||
}
|
||||
37
protocol/src/main/contraband-scala/sbt/internal/bsp/ScalacOptionsParams.scala
generated
Normal file
37
protocol/src/main/contraband-scala/sbt/internal/bsp/ScalacOptionsParams.scala
generated
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Scalac options
|
||||
* The build target scalac options request is sent from the client to the server
|
||||
* to query for the list of compiler options necessary to compile in a given list of targets.
|
||||
*/
|
||||
final class ScalacOptionsParams private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: ScalacOptionsParams => (this.targets == x.targets)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.ScalacOptionsParams".##) + targets.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"ScalacOptionsParams(" + targets + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets): ScalacOptionsParams = {
|
||||
new ScalacOptionsParams(targets)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): ScalacOptionsParams = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
}
|
||||
object ScalacOptionsParams {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): ScalacOptionsParams = new ScalacOptionsParams(targets)
|
||||
}
|
||||
32
protocol/src/main/contraband-scala/sbt/internal/bsp/ScalacOptionsResult.scala
generated
Normal file
32
protocol/src/main/contraband-scala/sbt/internal/bsp/ScalacOptionsResult.scala
generated
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
final class ScalacOptionsResult private (
|
||||
val items: Vector[sbt.internal.bsp.ScalacOptionsItem]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: ScalacOptionsResult => (this.items == x.items)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.ScalacOptionsResult".##) + items.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"ScalacOptionsResult(" + items + ")"
|
||||
}
|
||||
private[this] def copy(items: Vector[sbt.internal.bsp.ScalacOptionsItem] = items): ScalacOptionsResult = {
|
||||
new ScalacOptionsResult(items)
|
||||
}
|
||||
def withItems(items: Vector[sbt.internal.bsp.ScalacOptionsItem]): ScalacOptionsResult = {
|
||||
copy(items = items)
|
||||
}
|
||||
}
|
||||
object ScalacOptionsResult {
|
||||
|
||||
def apply(items: Vector[sbt.internal.bsp.ScalacOptionsItem]): ScalacOptionsResult = new ScalacOptionsResult(items)
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param uri Either a text document or a directory. A directory entry must end with a forward
|
||||
slash "/" and a directory entry implies that every nested text document within the
|
||||
directory belongs to this source item.
|
||||
|
||||
* @param kind Type of file of the source item, such as whether it is file or directory.
|
||||
* @param generated Indicates if this source is automatically generated by the build and is not
|
||||
intended to be manually edited by the user.
|
||||
*/
|
||||
final class SourceItem private (
|
||||
val uri: java.net.URI,
|
||||
val kind: Int,
|
||||
val generated: Boolean) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: SourceItem => (this.uri == x.uri) && (this.kind == x.kind) && (this.generated == x.generated)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.SourceItem".##) + uri.##) + kind.##) + generated.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"SourceItem(" + uri + ", " + kind + ", " + generated + ")"
|
||||
}
|
||||
private[this] def copy(uri: java.net.URI = uri, kind: Int = kind, generated: Boolean = generated): SourceItem = {
|
||||
new SourceItem(uri, kind, generated)
|
||||
}
|
||||
def withUri(uri: java.net.URI): SourceItem = {
|
||||
copy(uri = uri)
|
||||
}
|
||||
def withKind(kind: Int): SourceItem = {
|
||||
copy(kind = kind)
|
||||
}
|
||||
def withGenerated(generated: Boolean): SourceItem = {
|
||||
copy(generated = generated)
|
||||
}
|
||||
}
|
||||
object SourceItem {
|
||||
|
||||
def apply(uri: java.net.URI, kind: Int, generated: Boolean): SourceItem = new SourceItem(uri, kind, generated)
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** @param sources The text documents or and directories that belong to this build target. */
|
||||
final class SourcesItem private (
|
||||
val target: sbt.internal.bsp.BuildTargetIdentifier,
|
||||
val sources: Vector[sbt.internal.bsp.SourceItem]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: SourcesItem => (this.target == x.target) && (this.sources == x.sources)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.SourcesItem".##) + target.##) + sources.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"SourcesItem(" + target + ", " + sources + ")"
|
||||
}
|
||||
private[this] def copy(target: sbt.internal.bsp.BuildTargetIdentifier = target, sources: Vector[sbt.internal.bsp.SourceItem] = sources): SourcesItem = {
|
||||
new SourcesItem(target, sources)
|
||||
}
|
||||
def withTarget(target: sbt.internal.bsp.BuildTargetIdentifier): SourcesItem = {
|
||||
copy(target = target)
|
||||
}
|
||||
def withSources(sources: Vector[sbt.internal.bsp.SourceItem]): SourcesItem = {
|
||||
copy(sources = sources)
|
||||
}
|
||||
}
|
||||
object SourcesItem {
|
||||
|
||||
def apply(target: sbt.internal.bsp.BuildTargetIdentifier, sources: Vector[sbt.internal.bsp.SourceItem]): SourcesItem = new SourcesItem(target, sources)
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** Build Target Sources Request */
|
||||
final class SourcesParams private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: SourcesParams => (this.targets == x.targets)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.SourcesParams".##) + targets.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"SourcesParams(" + targets + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier] = targets): SourcesParams = {
|
||||
new SourcesParams(targets)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): SourcesParams = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
}
|
||||
object SourcesParams {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTargetIdentifier]): SourcesParams = new SourcesParams(targets)
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** Build Target Sources response */
|
||||
final class SourcesResult private (
|
||||
val items: Vector[sbt.internal.bsp.SourcesItem]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: SourcesResult => (this.items == x.items)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.SourcesResult".##) + items.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"SourcesResult(" + items + ")"
|
||||
}
|
||||
private[this] def copy(items: Vector[sbt.internal.bsp.SourcesItem] = items): SourcesResult = {
|
||||
new SourcesResult(items)
|
||||
}
|
||||
def withItems(items: Vector[sbt.internal.bsp.SourcesItem]): SourcesResult = {
|
||||
copy(items = items)
|
||||
}
|
||||
}
|
||||
object SourcesResult {
|
||||
|
||||
def apply(items: Vector[sbt.internal.bsp.SourcesItem]): SourcesResult = new SourcesResult(items)
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param taskId Unique id of the task with optional reference to parent task id.
|
||||
* @param eventTime Optional timestamp of when the event started in milliseconds since Epoch.
|
||||
* @param message Optional message describing the task.
|
||||
* @param status Task completion status: 1 -> success, 2 -> error, 3 -> cancelled
|
||||
* @param dataKind Kind of data to expect in the `data` field.
|
||||
* @param data Optional metadata about the task.
|
||||
*/
|
||||
final class TaskFinishParams private (
|
||||
val taskId: sbt.internal.bsp.TaskId,
|
||||
val eventTime: Option[Long],
|
||||
val message: Option[String],
|
||||
val status: Int,
|
||||
val dataKind: Option[String],
|
||||
val data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: TaskFinishParams => (this.taskId == x.taskId) && (this.eventTime == x.eventTime) && (this.message == x.message) && (this.status == x.status) && (this.dataKind == x.dataKind) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.TaskFinishParams".##) + taskId.##) + eventTime.##) + message.##) + status.##) + dataKind.##) + data.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"TaskFinishParams(" + taskId + ", " + eventTime + ", " + message + ", " + status + ", " + dataKind + ", " + data + ")"
|
||||
}
|
||||
private[this] def copy(taskId: sbt.internal.bsp.TaskId = taskId, eventTime: Option[Long] = eventTime, message: Option[String] = message, status: Int = status, dataKind: Option[String] = dataKind, data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue] = data): TaskFinishParams = {
|
||||
new TaskFinishParams(taskId, eventTime, message, status, dataKind, data)
|
||||
}
|
||||
def withTaskId(taskId: sbt.internal.bsp.TaskId): TaskFinishParams = {
|
||||
copy(taskId = taskId)
|
||||
}
|
||||
def withEventTime(eventTime: Option[Long]): TaskFinishParams = {
|
||||
copy(eventTime = eventTime)
|
||||
}
|
||||
def withEventTime(eventTime: Long): TaskFinishParams = {
|
||||
copy(eventTime = Option(eventTime))
|
||||
}
|
||||
def withMessage(message: Option[String]): TaskFinishParams = {
|
||||
copy(message = message)
|
||||
}
|
||||
def withMessage(message: String): TaskFinishParams = {
|
||||
copy(message = Option(message))
|
||||
}
|
||||
def withStatus(status: Int): TaskFinishParams = {
|
||||
copy(status = status)
|
||||
}
|
||||
def withDataKind(dataKind: Option[String]): TaskFinishParams = {
|
||||
copy(dataKind = dataKind)
|
||||
}
|
||||
def withDataKind(dataKind: String): TaskFinishParams = {
|
||||
copy(dataKind = Option(dataKind))
|
||||
}
|
||||
def withData(data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): TaskFinishParams = {
|
||||
copy(data = data)
|
||||
}
|
||||
def withData(data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): TaskFinishParams = {
|
||||
copy(data = Option(data))
|
||||
}
|
||||
}
|
||||
object TaskFinishParams {
|
||||
|
||||
def apply(taskId: sbt.internal.bsp.TaskId, eventTime: Option[Long], message: Option[String], status: Int, dataKind: Option[String], data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): TaskFinishParams = new TaskFinishParams(taskId, eventTime, message, status, dataKind, data)
|
||||
def apply(taskId: sbt.internal.bsp.TaskId, eventTime: Long, message: String, status: Int, dataKind: String, data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): TaskFinishParams = new TaskFinishParams(taskId, Option(eventTime), Option(message), status, Option(dataKind), Option(data))
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* @param id A unique identifier
|
||||
* @param parents The parent task ids, if any. A non-empty parents field means
|
||||
this task is a sub-task of every parent task.
|
||||
*/
|
||||
final class TaskId private (
|
||||
val id: String,
|
||||
val parents: Vector[String]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: TaskId => (this.id == x.id) && (this.parents == x.parents)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (17 + "sbt.internal.bsp.TaskId".##) + id.##) + parents.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"TaskId(" + id + ", " + parents + ")"
|
||||
}
|
||||
private[this] def copy(id: String = id, parents: Vector[String] = parents): TaskId = {
|
||||
new TaskId(id, parents)
|
||||
}
|
||||
def withId(id: String): TaskId = {
|
||||
copy(id = id)
|
||||
}
|
||||
def withParents(parents: Vector[String]): TaskId = {
|
||||
copy(parents = parents)
|
||||
}
|
||||
}
|
||||
object TaskId {
|
||||
|
||||
def apply(id: String, parents: Vector[String]): TaskId = new TaskId(id, parents)
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Task Notifications
|
||||
* @param taskId Unique id of the task with optional reference to parent task id.
|
||||
* @param eventTime Optional timestamp of when the event started in milliseconds since Epoch.
|
||||
* @param message Optional message describing the task.
|
||||
* @param dataKind Kind of data to expect in the `data` field.
|
||||
* @param data Optional metadata about the task.
|
||||
*/
|
||||
final class TaskStartParams private (
|
||||
val taskId: sbt.internal.bsp.TaskId,
|
||||
val eventTime: Option[Long],
|
||||
val message: Option[String],
|
||||
val dataKind: Option[String],
|
||||
val data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: TaskStartParams => (this.taskId == x.taskId) && (this.eventTime == x.eventTime) && (this.message == x.message) && (this.dataKind == x.dataKind) && (this.data == x.data)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (37 * (37 * (37 * (37 * (17 + "sbt.internal.bsp.TaskStartParams".##) + taskId.##) + eventTime.##) + message.##) + dataKind.##) + data.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"TaskStartParams(" + taskId + ", " + eventTime + ", " + message + ", " + dataKind + ", " + data + ")"
|
||||
}
|
||||
private[this] def copy(taskId: sbt.internal.bsp.TaskId = taskId, eventTime: Option[Long] = eventTime, message: Option[String] = message, dataKind: Option[String] = dataKind, data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue] = data): TaskStartParams = {
|
||||
new TaskStartParams(taskId, eventTime, message, dataKind, data)
|
||||
}
|
||||
def withTaskId(taskId: sbt.internal.bsp.TaskId): TaskStartParams = {
|
||||
copy(taskId = taskId)
|
||||
}
|
||||
def withEventTime(eventTime: Option[Long]): TaskStartParams = {
|
||||
copy(eventTime = eventTime)
|
||||
}
|
||||
def withEventTime(eventTime: Long): TaskStartParams = {
|
||||
copy(eventTime = Option(eventTime))
|
||||
}
|
||||
def withMessage(message: Option[String]): TaskStartParams = {
|
||||
copy(message = message)
|
||||
}
|
||||
def withMessage(message: String): TaskStartParams = {
|
||||
copy(message = Option(message))
|
||||
}
|
||||
def withDataKind(dataKind: Option[String]): TaskStartParams = {
|
||||
copy(dataKind = dataKind)
|
||||
}
|
||||
def withDataKind(dataKind: String): TaskStartParams = {
|
||||
copy(dataKind = Option(dataKind))
|
||||
}
|
||||
def withData(data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): TaskStartParams = {
|
||||
copy(data = data)
|
||||
}
|
||||
def withData(data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): TaskStartParams = {
|
||||
copy(data = Option(data))
|
||||
}
|
||||
}
|
||||
object TaskStartParams {
|
||||
|
||||
def apply(taskId: sbt.internal.bsp.TaskId, eventTime: Option[Long], message: Option[String], dataKind: Option[String], data: Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]): TaskStartParams = new TaskStartParams(taskId, eventTime, message, dataKind, data)
|
||||
def apply(taskId: sbt.internal.bsp.TaskId, eventTime: Long, message: String, dataKind: String, data: sjsonnew.shaded.scalajson.ast.unsafe.JValue): TaskStartParams = new TaskStartParams(taskId, Option(eventTime), Option(message), Option(dataKind), Option(data))
|
||||
}
|
||||
33
protocol/src/main/contraband-scala/sbt/internal/bsp/TextDocumentIdentifier.scala
generated
Normal file
33
protocol/src/main/contraband-scala/sbt/internal/bsp/TextDocumentIdentifier.scala
generated
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/** @param uri The file's Uri */
|
||||
final class TextDocumentIdentifier private (
|
||||
val uri: java.net.URI) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: TextDocumentIdentifier => (this.uri == x.uri)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.TextDocumentIdentifier".##) + uri.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"TextDocumentIdentifier(" + uri + ")"
|
||||
}
|
||||
private[this] def copy(uri: java.net.URI = uri): TextDocumentIdentifier = {
|
||||
new TextDocumentIdentifier(uri)
|
||||
}
|
||||
def withUri(uri: java.net.URI): TextDocumentIdentifier = {
|
||||
copy(uri = uri)
|
||||
}
|
||||
}
|
||||
object TextDocumentIdentifier {
|
||||
|
||||
def apply(uri: java.net.URI): TextDocumentIdentifier = new TextDocumentIdentifier(uri)
|
||||
}
|
||||
37
protocol/src/main/contraband-scala/sbt/internal/bsp/WorkspaceBuildTargetsResult.scala
generated
Normal file
37
protocol/src/main/contraband-scala/sbt/internal/bsp/WorkspaceBuildTargetsResult.scala
generated
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp
|
||||
/**
|
||||
* Workspace Build Targets response
|
||||
* @param targets The build targets in this workspace that
|
||||
contain sources with the given language ids.
|
||||
*/
|
||||
final class WorkspaceBuildTargetsResult private (
|
||||
val targets: Vector[sbt.internal.bsp.BuildTarget]) extends Serializable {
|
||||
|
||||
|
||||
|
||||
override def equals(o: Any): Boolean = o match {
|
||||
case x: WorkspaceBuildTargetsResult => (this.targets == x.targets)
|
||||
case _ => false
|
||||
}
|
||||
override def hashCode: Int = {
|
||||
37 * (37 * (17 + "sbt.internal.bsp.WorkspaceBuildTargetsResult".##) + targets.##)
|
||||
}
|
||||
override def toString: String = {
|
||||
"WorkspaceBuildTargetsResult(" + targets + ")"
|
||||
}
|
||||
private[this] def copy(targets: Vector[sbt.internal.bsp.BuildTarget] = targets): WorkspaceBuildTargetsResult = {
|
||||
new WorkspaceBuildTargetsResult(targets)
|
||||
}
|
||||
def withTargets(targets: Vector[sbt.internal.bsp.BuildTarget]): WorkspaceBuildTargetsResult = {
|
||||
copy(targets = targets)
|
||||
}
|
||||
}
|
||||
object WorkspaceBuildTargetsResult {
|
||||
|
||||
def apply(targets: Vector[sbt.internal.bsp.BuildTarget]): WorkspaceBuildTargetsResult = new WorkspaceBuildTargetsResult(targets)
|
||||
}
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BspCompileResultFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BspCompileResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BspCompileResultFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BspCompileResultFormat: JsonFormat[sbt.internal.bsp.BspCompileResult] = new JsonFormat[sbt.internal.bsp.BspCompileResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BspCompileResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val originId = unbuilder.readField[Option[String]]("originId")
|
||||
val statusCode = unbuilder.readField[Int]("statusCode")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BspCompileResult(originId, statusCode)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BspCompileResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("originId", obj.originId)
|
||||
builder.addField("statusCode", obj.statusCode)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BspConnectionDetailsFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BspConnectionDetailsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BspConnectionDetailsFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BspConnectionDetailsFormat: JsonFormat[sbt.internal.bsp.BspConnectionDetails] = new JsonFormat[sbt.internal.bsp.BspConnectionDetails] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BspConnectionDetails = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val name = unbuilder.readField[String]("name")
|
||||
val version = unbuilder.readField[String]("version")
|
||||
val bspVersion = unbuilder.readField[String]("bspVersion")
|
||||
val languages = unbuilder.readField[Vector[String]]("languages")
|
||||
val argv = unbuilder.readField[Vector[String]]("argv")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BspConnectionDetails(name, version, bspVersion, languages, argv)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BspConnectionDetails, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("name", obj.name)
|
||||
builder.addField("version", obj.version)
|
||||
builder.addField("bspVersion", obj.bspVersion)
|
||||
builder.addField("languages", obj.languages)
|
||||
builder.addField("argv", obj.argv)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildClientCapabilitiesFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildClientCapabilitiesFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BuildClientCapabilitiesFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BuildClientCapabilitiesFormat: JsonFormat[sbt.internal.bsp.BuildClientCapabilities] = new JsonFormat[sbt.internal.bsp.BuildClientCapabilities] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BuildClientCapabilities = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val languageIds = unbuilder.readField[Vector[String]]("languageIds")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BuildClientCapabilities(languageIds)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BuildClientCapabilities, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("languageIds", obj.languageIds)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildServerCapabilitiesFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildServerCapabilitiesFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BuildServerCapabilitiesFormats { self: sbt.internal.bsp.codec.CompileProviderFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BuildServerCapabilitiesFormat: JsonFormat[sbt.internal.bsp.BuildServerCapabilities] = new JsonFormat[sbt.internal.bsp.BuildServerCapabilities] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BuildServerCapabilities = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val compileProvider = unbuilder.readField[Option[sbt.internal.bsp.CompileProvider]]("compileProvider")
|
||||
val dependencySourcesProvider = unbuilder.readField[Option[Boolean]]("dependencySourcesProvider")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BuildServerCapabilities(compileProvider, dependencySourcesProvider)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BuildServerCapabilities, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("compileProvider", obj.compileProvider)
|
||||
builder.addField("dependencySourcesProvider", obj.dependencySourcesProvider)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
31
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildTargetCapabilitiesFormats.scala
generated
Normal file
31
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildTargetCapabilitiesFormats.scala
generated
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BuildTargetCapabilitiesFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BuildTargetCapabilitiesFormat: JsonFormat[sbt.internal.bsp.BuildTargetCapabilities] = new JsonFormat[sbt.internal.bsp.BuildTargetCapabilities] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BuildTargetCapabilities = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val canCompile = unbuilder.readField[Boolean]("canCompile")
|
||||
val canTest = unbuilder.readField[Boolean]("canTest")
|
||||
val canRun = unbuilder.readField[Boolean]("canRun")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BuildTargetCapabilities(canCompile, canTest, canRun)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BuildTargetCapabilities, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("canCompile", obj.canCompile)
|
||||
builder.addField("canTest", obj.canTest)
|
||||
builder.addField("canRun", obj.canRun)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
43
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildTargetFormats.scala
generated
Normal file
43
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildTargetFormats.scala
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BuildTargetFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sbt.internal.bsp.codec.BuildTargetCapabilitiesFormats with sbt.internal.util.codec.JValueFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BuildTargetFormat: JsonFormat[sbt.internal.bsp.BuildTarget] = new JsonFormat[sbt.internal.bsp.BuildTarget] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BuildTarget = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val id = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("id")
|
||||
val displayName = unbuilder.readField[Option[String]]("displayName")
|
||||
val baseDirectory = unbuilder.readField[Option[java.net.URI]]("baseDirectory")
|
||||
val tags = unbuilder.readField[Vector[String]]("tags")
|
||||
val capabilities = unbuilder.readField[sbt.internal.bsp.BuildTargetCapabilities]("capabilities")
|
||||
val languageIds = unbuilder.readField[Vector[String]]("languageIds")
|
||||
val dependencies = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("dependencies")
|
||||
val dataKind = unbuilder.readField[Option[String]]("dataKind")
|
||||
val data = unbuilder.readField[Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]]("data")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BuildTarget(id, displayName, baseDirectory, tags, capabilities, languageIds, dependencies, dataKind, data)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BuildTarget, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("id", obj.id)
|
||||
builder.addField("displayName", obj.displayName)
|
||||
builder.addField("baseDirectory", obj.baseDirectory)
|
||||
builder.addField("tags", obj.tags)
|
||||
builder.addField("capabilities", obj.capabilities)
|
||||
builder.addField("languageIds", obj.languageIds)
|
||||
builder.addField("dependencies", obj.dependencies)
|
||||
builder.addField("dataKind", obj.dataKind)
|
||||
builder.addField("data", obj.data)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildTargetIdentifierFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/BuildTargetIdentifierFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait BuildTargetIdentifierFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val BuildTargetIdentifierFormat: JsonFormat[sbt.internal.bsp.BuildTargetIdentifier] = new JsonFormat[sbt.internal.bsp.BuildTargetIdentifier] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.BuildTargetIdentifier = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val uri = unbuilder.readField[java.net.URI]("uri")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.BuildTargetIdentifier(uri)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.BuildTargetIdentifier, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("uri", obj.uri)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
31
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileParamsFormats.scala
generated
Normal file
31
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait CompileParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val CompileParamsFormat: JsonFormat[sbt.internal.bsp.CompileParams] = new JsonFormat[sbt.internal.bsp.CompileParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.CompileParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
|
||||
val originId = unbuilder.readField[Option[String]]("originId")
|
||||
val arguments = unbuilder.readField[Vector[String]]("arguments")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.CompileParams(targets, originId, arguments)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.CompileParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("targets", obj.targets)
|
||||
builder.addField("originId", obj.originId)
|
||||
builder.addField("arguments", obj.arguments)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileProviderFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileProviderFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait CompileProviderFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val CompileProviderFormat: JsonFormat[sbt.internal.bsp.CompileProvider] = new JsonFormat[sbt.internal.bsp.CompileProvider] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.CompileProvider = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val languageIds = unbuilder.readField[Vector[String]]("languageIds")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.CompileProvider(languageIds)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.CompileProvider, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("languageIds", obj.languageIds)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileReportFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileReportFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait CompileReportFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val CompileReportFormat: JsonFormat[sbt.internal.bsp.CompileReport] = new JsonFormat[sbt.internal.bsp.CompileReport] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.CompileReport = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
|
||||
val originId = unbuilder.readField[Option[String]]("originId")
|
||||
val errors = unbuilder.readField[Int]("errors")
|
||||
val warnings = unbuilder.readField[Int]("warnings")
|
||||
val time = unbuilder.readField[Option[Int]]("time")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.CompileReport(target, originId, errors, warnings, time)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.CompileReport, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("target", obj.target)
|
||||
builder.addField("originId", obj.originId)
|
||||
builder.addField("errors", obj.errors)
|
||||
builder.addField("warnings", obj.warnings)
|
||||
builder.addField("time", obj.time)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileTaskFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/CompileTaskFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait CompileTaskFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val CompileTaskFormat: JsonFormat[sbt.internal.bsp.CompileTask] = new JsonFormat[sbt.internal.bsp.CompileTask] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.CompileTask = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.CompileTask(target)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.CompileTask, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("target", obj.target)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DependencySourcesItemFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DependencySourcesItemFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait DependencySourcesItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val DependencySourcesItemFormat: JsonFormat[sbt.internal.bsp.DependencySourcesItem] = new JsonFormat[sbt.internal.bsp.DependencySourcesItem] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.DependencySourcesItem = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val target = unbuilder.readField[Option[sbt.internal.bsp.BuildTargetIdentifier]]("target")
|
||||
val sources = unbuilder.readField[Vector[java.net.URI]]("sources")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.DependencySourcesItem(target, sources)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.DependencySourcesItem, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("target", obj.target)
|
||||
builder.addField("sources", obj.sources)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DependencySourcesParamsFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DependencySourcesParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait DependencySourcesParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val DependencySourcesParamsFormat: JsonFormat[sbt.internal.bsp.DependencySourcesParams] = new JsonFormat[sbt.internal.bsp.DependencySourcesParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.DependencySourcesParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.DependencySourcesParams(targets)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.DependencySourcesParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("targets", obj.targets)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DependencySourcesResultFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DependencySourcesResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait DependencySourcesResultFormats { self: sbt.internal.bsp.codec.DependencySourcesItemFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val DependencySourcesResultFormat: JsonFormat[sbt.internal.bsp.DependencySourcesResult] = new JsonFormat[sbt.internal.bsp.DependencySourcesResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.DependencySourcesResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val items = unbuilder.readField[Vector[sbt.internal.bsp.DependencySourcesItem]]("items")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.DependencySourcesResult(items)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.DependencySourcesResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("items", obj.items)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DiagnosticFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/DiagnosticFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait DiagnosticFormats { self: sbt.internal.bsp.codec.RangeFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val DiagnosticFormat: JsonFormat[sbt.internal.bsp.Diagnostic] = new JsonFormat[sbt.internal.bsp.Diagnostic] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.Diagnostic = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val range = unbuilder.readField[sbt.internal.bsp.Range]("range")
|
||||
val severity = unbuilder.readField[Option[Long]]("severity")
|
||||
val code = unbuilder.readField[Option[String]]("code")
|
||||
val source = unbuilder.readField[Option[String]]("source")
|
||||
val message = unbuilder.readField[String]("message")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.Diagnostic(range, severity, code, source, message)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.Diagnostic, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("range", obj.range)
|
||||
builder.addField("severity", obj.severity)
|
||||
builder.addField("code", obj.code)
|
||||
builder.addField("source", obj.source)
|
||||
builder.addField("message", obj.message)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/InitializeBuildParamsFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/InitializeBuildParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait InitializeBuildParamsFormats { self: sbt.internal.bsp.codec.BuildClientCapabilitiesFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val InitializeBuildParamsFormat: JsonFormat[sbt.internal.bsp.InitializeBuildParams] = new JsonFormat[sbt.internal.bsp.InitializeBuildParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.InitializeBuildParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val displayName = unbuilder.readField[String]("displayName")
|
||||
val version = unbuilder.readField[String]("version")
|
||||
val bspVersion = unbuilder.readField[String]("bspVersion")
|
||||
val rootUri = unbuilder.readField[java.net.URI]("rootUri")
|
||||
val capabilities = unbuilder.readField[sbt.internal.bsp.BuildClientCapabilities]("capabilities")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.InitializeBuildParams(displayName, version, bspVersion, rootUri, capabilities)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.InitializeBuildParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("displayName", obj.displayName)
|
||||
builder.addField("version", obj.version)
|
||||
builder.addField("bspVersion", obj.bspVersion)
|
||||
builder.addField("rootUri", obj.rootUri)
|
||||
builder.addField("capabilities", obj.capabilities)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/InitializeBuildResultFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/InitializeBuildResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait InitializeBuildResultFormats { self: sbt.internal.bsp.codec.BuildServerCapabilitiesFormats with sbt.internal.util.codec.JValueFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val InitializeBuildResultFormat: JsonFormat[sbt.internal.bsp.InitializeBuildResult] = new JsonFormat[sbt.internal.bsp.InitializeBuildResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.InitializeBuildResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val displayName = unbuilder.readField[String]("displayName")
|
||||
val version = unbuilder.readField[String]("version")
|
||||
val bspVersion = unbuilder.readField[String]("bspVersion")
|
||||
val capabilities = unbuilder.readField[sbt.internal.bsp.BuildServerCapabilities]("capabilities")
|
||||
val data = unbuilder.readField[Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]]("data")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.InitializeBuildResult(displayName, version, bspVersion, capabilities, data)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.InitializeBuildResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("displayName", obj.displayName)
|
||||
builder.addField("version", obj.version)
|
||||
builder.addField("bspVersion", obj.bspVersion)
|
||||
builder.addField("capabilities", obj.capabilities)
|
||||
builder.addField("data", obj.data)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
43
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JsonProtocol.scala
generated
Normal file
43
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/JsonProtocol.scala
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
trait JsonProtocol extends sjsonnew.BasicJsonProtocol
|
||||
with sbt.internal.bsp.codec.BuildTargetIdentifierFormats
|
||||
with sbt.internal.bsp.codec.BuildTargetCapabilitiesFormats
|
||||
with sbt.internal.util.codec.JValueFormats
|
||||
with sbt.internal.bsp.codec.BuildTargetFormats
|
||||
with sbt.internal.bsp.codec.TaskIdFormats
|
||||
with sbt.internal.bsp.codec.TextDocumentIdentifierFormats
|
||||
with sbt.internal.bsp.codec.PositionFormats
|
||||
with sbt.internal.bsp.codec.RangeFormats
|
||||
with sbt.internal.bsp.codec.DiagnosticFormats
|
||||
with sbt.internal.bsp.codec.BuildClientCapabilitiesFormats
|
||||
with sbt.internal.bsp.codec.InitializeBuildParamsFormats
|
||||
with sbt.internal.bsp.codec.CompileProviderFormats
|
||||
with sbt.internal.bsp.codec.BuildServerCapabilitiesFormats
|
||||
with sbt.internal.bsp.codec.InitializeBuildResultFormats
|
||||
with sbt.internal.bsp.codec.PublishDiagnosticsParamsFormats
|
||||
with sbt.internal.bsp.codec.WorkspaceBuildTargetsResultFormats
|
||||
with sbt.internal.bsp.codec.SourcesParamsFormats
|
||||
with sbt.internal.bsp.codec.SourceItemFormats
|
||||
with sbt.internal.bsp.codec.SourcesItemFormats
|
||||
with sbt.internal.bsp.codec.SourcesResultFormats
|
||||
with sbt.internal.bsp.codec.DependencySourcesParamsFormats
|
||||
with sbt.internal.bsp.codec.DependencySourcesItemFormats
|
||||
with sbt.internal.bsp.codec.DependencySourcesResultFormats
|
||||
with sbt.internal.bsp.codec.TaskStartParamsFormats
|
||||
with sbt.internal.bsp.codec.TaskFinishParamsFormats
|
||||
with sbt.internal.bsp.codec.CompileParamsFormats
|
||||
with sbt.internal.bsp.codec.BspCompileResultFormats
|
||||
with sbt.internal.bsp.codec.CompileTaskFormats
|
||||
with sbt.internal.bsp.codec.CompileReportFormats
|
||||
with sbt.internal.bsp.codec.ScalaBuildTargetFormats
|
||||
with sbt.internal.bsp.codec.SbtBuildTargetFormats
|
||||
with sbt.internal.bsp.codec.ScalacOptionsParamsFormats
|
||||
with sbt.internal.bsp.codec.ScalacOptionsItemFormats
|
||||
with sbt.internal.bsp.codec.ScalacOptionsResultFormats
|
||||
with sbt.internal.bsp.codec.BspConnectionDetailsFormats
|
||||
object JsonProtocol extends JsonProtocol
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/PositionFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/PositionFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait PositionFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val PositionFormat: JsonFormat[sbt.internal.bsp.Position] = new JsonFormat[sbt.internal.bsp.Position] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.Position = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val line = unbuilder.readField[Long]("line")
|
||||
val character = unbuilder.readField[Long]("character")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.Position(line, character)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.Position, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("line", obj.line)
|
||||
builder.addField("character", obj.character)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/PublishDiagnosticsParamsFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/PublishDiagnosticsParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait PublishDiagnosticsParamsFormats { self: sbt.internal.bsp.codec.TextDocumentIdentifierFormats with sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sbt.internal.bsp.codec.DiagnosticFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val PublishDiagnosticsParamsFormat: JsonFormat[sbt.internal.bsp.PublishDiagnosticsParams] = new JsonFormat[sbt.internal.bsp.PublishDiagnosticsParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.PublishDiagnosticsParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val textDocument = unbuilder.readField[sbt.internal.bsp.TextDocumentIdentifier]("textDocument")
|
||||
val buildTarget = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("buildTarget")
|
||||
val originId = unbuilder.readField[Option[String]]("originId")
|
||||
val diagnostics = unbuilder.readField[Vector[sbt.internal.bsp.Diagnostic]]("diagnostics")
|
||||
val reset = unbuilder.readField[Boolean]("reset")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.PublishDiagnosticsParams(textDocument, buildTarget, originId, diagnostics, reset)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.PublishDiagnosticsParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("textDocument", obj.textDocument)
|
||||
builder.addField("buildTarget", obj.buildTarget)
|
||||
builder.addField("originId", obj.originId)
|
||||
builder.addField("diagnostics", obj.diagnostics)
|
||||
builder.addField("reset", obj.reset)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/RangeFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/RangeFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait RangeFormats { self: sbt.internal.bsp.codec.PositionFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val RangeFormat: JsonFormat[sbt.internal.bsp.Range] = new JsonFormat[sbt.internal.bsp.Range] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.Range = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val start = unbuilder.readField[sbt.internal.bsp.Position]("start")
|
||||
val end = unbuilder.readField[sbt.internal.bsp.Position]("end")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.Range(start, end)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.Range, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("start", obj.start)
|
||||
builder.addField("end", obj.end)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SbtBuildTargetFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SbtBuildTargetFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait SbtBuildTargetFormats { self: sbt.internal.bsp.codec.ScalaBuildTargetFormats with sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val SbtBuildTargetFormat: JsonFormat[sbt.internal.bsp.SbtBuildTarget] = new JsonFormat[sbt.internal.bsp.SbtBuildTarget] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.SbtBuildTarget = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val sbtVersion = unbuilder.readField[String]("sbtVersion")
|
||||
val autoImports = unbuilder.readField[Vector[String]]("autoImports")
|
||||
val scalaBuildTarget = unbuilder.readField[sbt.internal.bsp.ScalaBuildTarget]("scalaBuildTarget")
|
||||
val parent = unbuilder.readField[Option[sbt.internal.bsp.BuildTargetIdentifier]]("parent")
|
||||
val children = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("children")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.SbtBuildTarget(sbtVersion, autoImports, scalaBuildTarget, parent, children)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.SbtBuildTarget, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("sbtVersion", obj.sbtVersion)
|
||||
builder.addField("autoImports", obj.autoImports)
|
||||
builder.addField("scalaBuildTarget", obj.scalaBuildTarget)
|
||||
builder.addField("parent", obj.parent)
|
||||
builder.addField("children", obj.children)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalaBuildTargetFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalaBuildTargetFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait ScalaBuildTargetFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val ScalaBuildTargetFormat: JsonFormat[sbt.internal.bsp.ScalaBuildTarget] = new JsonFormat[sbt.internal.bsp.ScalaBuildTarget] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ScalaBuildTarget = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val scalaOrganization = unbuilder.readField[String]("scalaOrganization")
|
||||
val scalaVersion = unbuilder.readField[String]("scalaVersion")
|
||||
val scalaBinaryVersion = unbuilder.readField[String]("scalaBinaryVersion")
|
||||
val platform = unbuilder.readField[Int]("platform")
|
||||
val jars = unbuilder.readField[Vector[String]]("jars")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.ScalaBuildTarget(scalaOrganization, scalaVersion, scalaBinaryVersion, platform, jars)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.ScalaBuildTarget, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("scalaOrganization", obj.scalaOrganization)
|
||||
builder.addField("scalaVersion", obj.scalaVersion)
|
||||
builder.addField("scalaBinaryVersion", obj.scalaBinaryVersion)
|
||||
builder.addField("platform", obj.platform)
|
||||
builder.addField("jars", obj.jars)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
33
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalacOptionsItemFormats.scala
generated
Normal file
33
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalacOptionsItemFormats.scala
generated
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait ScalacOptionsItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val ScalacOptionsItemFormat: JsonFormat[sbt.internal.bsp.ScalacOptionsItem] = new JsonFormat[sbt.internal.bsp.ScalacOptionsItem] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ScalacOptionsItem = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
|
||||
val options = unbuilder.readField[Vector[String]]("options")
|
||||
val classpath = unbuilder.readField[Vector[java.net.URI]]("classpath")
|
||||
val classDirectory = unbuilder.readField[Option[java.net.URI]]("classDirectory")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.ScalacOptionsItem(target, options, classpath, classDirectory)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.ScalacOptionsItem, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("target", obj.target)
|
||||
builder.addField("options", obj.options)
|
||||
builder.addField("classpath", obj.classpath)
|
||||
builder.addField("classDirectory", obj.classDirectory)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalacOptionsParamsFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalacOptionsParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait ScalacOptionsParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val ScalacOptionsParamsFormat: JsonFormat[sbt.internal.bsp.ScalacOptionsParams] = new JsonFormat[sbt.internal.bsp.ScalacOptionsParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ScalacOptionsParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.ScalacOptionsParams(targets)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.ScalacOptionsParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("targets", obj.targets)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalacOptionsResultFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/ScalacOptionsResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait ScalacOptionsResultFormats { self: sbt.internal.bsp.codec.ScalacOptionsItemFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val ScalacOptionsResultFormat: JsonFormat[sbt.internal.bsp.ScalacOptionsResult] = new JsonFormat[sbt.internal.bsp.ScalacOptionsResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.ScalacOptionsResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val items = unbuilder.readField[Vector[sbt.internal.bsp.ScalacOptionsItem]]("items")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.ScalacOptionsResult(items)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.ScalacOptionsResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("items", obj.items)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
31
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourceItemFormats.scala
generated
Normal file
31
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourceItemFormats.scala
generated
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait SourceItemFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val SourceItemFormat: JsonFormat[sbt.internal.bsp.SourceItem] = new JsonFormat[sbt.internal.bsp.SourceItem] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.SourceItem = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val uri = unbuilder.readField[java.net.URI]("uri")
|
||||
val kind = unbuilder.readField[Int]("kind")
|
||||
val generated = unbuilder.readField[Boolean]("generated")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.SourceItem(uri, kind, generated)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.SourceItem, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("uri", obj.uri)
|
||||
builder.addField("kind", obj.kind)
|
||||
builder.addField("generated", obj.generated)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourcesItemFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourcesItemFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait SourcesItemFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sbt.internal.bsp.codec.SourceItemFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val SourcesItemFormat: JsonFormat[sbt.internal.bsp.SourcesItem] = new JsonFormat[sbt.internal.bsp.SourcesItem] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.SourcesItem = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val target = unbuilder.readField[sbt.internal.bsp.BuildTargetIdentifier]("target")
|
||||
val sources = unbuilder.readField[Vector[sbt.internal.bsp.SourceItem]]("sources")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.SourcesItem(target, sources)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.SourcesItem, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("target", obj.target)
|
||||
builder.addField("sources", obj.sources)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourcesParamsFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourcesParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait SourcesParamsFormats { self: sbt.internal.bsp.codec.BuildTargetIdentifierFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val SourcesParamsFormat: JsonFormat[sbt.internal.bsp.SourcesParams] = new JsonFormat[sbt.internal.bsp.SourcesParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.SourcesParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTargetIdentifier]]("targets")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.SourcesParams(targets)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.SourcesParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("targets", obj.targets)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourcesResultFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/SourcesResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait SourcesResultFormats { self: sbt.internal.bsp.codec.SourcesItemFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val SourcesResultFormat: JsonFormat[sbt.internal.bsp.SourcesResult] = new JsonFormat[sbt.internal.bsp.SourcesResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.SourcesResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val items = unbuilder.readField[Vector[sbt.internal.bsp.SourcesItem]]("items")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.SourcesResult(items)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.SourcesResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("items", obj.items)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
37
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TaskFinishParamsFormats.scala
generated
Normal file
37
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TaskFinishParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait TaskFinishParamsFormats { self: sbt.internal.bsp.codec.TaskIdFormats with sbt.internal.util.codec.JValueFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val TaskFinishParamsFormat: JsonFormat[sbt.internal.bsp.TaskFinishParams] = new JsonFormat[sbt.internal.bsp.TaskFinishParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.TaskFinishParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val taskId = unbuilder.readField[sbt.internal.bsp.TaskId]("taskId")
|
||||
val eventTime = unbuilder.readField[Option[Long]]("eventTime")
|
||||
val message = unbuilder.readField[Option[String]]("message")
|
||||
val status = unbuilder.readField[Int]("status")
|
||||
val dataKind = unbuilder.readField[Option[String]]("dataKind")
|
||||
val data = unbuilder.readField[Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]]("data")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.TaskFinishParams(taskId, eventTime, message, status, dataKind, data)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.TaskFinishParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("taskId", obj.taskId)
|
||||
builder.addField("eventTime", obj.eventTime)
|
||||
builder.addField("message", obj.message)
|
||||
builder.addField("status", obj.status)
|
||||
builder.addField("dataKind", obj.dataKind)
|
||||
builder.addField("data", obj.data)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TaskIdFormats.scala
generated
Normal file
29
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TaskIdFormats.scala
generated
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait TaskIdFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val TaskIdFormat: JsonFormat[sbt.internal.bsp.TaskId] = new JsonFormat[sbt.internal.bsp.TaskId] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.TaskId = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val id = unbuilder.readField[String]("id")
|
||||
val parents = unbuilder.readField[Vector[String]]("parents")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.TaskId(id, parents)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.TaskId, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("id", obj.id)
|
||||
builder.addField("parents", obj.parents)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TaskStartParamsFormats.scala
generated
Normal file
35
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TaskStartParamsFormats.scala
generated
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait TaskStartParamsFormats { self: sbt.internal.bsp.codec.TaskIdFormats with sbt.internal.util.codec.JValueFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val TaskStartParamsFormat: JsonFormat[sbt.internal.bsp.TaskStartParams] = new JsonFormat[sbt.internal.bsp.TaskStartParams] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.TaskStartParams = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val taskId = unbuilder.readField[sbt.internal.bsp.TaskId]("taskId")
|
||||
val eventTime = unbuilder.readField[Option[Long]]("eventTime")
|
||||
val message = unbuilder.readField[Option[String]]("message")
|
||||
val dataKind = unbuilder.readField[Option[String]]("dataKind")
|
||||
val data = unbuilder.readField[Option[sjsonnew.shaded.scalajson.ast.unsafe.JValue]]("data")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.TaskStartParams(taskId, eventTime, message, dataKind, data)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.TaskStartParams, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("taskId", obj.taskId)
|
||||
builder.addField("eventTime", obj.eventTime)
|
||||
builder.addField("message", obj.message)
|
||||
builder.addField("dataKind", obj.dataKind)
|
||||
builder.addField("data", obj.data)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TextDocumentIdentifierFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/TextDocumentIdentifierFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait TextDocumentIdentifierFormats { self: sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val TextDocumentIdentifierFormat: JsonFormat[sbt.internal.bsp.TextDocumentIdentifier] = new JsonFormat[sbt.internal.bsp.TextDocumentIdentifier] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.TextDocumentIdentifier = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val uri = unbuilder.readField[java.net.URI]("uri")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.TextDocumentIdentifier(uri)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.TextDocumentIdentifier, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("uri", obj.uri)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/WorkspaceBuildTargetsResultFormats.scala
generated
Normal file
27
protocol/src/main/contraband-scala/sbt/internal/bsp/codec/WorkspaceBuildTargetsResultFormats.scala
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* This code is generated using [[https://www.scala-sbt.org/contraband/ sbt-contraband]].
|
||||
*/
|
||||
|
||||
// DO NOT EDIT MANUALLY
|
||||
package sbt.internal.bsp.codec
|
||||
import _root_.sjsonnew.{ Unbuilder, Builder, JsonFormat, deserializationError }
|
||||
trait WorkspaceBuildTargetsResultFormats { self: sbt.internal.bsp.codec.BuildTargetFormats with sjsonnew.BasicJsonProtocol =>
|
||||
implicit lazy val WorkspaceBuildTargetsResultFormat: JsonFormat[sbt.internal.bsp.WorkspaceBuildTargetsResult] = new JsonFormat[sbt.internal.bsp.WorkspaceBuildTargetsResult] {
|
||||
override def read[J](__jsOpt: Option[J], unbuilder: Unbuilder[J]): sbt.internal.bsp.WorkspaceBuildTargetsResult = {
|
||||
__jsOpt match {
|
||||
case Some(__js) =>
|
||||
unbuilder.beginObject(__js)
|
||||
val targets = unbuilder.readField[Vector[sbt.internal.bsp.BuildTarget]]("targets")
|
||||
unbuilder.endObject()
|
||||
sbt.internal.bsp.WorkspaceBuildTargetsResult(targets)
|
||||
case None =>
|
||||
deserializationError("Expected JsObject but found None")
|
||||
}
|
||||
}
|
||||
override def write[J](obj: sbt.internal.bsp.WorkspaceBuildTargetsResult, builder: Builder[J]): Unit = {
|
||||
builder.beginObject()
|
||||
builder.addField("targets", obj.targets)
|
||||
builder.endObject()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,459 @@
|
|||
package sbt.internal.bsp
|
||||
@target(Scala)
|
||||
@codecPackage("sbt.internal.bsp.codec")
|
||||
@fullCodec("JsonProtocol")
|
||||
|
||||
## Build target
|
||||
type BuildTarget {
|
||||
## The target’s unique identifier
|
||||
id: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
|
||||
## A human readable name for this target.
|
||||
## May be presented in the user interface.
|
||||
## Should be unique if possible.
|
||||
## The id.uri is used if None.
|
||||
displayName: String
|
||||
|
||||
## The directory where this target belongs to. Multiple build targets are allowed to map
|
||||
## to the same base directory, and a build target is not required to have a base directory.
|
||||
## A base directory does not determine the sources of a target, see buildTarget/sources.
|
||||
baseDirectory: java.net.URI
|
||||
|
||||
## Free-form string tags to categorize or label this build target.
|
||||
## For example, can be used by the client to:
|
||||
## - customize how the target should be translated into the client's project model.
|
||||
## - group together different but related targets in the user interface.
|
||||
## - display icons or colors in the user interface.
|
||||
## Pre-defined tags are listed in `BuildTargetTag` but clients and servers
|
||||
## are free to define new tags for custom purposes.
|
||||
tags: [String]
|
||||
|
||||
## The capabilities of this build target.
|
||||
capabilities: sbt.internal.bsp.BuildTargetCapabilities!
|
||||
|
||||
## The set of languages that this target contains.
|
||||
## The ID string for each language is defined in the LSP.
|
||||
languageIds: [String]
|
||||
|
||||
## The direct upstream build target dependencies of this build target
|
||||
dependencies: [sbt.internal.bsp.BuildTargetIdentifier]
|
||||
|
||||
## Kind of data to expect in the `data` field. If this field is not set, the kind of data is not specified.
|
||||
dataKind: String
|
||||
|
||||
## Language-specific metadata about this target.
|
||||
## See ScalaBuildTarget as an example.
|
||||
data: sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
}
|
||||
|
||||
## Build Target Identifier
|
||||
type BuildTargetIdentifier {
|
||||
## The target's Uri
|
||||
uri: java.net.URI!
|
||||
}
|
||||
|
||||
type BuildTargetCapabilities {
|
||||
## This target can be compiled by the BSP server.
|
||||
canCompile: Boolean!
|
||||
|
||||
## This target can be tested by the BSP server.
|
||||
canTest: Boolean!
|
||||
|
||||
## This target can be run by the BSP server.
|
||||
canRun: Boolean!
|
||||
}
|
||||
|
||||
type TaskId {
|
||||
## A unique identifier
|
||||
id: String!
|
||||
|
||||
## The parent task ids, if any. A non-empty parents field means
|
||||
## this task is a sub-task of every parent task.
|
||||
parents: [String]
|
||||
}
|
||||
|
||||
type TextDocumentIdentifier {
|
||||
## The file's Uri
|
||||
uri: java.net.URI!
|
||||
}
|
||||
|
||||
## Position in a text document expressed as zero-based line and zero-based character offset.
|
||||
## A position is between two characters like an 'insert' cursor in a editor.
|
||||
type Position {
|
||||
## Line position in a document (zero-based).
|
||||
line: Long!
|
||||
|
||||
## Character offset on a line in a document (zero-based).
|
||||
character: Long!
|
||||
}
|
||||
|
||||
## A range in a text document expressed as (zero-based) start and end positions. A range is comparable to a selection in an editor.
|
||||
## Therefore the end position is exclusive.
|
||||
type Range {
|
||||
## The range's start position.
|
||||
start: sbt.internal.bsp.Position!
|
||||
|
||||
## The range's end position.
|
||||
end: sbt.internal.bsp.Position!
|
||||
}
|
||||
|
||||
## Represents a diagnostic, such as a compiler error or warning.
|
||||
## Diagnostic objects are only valid in the scope of a resource.
|
||||
type Diagnostic {
|
||||
## The range at which the message applies.
|
||||
range: sbt.internal.bsp.Range!
|
||||
|
||||
## The diagnostic's severity. Can be omitted. If omitted it is up to the
|
||||
## client to interpret diagnostics as error, warning, info or hint.
|
||||
severity: Long
|
||||
|
||||
## The diagnostic's code. Can be omitted.
|
||||
code: String
|
||||
|
||||
## A human-readable string describing the source of this
|
||||
## diagnostic, e.g. 'typescript' or 'super lint'.
|
||||
source: String
|
||||
|
||||
## The diagnostic's message.
|
||||
message: String!
|
||||
}
|
||||
|
||||
## Initialize Build Request
|
||||
type InitializeBuildParams {
|
||||
## Name of the client
|
||||
displayName: String!
|
||||
|
||||
## The version of the client
|
||||
version: String!
|
||||
|
||||
## The BSP version that the client speaks
|
||||
bspVersion: String!
|
||||
|
||||
## The rootUri of the workspace
|
||||
rootUri: java.net.URI!
|
||||
|
||||
## The capabilities of the client
|
||||
capabilities: sbt.internal.bsp.BuildClientCapabilities!
|
||||
|
||||
# Additional metadata about the client
|
||||
# data: any
|
||||
}
|
||||
|
||||
type BuildClientCapabilities {
|
||||
## The languages that this client supports.
|
||||
## The ID strings for each language is defined in the LSP.
|
||||
## The server must never respond with build targets for other
|
||||
## languages than those that appear in this list.
|
||||
languageIds: [String]
|
||||
}
|
||||
|
||||
type InitializeBuildResult {
|
||||
## Name of the server
|
||||
displayName: String!
|
||||
|
||||
## The version of the server
|
||||
version: String!
|
||||
|
||||
## The BSP version that the server speaks
|
||||
bspVersion: String!
|
||||
|
||||
## The capabilities of the build server
|
||||
capabilities: sbt.internal.bsp.BuildServerCapabilities!
|
||||
|
||||
## Additional metadata about the server
|
||||
data: sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
}
|
||||
|
||||
type BuildServerCapabilities {
|
||||
## The languages the server supports compilation via method buildTarget/compile.
|
||||
compileProvider: sbt.internal.bsp.CompileProvider
|
||||
|
||||
# The languages the server supports test execution via method buildTarget/test
|
||||
# testProvider: TestProvider
|
||||
|
||||
# The languages the server supports run via method buildTarget/run
|
||||
# runProvider: RunProvider
|
||||
|
||||
# The server can provide a list of targets that contain a
|
||||
# single text document via the method buildTarget/inverseSources
|
||||
# inverseSourcesProvider: Boolean
|
||||
|
||||
## The server provides sources for library dependencies
|
||||
## via method buildTarget/dependencySources
|
||||
dependencySourcesProvider: Boolean
|
||||
|
||||
# The server provides all the resource dependencies
|
||||
# via method buildTarget/resources
|
||||
# resourcesProvider: Boolean
|
||||
|
||||
# The server sends notifications to the client on build
|
||||
# target change events via buildTarget/didChange
|
||||
# buildTargetChangedProvider: Boolean
|
||||
}
|
||||
|
||||
type CompileProvider {
|
||||
languageIds: [String]
|
||||
}
|
||||
|
||||
## Publish Diagnostics
|
||||
type PublishDiagnosticsParams {
|
||||
## The document where the diagnostics are published.
|
||||
textDocument: sbt.internal.bsp.TextDocumentIdentifier!
|
||||
|
||||
## The build target where the diagnostics origin.
|
||||
## It is valid for one text to belong to multiple build targets,
|
||||
## for example sources that are compiled against multiple platforms (JVM, JavaScript).
|
||||
buildTarget: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
|
||||
## The request id that originated this notification
|
||||
originId: String
|
||||
|
||||
## The diagnostics to be published by the client
|
||||
diagnostics: [sbt.internal.bsp.Diagnostic]
|
||||
|
||||
## Whether the client should clear the previous diagnostics
|
||||
## mapped to the same `textDocument` and buildTarget
|
||||
reset: Boolean!
|
||||
}
|
||||
|
||||
## Workspace Build Targets response
|
||||
type WorkspaceBuildTargetsResult {
|
||||
## The build targets in this workspace that
|
||||
## contain sources with the given language ids.
|
||||
targets: [sbt.internal.bsp.BuildTarget]
|
||||
}
|
||||
|
||||
## Build Target Sources Request
|
||||
type SourcesParams {
|
||||
targets: [sbt.internal.bsp.BuildTargetIdentifier]
|
||||
}
|
||||
|
||||
## Build Target Sources response
|
||||
type SourcesResult {
|
||||
items: [sbt.internal.bsp.SourcesItem]
|
||||
}
|
||||
|
||||
type SourcesItem {
|
||||
target: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
## The text documents or and directories that belong to this build target.
|
||||
sources: [sbt.internal.bsp.SourceItem]
|
||||
}
|
||||
|
||||
type SourceItem {
|
||||
## Either a text document or a directory. A directory entry must end with a forward
|
||||
## slash "/" and a directory entry implies that every nested text document within the
|
||||
## directory belongs to this source item.
|
||||
##
|
||||
uri: java.net.URI!
|
||||
|
||||
## Type of file of the source item, such as whether it is file or directory.
|
||||
kind: Int!
|
||||
|
||||
## Indicates if this source is automatically generated by the build and is not
|
||||
## intended to be manually edited by the user.
|
||||
generated: Boolean!
|
||||
}
|
||||
|
||||
## Dependency Sources Request
|
||||
type DependencySourcesParams {
|
||||
targets: [sbt.internal.bsp.BuildTargetIdentifier]
|
||||
}
|
||||
|
||||
## Dependency Sources Result
|
||||
type DependencySourcesResult {
|
||||
items: [sbt.internal.bsp.DependencySourcesItem]
|
||||
}
|
||||
|
||||
type DependencySourcesItem {
|
||||
target: sbt.internal.bsp.BuildTargetIdentifier
|
||||
|
||||
## List of resources containing source files of the target's dependencies.
|
||||
## Can be source files, jar files, zip files, or directories
|
||||
sources: [java.net.URI]
|
||||
}
|
||||
|
||||
## Task Notifications
|
||||
|
||||
type TaskStartParams {
|
||||
## Unique id of the task with optional reference to parent task id.
|
||||
taskId: sbt.internal.bsp.TaskId!
|
||||
|
||||
## Optional timestamp of when the event started in milliseconds since Epoch.
|
||||
eventTime: Long
|
||||
|
||||
## Optional message describing the task.
|
||||
message: String
|
||||
|
||||
## Kind of data to expect in the `data` field.
|
||||
dataKind: String
|
||||
|
||||
## Optional metadata about the task.
|
||||
data: sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
}
|
||||
|
||||
type TaskFinishParams {
|
||||
## Unique id of the task with optional reference to parent task id.
|
||||
taskId: sbt.internal.bsp.TaskId!
|
||||
|
||||
## Optional timestamp of when the event started in milliseconds since Epoch.
|
||||
eventTime: Long
|
||||
|
||||
## Optional message describing the task.
|
||||
message: String
|
||||
|
||||
## Task completion status: 1 -> success, 2 -> error, 3 -> cancelled
|
||||
status: Int!
|
||||
|
||||
## Kind of data to expect in the `data` field.
|
||||
dataKind: String
|
||||
|
||||
## Optional metadata about the task.
|
||||
data: sjsonnew.shaded.scalajson.ast.unsafe.JValue
|
||||
}
|
||||
|
||||
## Compile Request
|
||||
type CompileParams {
|
||||
## A sequence of build targets to compile
|
||||
targets: [sbt.internal.bsp.BuildTargetIdentifier]
|
||||
|
||||
## An optional unique identifier generated by the client to identify this request.
|
||||
## The server may include this id in triggered notifications or response.
|
||||
originId: String
|
||||
|
||||
## Optional arguments to the compilation process
|
||||
arguments: [String]
|
||||
}
|
||||
|
||||
## Compile Response
|
||||
type BspCompileResult {
|
||||
## An optional request id to know the origin of this report.
|
||||
originId: String
|
||||
|
||||
## A status code for the execution.
|
||||
statusCode: Int!
|
||||
|
||||
# Kind of data to expect in the `data` field.
|
||||
# If this field is not set, the kind of data is not specified.
|
||||
# dataKind: String
|
||||
|
||||
# A field containing language-specific information, like products
|
||||
# of compilation or compiler-specific metadata the client needs to know.
|
||||
# data: any
|
||||
}
|
||||
|
||||
## Compile Notifications
|
||||
|
||||
type CompileTask {
|
||||
target: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
}
|
||||
|
||||
type CompileReport {
|
||||
## The build target that was compiled
|
||||
target: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
|
||||
## An optional request id to know the origin of this report
|
||||
originId: String
|
||||
|
||||
## The total number of reported errors compiling this target.
|
||||
errors: Int!
|
||||
|
||||
## The total number of reported warnings compiling the target.
|
||||
warnings: Int!
|
||||
|
||||
## The total number of milliseconds it took to compile the target.
|
||||
time: Int
|
||||
}
|
||||
|
||||
# Scala Extension
|
||||
|
||||
## Contains scala-specific metadata for compiling a target containing Scala sources.
|
||||
## This metadata is embedded in the data: Option[Json] field of the BuildTarget definition,
|
||||
## when the dataKind field contains "scala".
|
||||
type ScalaBuildTarget {
|
||||
## The Scala organization that is used for a target.
|
||||
scalaOrganization: String!
|
||||
|
||||
## The scala version to compile this target
|
||||
scalaVersion: String!
|
||||
|
||||
## The binary version of scalaVersion.
|
||||
## For example, 2.12 if scalaVersion is 2.12.4.
|
||||
scalaBinaryVersion: String!
|
||||
|
||||
## The target platform for this target
|
||||
platform: Int!
|
||||
|
||||
## A sequence of Scala jars such as scala-library, scala-compiler and scala-reflect.
|
||||
jars: [String]!
|
||||
}
|
||||
|
||||
# sbt Extension
|
||||
|
||||
## Contains sbt-specific metadata for providing editor support for sbt build files.
|
||||
## This metadata is embedded in the data: Option[Json] field of the BuildTarget definition
|
||||
## when the dataKind field contains "sbt".
|
||||
type SbtBuildTarget {
|
||||
## The sbt version. Useful to support version-dependent syntax.
|
||||
sbtVersion: String!
|
||||
|
||||
## A sequence of Scala imports that are automatically imported in the sbt build files.
|
||||
autoImports: [String]!
|
||||
|
||||
## The Scala build target describing the scala
|
||||
## version and scala jars used by this sbt version.
|
||||
scalaBuildTarget: sbt.internal.bsp.ScalaBuildTarget!
|
||||
|
||||
## An optional parent if the target has an sbt meta project.
|
||||
parent: sbt.internal.bsp.BuildTargetIdentifier
|
||||
|
||||
## The inverse of parent, list of targets that have this build target
|
||||
## defined as their parent. It can contain normal project targets or
|
||||
## sbt build targets if this target represents an sbt meta-meta build.
|
||||
children: [sbt.internal.bsp.BuildTargetIdentifier]!
|
||||
}
|
||||
|
||||
## Scalac options
|
||||
## The build target scalac options request is sent from the client to the server
|
||||
## to query for the list of compiler options necessary to compile in a given list of targets.
|
||||
type ScalacOptionsParams {
|
||||
targets: [sbt.internal.bsp.BuildTargetIdentifier]
|
||||
}
|
||||
|
||||
type ScalacOptionsResult {
|
||||
items: [sbt.internal.bsp.ScalacOptionsItem]
|
||||
}
|
||||
|
||||
type ScalacOptionsItem {
|
||||
target: sbt.internal.bsp.BuildTargetIdentifier!
|
||||
|
||||
## Additional arguments to the compiler.
|
||||
## For example, -deprecation.
|
||||
options: [String]
|
||||
|
||||
## The dependency classpath for this target, must be
|
||||
## identical to what is passed as arguments to
|
||||
## the -classpath flag in the command line interface
|
||||
## of scalac.
|
||||
classpath: [java.net.URI]
|
||||
|
||||
## The output directory for classfiles produced by this target
|
||||
classDirectory: java.net.URI
|
||||
}
|
||||
|
||||
## https://build-server-protocol.github.io/docs/server-discovery.html
|
||||
type BspConnectionDetails {
|
||||
## The name of the build tool
|
||||
name: String!
|
||||
|
||||
## The version of the build tool
|
||||
version: String!
|
||||
|
||||
## The bsp version of the build tool
|
||||
bspVersion: String!
|
||||
|
||||
## A collection of languages supported by this BSP server
|
||||
languages: [String]
|
||||
|
||||
## Command arguments runnable via system processes to start a BSP server
|
||||
argv: [String]
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.bsp
|
||||
|
||||
object BuildServerConnection {
|
||||
final val name = "sbt"
|
||||
final val bspVersion = "2.0.0-M5"
|
||||
final val languages = Vector("scala")
|
||||
|
||||
def details(sbtVersion: String, launcherJar: String): BspConnectionDetails = {
|
||||
val argv = Vector("java", "-Xms100m", "-Xmx100m", "-jar", launcherJar, "-bsp")
|
||||
BspConnectionDetails(name, sbtVersion, bspVersion, languages, argv)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.bsp
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
object BuildServerTasks {
|
||||
private val idGenerator = new AtomicInteger(0)
|
||||
def uniqueId: String = idGenerator.getAndIncrement().toString
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.bsp
|
||||
|
||||
object BuildTargetName {
|
||||
def fromScope(project: String, config: String): String = {
|
||||
config match {
|
||||
case "compile" => project
|
||||
case _ => s"$project-$config"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.bsp
|
||||
|
||||
// https://build-server-protocol.github.io/docs/specification.html#build-target
|
||||
object BuildTargetTag {
|
||||
val test: String = "test"
|
||||
val application: String = "application"
|
||||
val library: String = "library"
|
||||
val integrationTest: String = "integration-test"
|
||||
val benchmark: String = "benchmark"
|
||||
val noIDE: String = "no-ide"
|
||||
|
||||
def fromConfig(config: String): Vector[String] = config match {
|
||||
case "test" => Vector(test)
|
||||
case "compile" => Vector(library)
|
||||
case _ => Vector.empty
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.bsp
|
||||
|
||||
object DiagnosticSeverity {
|
||||
|
||||
/**
|
||||
* Reports an error.
|
||||
*/
|
||||
val Error = 1L
|
||||
|
||||
/**
|
||||
* Reports a warning.
|
||||
*/
|
||||
val Warning = 2L
|
||||
|
||||
/**
|
||||
* Reports an information.
|
||||
*/
|
||||
val Information = 3L
|
||||
|
||||
/**
|
||||
* Reports a hint.
|
||||
*/
|
||||
val Hint = 4L
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt
|
||||
package internal
|
||||
package bsp
|
||||
|
||||
object ScalaPlatform {
|
||||
val JVM = 1
|
||||
val JS = 2
|
||||
val Native = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt
|
||||
package internal
|
||||
package bsp
|
||||
|
||||
object SourceItemKind {
|
||||
|
||||
/** The source item references a normal file. */
|
||||
val File: Int = 1
|
||||
|
||||
/** The source item references a directory. */
|
||||
val Directory: Int = 2
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.internal.bsp
|
||||
|
||||
object StatusCode {
|
||||
final val Success: Int = 1
|
||||
final val Error: Int = 2
|
||||
final val Cancelled: Int = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
ThisBuild / scalaVersion := "2.13.1"
|
||||
|
||||
Global / serverLog / logLevel := Level.Debug
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.aggregate(foo, util)
|
||||
|
||||
lazy val foo = project
|
||||
.dependsOn(util)
|
||||
|
||||
lazy val util = project
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package testpkg
|
||||
|
||||
import scala.concurrent.duration._
|
||||
|
||||
// starts svr using server-test/buildserver and perform custom server tests
|
||||
object BuildServerTest extends AbstractServerTest {
|
||||
override val testDirectory: String = "buildserver"
|
||||
|
||||
test("build/initialize") { _ =>
|
||||
initializeRequest()
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
println(s)
|
||||
(s contains """"id":"10"""")
|
||||
})
|
||||
}
|
||||
|
||||
test("workspace/buildTargets") { _ =>
|
||||
svr.sendJsonRpc(
|
||||
"""{ "jsonrpc": "2.0", "id": "11", "method": "workspace/buildTargets", "params": {} }"""
|
||||
)
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
println(s)
|
||||
(s contains """"id":"11"""") &&
|
||||
(s contains """"displayName":"util"""")
|
||||
})
|
||||
}
|
||||
|
||||
test("buildTarget/sources") { _ =>
|
||||
val x = s"${svr.baseDirectory.getAbsoluteFile.toURI}#util/Compile"
|
||||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "12", "method": "buildTarget/sources", "params": {
|
||||
| "targets": [{ "uri": "$x" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
println(s)
|
||||
(s contains """"id":"12"""") &&
|
||||
(s contains "util/src/main/scala")
|
||||
})
|
||||
}
|
||||
|
||||
test("buildTarget/compile") { _ =>
|
||||
val x = s"${svr.baseDirectory.getAbsoluteFile.toURI}#util/Compile"
|
||||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "13", "method": "buildTarget/compile", "params": {
|
||||
| "targets": [{ "uri": "$x" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
println(s)
|
||||
(s contains """"id":"13"""") &&
|
||||
(s contains """"statusCode":1""")
|
||||
})
|
||||
}
|
||||
|
||||
test("buildTarget/scalacOptions") { _ =>
|
||||
val x = s"${svr.baseDirectory.getAbsoluteFile.toURI}#util/Compile"
|
||||
svr.sendJsonRpc(
|
||||
s"""{ "jsonrpc": "2.0", "id": "14", "method": "buildTarget/scalacOptions", "params": {
|
||||
| "targets": [{ "uri": "$x" }]
|
||||
|} }""".stripMargin
|
||||
)
|
||||
assert(svr.waitForString(10.seconds) { s =>
|
||||
println(s)
|
||||
(s contains """"id":"14"""") &&
|
||||
(s contains "scala-library-2.13.1.jar")
|
||||
})
|
||||
}
|
||||
|
||||
def initializeRequest(): Unit = {
|
||||
svr.sendJsonRpc(
|
||||
"""{ "jsonrpc": "2.0", "id": "10", "method": "build/initialize",
|
||||
| "params": {
|
||||
| "displayName": "test client",
|
||||
| "version": "1.0.0",
|
||||
| "bspVersion": "2.0.0-M5",
|
||||
| "rootUri": "file://root/",
|
||||
| "capabilities": { "languageIds": ["scala"] }
|
||||
| }
|
||||
|}""".stripMargin
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -26,8 +26,18 @@ trait AbstractServerTest extends TestSuite[Unit] {
|
|||
var svr: TestServer = _
|
||||
def testDirectory: String
|
||||
|
||||
private val targetDir: File = {
|
||||
val p0 = new File("..").getAbsoluteFile.getCanonicalFile / "target"
|
||||
val p1 = new File("target").getAbsoluteFile
|
||||
if (p0.exists) p0
|
||||
else p1
|
||||
}
|
||||
|
||||
override def setupSuite(): Unit = {
|
||||
temp = IO.createTemporaryDirectory
|
||||
temp = targetDir / "test-server" / testDirectory
|
||||
if (temp.exists) {
|
||||
IO.delete(temp)
|
||||
}
|
||||
val classpath = sys.props.get("sbt.server.classpath") match {
|
||||
case Some(s: String) => s.split(java.io.File.pathSeparator).map(file)
|
||||
case _ => throw new IllegalStateException("No server classpath was specified.")
|
||||
|
|
|
|||
Loading…
Reference in New Issue