Bump SBT and Scalafmt (#1203)

Co-authored-by: Radosław Waśko <radoslaw.wasko@enso.org>
Co-authored-by: Dmitry Bushev <bushevdv@gmail.com>
This commit is contained in:
Ara Adkins 2020-10-22 15:12:28 +01:00 committed by GitHub
parent 0740905306
commit 746521f8b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
684 changed files with 4951 additions and 7138 deletions

View File

@ -251,6 +251,6 @@ branches:
- "Rust Test Native (windows-latest)" - "Rust Test Native (windows-latest)"
- "Rust Test WASM" - "Rust Test WASM"
- "license/cla" - "license/cla"
- "Vulnerability Scan" # - "Vulnerability Scan" # CodeQL is temporarily disabled due to incompatibility
enforce_admins: null enforce_admins: null
restrictions: null restrictions: null

View File

@ -1,13 +1,19 @@
name: "CodeQL" name: "CodeQL"
# CodeQL is temporarily disabled because it seems that it is unable to discover
# code compiled with SBT.
on: on:
push: push:
branches: branches-ignore:
- main - "**"
- "release/*" # branches:
# - main
# - "release/*"
pull_request: pull_request:
branches: branches-ignore:
- "*" - "**"
# branches:
# - "*"
env: env:
# Please ensure that this is in sync with graalVersion in build.sbt # Please ensure that this is in sync with graalVersion in build.sbt
@ -15,7 +21,7 @@ env:
# Please ensure that this is in sync with javaVersion in build.sbt # Please ensure that this is in sync with javaVersion in build.sbt
javaVersion: 11 javaVersion: 11
# Please ensure that this is in sync with project/build.properties # Please ensure that this is in sync with project/build.properties
sbtVersion: 1.3.13 sbtVersion: 1.4.1
# Please ensure that this is in sync with rustVersion in build.sbt # Please ensure that this is in sync with rustVersion in build.sbt
rustToolchain: nightly-2019-11-04 rustToolchain: nightly-2019-11-04

View File

@ -11,7 +11,7 @@ env:
# Please ensure that this is in sync with javaVersion in build.sbt # Please ensure that this is in sync with javaVersion in build.sbt
javaVersion: 11 javaVersion: 11
# Please ensure that this is in sync with project/build.properties # Please ensure that this is in sync with project/build.properties
sbtVersion: 1.3.13 sbtVersion: 1.4.1
# Please ensure that this is in sync with rustVersion in build.sbt # Please ensure that this is in sync with rustVersion in build.sbt
rustToolchain: nightly-2019-11-04 rustToolchain: nightly-2019-11-04

View File

@ -12,7 +12,7 @@ env:
# Please ensure that this is in sync with javaVersion in build.sbt # Please ensure that this is in sync with javaVersion in build.sbt
javaVersion: 11 javaVersion: 11
# Please ensure that this is in sync with project/build.properties # Please ensure that this is in sync with project/build.properties
sbtVersion: 1.3.13 sbtVersion: 1.4.1
# Please ensure that this is in sync with rustVersion in build.sbt # Please ensure that this is in sync with rustVersion in build.sbt
rustToolchain: nightly-2019-11-04 rustToolchain: nightly-2019-11-04
excludedPaths: | excludedPaths: |

1
.gitignore vendored
View File

@ -96,6 +96,7 @@ bench-report.xml
.editorconfig .editorconfig
.bloop/ .bloop/
.bsp/
################# #################
## Build Cache ## ## Build Cache ##

View File

@ -3,7 +3,7 @@
// All Scala files should be reformatted through this formatter before being // All Scala files should be reformatted through this formatter before being
// committed to the repositories. // committed to the repositories.
version = "2.6.2" version = "2.7.4"
// Wrapping and Alignment // Wrapping and Alignment
align = most align = most

635
build.sbt
View File

@ -30,7 +30,9 @@ scalaVersion in ThisBuild := scalacVersion
lazy val gatherLicenses = lazy val gatherLicenses =
taskKey[Unit]("Gathers licensing information for relevant dependencies") taskKey[Unit]("Gathers licensing information for relevant dependencies")
gatherLicenses := GatherLicenses.run.value gatherLicenses := {
GatherLicenses.run.value
}
lazy val verifyLicensePackages = lazy val verifyLicensePackages =
taskKey[Unit]( taskKey[Unit](
"Verifies if the license package has been generated, " + "Verifies if the license package has been generated, " +
@ -38,27 +40,27 @@ lazy val verifyLicensePackages =
) )
verifyLicensePackages := GatherLicenses.verifyReports.value verifyLicensePackages := GatherLicenses.verifyReports.value
GatherLicenses.distributions := Seq( GatherLicenses.distributions := Seq(
Distribution( Distribution(
"launcher", "launcher",
file("distribution/launcher/THIRD-PARTY"), file("distribution/launcher/THIRD-PARTY"),
Distribution.sbtProjects(launcher) Distribution.sbtProjects(launcher)
), ),
Distribution( Distribution(
"engine", "engine",
file("distribution/engine/THIRD-PARTY"), file("distribution/engine/THIRD-PARTY"),
Distribution.sbtProjects( Distribution.sbtProjects(
runtime, runtime,
`engine-runner`, `engine-runner`,
`project-manager`, `project-manager`,
`language-server` `language-server`
)
),
Distribution(
"std-lib-Base",
file("distribution/std-lib/Base/THIRD-PARTY"),
Distribution.sbtProjects(`std-bits`)
) )
),
Distribution(
"std-lib-Base",
file("distribution/std-lib/Base/THIRD-PARTY"),
Distribution.sbtProjects(`std-bits`)
) )
)
GatherLicenses.licenseConfigurations := Set("compile") GatherLicenses.licenseConfigurations := Set("compile")
GatherLicenses.configurationRoot := file("tools/legal-review") GatherLicenses.configurationRoot := file("tools/legal-review")
@ -68,7 +70,7 @@ lazy val openLegalReviewReport =
"report in review mode in the browser." "report in review mode in the browser."
) )
openLegalReviewReport := { openLegalReviewReport := {
gatherLicenses.value val _ = gatherLicenses.value
GatherLicenses.runReportServer() GatherLicenses.runReportServer()
} }
@ -82,49 +84,49 @@ Global / onChangedBuildSource := ReloadOnSourceChanges
// ============================================================================ // ============================================================================
javacOptions in ThisBuild ++= Seq( javacOptions in ThisBuild ++= Seq(
"-encoding", // Provide explicit encoding (the next line) "-encoding", // Provide explicit encoding (the next line)
"UTF-8", // Specify character encoding used by Java source files. "UTF-8", // Specify character encoding used by Java source files.
"-deprecation" // Shows a description of each use or override of a deprecated member or class. "-deprecation" // Shows a description of each use or override of a deprecated member or class.
) )
scalacOptions in ThisBuild ++= Seq( scalacOptions in ThisBuild ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs. "-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", // Provide explicit encoding (the next line) "-encoding", // Provide explicit encoding (the next line)
"utf-8", // Specify character encoding used by Scala source files. "utf-8", // Specify character encoding used by Scala source files.
"-explaintypes", // Explain type errors in more detail. "-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly. "-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred "-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application) "-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types "-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views "-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions. "-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. "-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver. "-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error. "-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit. "-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element. "-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures. "-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`. "-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id. "-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit. "-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view. "-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object. "-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds. "-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field. "-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component. "-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope. "-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Xmacro-settings:-logging@org.enso", // Disable the debug logging globally. "-Xmacro-settings:-logging@org.enso", // Disable the debug logging globally.
"-Ywarn-dead-code", // Warn when dead code is identified. "-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined. "-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened. "-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced. "-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused. "-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:locals", // Warn if a local definition is unused. "-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused. "-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused. "-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused. "-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Xfatal-warnings" // Make warnings fatal so they don't make it onto main (use @nowarn for local suppression) "-Xfatal-warnings" // Make warnings fatal so they don't make it onto main (use @nowarn for local suppression)
) )
val jsSettings = Seq( val jsSettings = Seq(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) } scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
@ -391,10 +393,10 @@ lazy val flexer = crossProject(JVMPlatform, JSPlatform)
version := "0.1", version := "0.1",
resolvers += Resolver.sonatypeRepo("releases"), resolvers += Resolver.sonatypeRepo("releases"),
libraryDependencies ++= scalaCompiler ++ Seq( libraryDependencies ++= scalaCompiler ++ Seq(
"com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305"), "com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305"),
"org.typelevel" %%% "cats-core" % catsVersion, "org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "kittens" % kittensVersion "org.typelevel" %%% "kittens" % kittensVersion
) )
) )
.jsSettings(jsSettings) .jsSettings(jsSettings)
@ -406,13 +408,13 @@ lazy val `syntax-definition` = crossProject(JVMPlatform, JSPlatform)
.settings( .settings(
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"), scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"),
libraryDependencies ++= monocle ++ scalaCompiler ++ Seq( libraryDependencies ++= monocle ++ scalaCompiler ++ Seq(
"org.typelevel" %%% "cats-core" % catsVersion, "org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "kittens" % kittensVersion, "org.typelevel" %%% "kittens" % kittensVersion,
"com.lihaoyi" %%% "scalatags" % scalatagsVersion, "com.lihaoyi" %%% "scalatags" % scalatagsVersion,
"io.circe" %%% "circe-core" % circeVersion, "io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion, "io.circe" %%% "circe-generic" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion "io.circe" %%% "circe-parser" % circeVersion
) )
) )
.jsSettings(jsSettings) .jsSettings(jsSettings)
@ -432,21 +434,21 @@ lazy val syntax = crossProject(JVMPlatform, JSPlatform)
version := "0.1", version := "0.1",
logBuffered := false, logBuffered := false,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % scalatestVersion % Test, "org.scalatest" %%% "scalatest" % scalatestVersion % Test,
"com.lihaoyi" %%% "pprint" % pprintVersion, "com.lihaoyi" %%% "pprint" % pprintVersion,
"io.circe" %%% "circe-core" % circeVersion, "io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion, "io.circe" %%% "circe-generic" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion "io.circe" %%% "circe-parser" % circeVersion
), ),
(Compile / compile) := (Compile / compile) (Compile / compile) := (Compile / compile)
.dependsOn(RecompileParser.run(`syntax-definition`)) .dependsOn(RecompileParser.run(`syntax-definition`))
.value, .value,
(Test / compile) := (Test / compile) (Test / compile) := (Test / compile)
.dependsOn(RecompileParser.run(`syntax-definition`)) .dependsOn(RecompileParser.run(`syntax-definition`))
.value, .value,
(Benchmark / compile) := (Benchmark / compile) (Benchmark / compile) := (Benchmark / compile)
.dependsOn(RecompileParser.run(`syntax-definition`)) .dependsOn(RecompileParser.run(`syntax-definition`))
.value .value
) )
.jvmSettings( .jvmSettings(
inConfig(Benchmark)(Defaults.testSettings), inConfig(Benchmark)(Defaults.testSettings),
@ -455,9 +457,9 @@ lazy val syntax = crossProject(JVMPlatform, JSPlatform)
libraryDependencies += libraryDependencies +=
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench", "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
testFrameworks := List( testFrameworks := List(
new TestFramework("org.scalatest.tools.Framework"), new TestFramework("org.scalatest.tools.Framework"),
new TestFramework("org.scalameter.ScalaMeterFramework") new TestFramework("org.scalameter.ScalaMeterFramework")
), ),
bench := (test in Benchmark).tag(Exclusive).value bench := (test in Benchmark).tag(Exclusive).value
) )
.jsSettings( .jsSettings(
@ -479,10 +481,10 @@ lazy val `text-buffer` = project
.configs(Test) .configs(Test)
.settings( .settings(
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsVersion, "org.typelevel" %% "cats-core" % catsVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
) )
) )
lazy val graph = (project in file("lib/scala/graph/")) lazy val graph = (project in file("lib/scala/graph/"))
@ -491,18 +493,18 @@ lazy val graph = (project in file("lib/scala/graph/"))
.settings( .settings(
version := "0.1", version := "0.1",
resolvers ++= Seq( resolvers ++= Seq(
Resolver.sonatypeRepo("releases"), Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots") Resolver.sonatypeRepo("snapshots")
), ),
scalacOptions += "-Ymacro-annotations", scalacOptions += "-Ymacro-annotations",
libraryDependencies ++= scalaCompiler ++ Seq( libraryDependencies ++= scalaCompiler ++ Seq(
"com.chuusai" %% "shapeless" % shapelessVersion, "com.chuusai" %% "shapeless" % shapelessVersion,
"io.estatico" %% "newtype" % newtypeVersion, "io.estatico" %% "newtype" % newtypeVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion, "com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"org.apache.commons" % "commons-lang3" % commonsLangVersion "org.apache.commons" % "commons-lang3" % commonsLangVersion
), ),
addCompilerPlugin( addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full "org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
), ),
@ -517,11 +519,11 @@ lazy val pkg = (project in file("lib/scala/pkg"))
mainClass in (Compile, run) := Some("org.enso.pkg.Main"), mainClass in (Compile, run) := Some("org.enso.pkg.Main"),
version := "0.1", version := "0.1",
libraryDependencies ++= circe ++ Seq( libraryDependencies ++= circe ++ Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"nl.gn0s1s" %% "bump" % bumpVersion, "nl.gn0s1s" %% "bump" % bumpVersion,
"io.circe" %% "circe-yaml" % circeYamlVersion, // separate from other circe deps because its independent project with its own versioning "io.circe" %% "circe-yaml" % circeYamlVersion, // separate from other circe deps because its independent project with its own versioning
"commons-io" % "commons-io" % commonsIoVersion "commons-io" % "commons-io" % commonsIoVersion
) )
) )
lazy val `akka-native` = project lazy val `akka-native` = project
@ -530,8 +532,8 @@ lazy val `akka-native` = project
.settings( .settings(
version := "0.1", version := "0.1",
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
akkaActor akkaActor
), ),
// Note [Native Image Workaround for GraalVM 20.2] // Note [Native Image Workaround for GraalVM 20.2]
libraryDependencies += "org.graalvm.nativeimage" % "svm" % graalVersion % "provided" libraryDependencies += "org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
) )
@ -542,15 +544,15 @@ lazy val `logging-service` = project
.settings( .settings(
version := "0.1", version := "0.1",
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion, "org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
akkaStream, akkaStream,
akkaHttp, akkaHttp,
"io.circe" %%% "circe-core" % circeVersion, "io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion, "io.circe" %%% "circe-parser" % circeVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.graalvm.nativeimage" % "svm" % graalVersion % "provided" "org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
) )
) )
.settings( .settings(
if (Platform.isWindows) if (Platform.isWindows)
@ -566,9 +568,9 @@ lazy val cli = project
.settings( .settings(
version := "0.1", version := "0.1",
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion "org.typelevel" %% "cats-core" % catsVersion
), ),
parallelExecution in Test := false parallelExecution in Test := false
) )
@ -578,16 +580,16 @@ lazy val `version-output` = (project in file("lib/scala/version-output"))
) )
.settings( .settings(
Compile / sourceGenerators += Def.task { Compile / sourceGenerators += Def.task {
val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala" val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala"
BuildInfo BuildInfo
.writeBuildInfoFile( .writeBuildInfoFile(
file, file,
state.value.log, state.value.log,
ensoVersion, ensoVersion,
scalacVersion, scalacVersion,
graalVersion graalVersion
) )
}.taskValue }.taskValue
) )
lazy val `project-manager` = (project in file("lib/scala/project-manager")) lazy val `project-manager` = (project in file("lib/scala/project-manager"))
@ -609,18 +611,18 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
libraryDependencies ++= akka, libraryDependencies ++= akka,
libraryDependencies ++= circe, libraryDependencies ++= circe,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.typesafe" % "config" % typesafeConfigVersion, "com.typesafe" % "config" % typesafeConfigVersion,
"com.github.pureconfig" %% "pureconfig" % pureconfigVersion, "com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"dev.zio" %% "zio" % zioVersion, "dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion, "dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion,
"commons-cli" % "commons-cli" % commonsCliVersion, "commons-cli" % "commons-cli" % commonsCliVersion,
"commons-io" % "commons-io" % commonsIoVersion, "commons-io" % "commons-io" % commonsIoVersion,
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion, "com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
"com.miguno.akka" %% "akka-mock-scheduler" % akkaMockSchedulerVersion % Test, "com.miguno.akka" %% "akka-mock-scheduler" % akkaMockSchedulerVersion % Test,
"org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test "org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test
), ),
addCompilerPlugin( addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full "org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
) )
@ -641,17 +643,17 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager"))
case _ => MergeStrategy.first case _ => MergeStrategy.first
}, },
assemblyOption in assembly := (assemblyOption in assembly).value assemblyOption in assembly := (assemblyOption in assembly).value
.copy( .copy(
prependShellScript = Some( prependShellScript = Some(
defaultUniversalScript( defaultUniversalScript(
shebang = false, shebang = false,
javaOpts = Seq("-Dtruffle.class.path.append=runtime.jar") javaOpts = Seq("-Dtruffle.class.path.append=runtime.jar")
)
) )
), )
),
assembly := assembly assembly := assembly
.dependsOn(runtime / assembly) .dependsOn(runtime / assembly)
.value .value
) )
.dependsOn(`version-output`) .dependsOn(`version-output`)
.dependsOn(pkg) .dependsOn(pkg)
@ -688,10 +690,10 @@ lazy val `json-rpc-server` = project
libraryDependencies ++= akka, libraryDependencies ++= akka,
libraryDependencies ++= circe, libraryDependencies ++= circe,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.circe" %% "circe-literal" % circeVersion, "io.circe" %% "circe-literal" % circeVersion,
akkaTestkit % Test, akkaTestkit % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test "org.scalatest" %% "scalatest" % scalatestVersion % Test
) )
) )
lazy val `json-rpc-server-test` = project lazy val `json-rpc-server-test` = project
@ -700,10 +702,10 @@ lazy val `json-rpc-server-test` = project
libraryDependencies ++= akka, libraryDependencies ++= akka,
libraryDependencies ++= circe, libraryDependencies ++= circe,
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"io.circe" %% "circe-literal" % circeVersion, "io.circe" %% "circe-literal" % circeVersion,
akkaTestkit, akkaTestkit,
"org.scalatest" %% "scalatest" % scalatestVersion "org.scalatest" %% "scalatest" % scalatestVersion
) )
) )
.dependsOn(`json-rpc-server`) .dependsOn(`json-rpc-server`)
@ -711,9 +713,9 @@ lazy val testkit = project
.in(file("lib/scala/testkit")) .in(file("lib/scala/testkit"))
.settings( .settings(
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-lang3" % commonsLangVersion,
"org.scalatest" %% "scalatest" % scalatestVersion "org.scalatest" %% "scalatest" % scalatestVersion
) )
) )
lazy val `core-definition` = (project in file("lib/scala/core-definition")) lazy val `core-definition` = (project in file("lib/scala/core-definition"))
@ -726,13 +728,13 @@ lazy val `core-definition` = (project in file("lib/scala/core-definition"))
logBuffered in Test := false, logBuffered in Test := false,
scalacOptions += "-Ymacro-annotations", scalacOptions += "-Ymacro-annotations",
libraryDependencies ++= jmh ++ Seq( libraryDependencies ++= jmh ++ Seq(
"com.chuusai" %% "shapeless" % shapelessVersion, "com.chuusai" %% "shapeless" % shapelessVersion,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test, "org.scalactic" %% "scalactic" % scalacticVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion, "org.typelevel" %% "cats-core" % catsVersion,
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion "com.github.julien-truffaut" %% "monocle-core" % monocleVersion
), ),
addCompilerPlugin( addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full "org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
), ),
@ -749,11 +751,11 @@ lazy val searcher = project
.configs(Test) .configs(Test)
.settings( .settings(
libraryDependencies ++= jmh ++ Seq( libraryDependencies ++= jmh ++ Seq(
"com.typesafe.slick" %% "slick" % slickVersion, "com.typesafe.slick" %% "slick" % slickVersion,
"org.xerial" % "sqlite-jdbc" % sqliteVersion, "org.xerial" % "sqlite-jdbc" % sqliteVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test, "ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test "org.scalatest" %% "scalatest" % scalatestVersion % Test
) )
) )
.configs(Benchmark) .configs(Benchmark)
.settings( .settings(
@ -796,11 +798,11 @@ lazy val `polyglot-api` = project
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath") Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
}, },
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided", "org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
), ),
libraryDependencies ++= jackson, libraryDependencies ++= jackson,
addCompilerPlugin( addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full "org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
@ -818,23 +820,23 @@ lazy val `polyglot-api` = project
lazy val `language-server` = (project in file("engine/language-server")) lazy val `language-server` = (project in file("engine/language-server"))
.settings( .settings(
libraryDependencies ++= akka ++ circe ++ Seq( libraryDependencies ++= akka ++ circe ++ Seq(
"ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion, "io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
"io.circe" %% "circe-literal" % circeVersion, "io.circe" %% "circe-literal" % circeVersion,
"org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version, "org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version,
"dev.zio" %% "zio" % zioVersion, "dev.zio" %% "zio" % zioVersion,
"io.methvin" % "directory-watcher" % directoryWatcherVersion, "io.methvin" % "directory-watcher" % directoryWatcherVersion,
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion, "com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"commons-io" % "commons-io" % commonsIoVersion, "commons-io" % "commons-io" % commonsIoVersion,
akkaTestkit % Test, akkaTestkit % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided" "org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided"
), ),
testOptions in Test += Tests testOptions in Test += Tests
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
GenerateFlatbuffers.flatcVersion := flatbuffersVersion, GenerateFlatbuffers.flatcVersion := flatbuffersVersion,
sourceGenerators in Compile += GenerateFlatbuffers.task sourceGenerators in Compile += GenerateFlatbuffers.task
) )
@ -844,8 +846,8 @@ lazy val `language-server` = (project in file("engine/language-server"))
bench := (test in Benchmark).value, bench := (test in Benchmark).value,
libraryDependencies += "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench", libraryDependencies += "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
testFrameworks ++= List( testFrameworks ++= List(
new TestFramework("org.scalameter.ScalaMeterFramework") new TestFramework("org.scalameter.ScalaMeterFramework")
) )
) )
.dependsOn(`polyglot-api`) .dependsOn(`polyglot-api`)
.dependsOn(`json-rpc-server`) .dependsOn(`json-rpc-server`)
@ -866,20 +868,20 @@ lazy val parser = (project in file("lib/scala/parser"))
fork := true, fork := true,
Cargo.rustVersion := rustVersion, Cargo.rustVersion := rustVersion,
Compile / compile / compileInputs := (Compile / compile / compileInputs) Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(Cargo("build --project parser")) .dependsOn(Cargo("build --project parser"))
.value, .value,
javaOptions += { javaOptions += {
val root = baseDirectory.value.getParentFile.getParentFile.getParentFile val root = baseDirectory.value.getParentFile.getParentFile.getParentFile
s"-Djava.library.path=$root/target/rust/debug" s"-Djava.library.path=$root/target/rust/debug"
}, },
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench", "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
"org.scalatest" %%% "scalatest" % scalatestVersion % Test "org.scalatest" %%% "scalatest" % scalatestVersion % Test
), ),
testFrameworks := List( testFrameworks := List(
new TestFramework("org.scalatest.tools.Framework"), new TestFramework("org.scalatest.tools.Framework"),
new TestFramework("org.scalameter.ScalaMeterFramework") new TestFramework("org.scalameter.ScalaMeterFramework")
) )
) )
.dependsOn(ast) .dependsOn(ast)
@ -895,48 +897,48 @@ lazy val runtime = (project in file("engine/runtime"))
scalacOptions += "-Ymacro-annotations", scalacOptions += "-Ymacro-annotations",
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"), scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"),
libraryDependencies ++= circe ++ jmh ++ jaxb ++ Seq( libraryDependencies ++= circe ++ jmh ++ jaxb ++ Seq(
"com.chuusai" %% "shapeless" % shapelessVersion, "com.chuusai" %% "shapeless" % shapelessVersion,
"org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-lang3" % commonsLangVersion,
"org.apache.tika" % "tika-core" % tikaVersion, "org.apache.tika" % "tika-core" % tikaVersion,
"org.graalvm.sdk" % "graal-sdk" % graalVersion % "provided", "org.graalvm.sdk" % "graal-sdk" % graalVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided", "org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided", "org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalVersion % "provided", "org.graalvm.truffle" % "truffle-dsl-processor" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-tck" % graalVersion % "provided", "org.graalvm.truffle" % "truffle-tck" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-tck-common" % graalVersion % "provided", "org.graalvm.truffle" % "truffle-tck-common" % graalVersion % "provided",
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test, "org.scalactic" %% "scalactic" % scalacticVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalVersion % Benchmark, "org.graalvm.truffle" % "truffle-api" % graalVersion % Benchmark,
"org.typelevel" %% "cats-core" % catsVersion, "org.typelevel" %% "cats-core" % catsVersion,
"eu.timepit" %% "refined" % refinedVersion "eu.timepit" %% "refined" % refinedVersion
), ),
// Note [Unmanaged Classpath] // Note [Unmanaged Classpath]
Compile / unmanagedClasspath += (`core-definition` / Compile / packageBin).value, Compile / unmanagedClasspath += (`core-definition` / Compile / packageBin).value,
Test / unmanagedClasspath += (`core-definition` / Compile / packageBin).value, Test / unmanagedClasspath += (`core-definition` / Compile / packageBin).value,
Compile / compile / compileInputs := (Compile / compile / compileInputs) Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(CopyTruffleJAR.preCompileTask) .dependsOn(CopyTruffleJAR.preCompileTask)
.value, .value,
Compile / compile := FixInstrumentsGeneration.patchedCompile Compile / compile := FixInstrumentsGeneration.patchedCompile
.dependsOn(FixInstrumentsGeneration.preCompileTask) .dependsOn(FixInstrumentsGeneration.preCompileTask)
.dependsOn(`core-definition` / Compile / packageBin) .dependsOn(`core-definition` / Compile / packageBin)
.value, .value,
// Note [Classpath Separation] // Note [Classpath Separation]
Test / javaOptions ++= Seq( Test / javaOptions ++= Seq(
"-Dgraalvm.locatorDisabled=true", "-Dgraalvm.locatorDisabled=true",
s"--upgrade-module-path=${file("engine/runtime/build-cache/truffle-api.jar").absolutePath}" s"--upgrade-module-path=${file("engine/runtime/build-cache/truffle-api.jar").absolutePath}"
), ),
bootstrap := CopyTruffleJAR.bootstrapJARs.value, bootstrap := CopyTruffleJAR.bootstrapJARs.value,
Global / onLoad := EnvironmentCheck.addVersionCheck( Global / onLoad := EnvironmentCheck.addVersionCheck(
graalVersion, graalVersion,
javaVersion javaVersion
)((Global / onLoad).value) )((Global / onLoad).value)
) )
.settings( .settings(
(Compile / javacOptions) ++= Seq( (Compile / javacOptions) ++= Seq(
"-s", "-s",
(Compile / sourceManaged).value.getAbsolutePath (Compile / sourceManaged).value.getAbsolutePath
), ),
addCompilerPlugin( addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full "org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
), ),
@ -947,27 +949,26 @@ lazy val runtime = (project in file("engine/runtime"))
) )
.settings( .settings(
(Compile / compile) := (Compile / compile) (Compile / compile) := (Compile / compile)
.dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs }) .dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs })
.value .value
) )
.settings( .settings(
(Runtime / compile) := (Runtime / compile) (Runtime / compile) := (Runtime / compile)
.dependsOn(`std-bits` / Compile / packageBin) .dependsOn(`std-bits` / Compile / packageBin)
.value .value
) )
.settings( .settings(
logBuffered := false,
bench := (test in Benchmark).tag(Exclusive).value, bench := (test in Benchmark).tag(Exclusive).value,
benchOnly := Def.inputTaskDyn { benchOnly := Def.inputTaskDyn {
import complete.Parsers.spaceDelimited import complete.Parsers.spaceDelimited
val name = spaceDelimited("<name>").parsed match { val name = spaceDelimited("<name>").parsed match {
case List(name) => name case List(name) => name
case _ => throw new IllegalArgumentException("Expected one argument.") case _ => throw new IllegalArgumentException("Expected one argument.")
} }
Def.task { Def.task {
(testOnly in Benchmark).toTask(" -- -z " + name).value (testOnly in Benchmark).toTask(" -- -z " + name).value
} }
}.evaluated, }.evaluated,
parallelExecution in Benchmark := false parallelExecution in Benchmark := false
) )
.settings( .settings(
@ -1038,40 +1039,40 @@ lazy val `engine-runner` = project
MergeStrategy.first MergeStrategy.first
}, },
assemblyOption in assembly := (assemblyOption in assembly).value assemblyOption in assembly := (assemblyOption in assembly).value
.copy( .copy(
prependShellScript = Some( prependShellScript = Some(
defaultUniversalScript( defaultUniversalScript(
shebang = false, shebang = false,
javaOpts = truffleRunOptions ++ javaOpts = truffleRunOptions ++
Seq("-Dtruffle.class.path.append=runtime.jar") Seq("-Dtruffle.class.path.append=runtime.jar")
)
) )
), )
),
commands += WithDebugCommand.withDebug, commands += WithDebugCommand.withDebug,
inConfig(Compile)(truffleRunOptionsSettings), inConfig(Compile)(truffleRunOptionsSettings),
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided", "org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided", "org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
"commons-cli" % "commons-cli" % commonsCliVersion, "commons-cli" % "commons-cli" % commonsCliVersion,
"com.monovore" %% "decline" % declineVersion, "com.monovore" %% "decline" % declineVersion,
"org.jline" % "jline" % jlineVersion, "org.jline" % "jline" % jlineVersion,
"org.typelevel" %% "cats-core" % catsVersion "org.typelevel" %% "cats-core" % catsVersion
), ),
connectInput in run := true connectInput in run := true
) )
.settings( .settings(
buildNativeImage := NativeImage buildNativeImage := NativeImage
.buildNativeImage( .buildNativeImage(
"enso", "enso",
staticOnLinux = false, staticOnLinux = false,
Seq("-H:IncludeResources=.*Main.enso$") Seq("-H:IncludeResources=.*Main.enso$")
) )
.value .value
) )
.settings( .settings(
assembly := assembly assembly := assembly
.dependsOn(runtime / assembly) .dependsOn(runtime / assembly)
.value .value
) )
.dependsOn(`version-output`) .dependsOn(`version-output`)
.dependsOn(pkg) .dependsOn(pkg)
@ -1085,48 +1086,48 @@ lazy val launcher = project
.settings( .settings(
resolvers += Resolver.bintrayRepo("gn0s1s", "releases"), resolvers += Resolver.bintrayRepo("gn0s1s", "releases"),
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.typelevel" %% "cats-core" % catsVersion, "org.typelevel" %% "cats-core" % catsVersion,
"nl.gn0s1s" %% "bump" % bumpVersion, "nl.gn0s1s" %% "bump" % bumpVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test,
akkaHttp, akkaHttp,
akkaSLF4J akkaSLF4J
) )
) )
.settings( .settings(
buildNativeImage := NativeImage buildNativeImage := NativeImage
.buildNativeImage( .buildNativeImage(
"enso", "enso",
staticOnLinux = true, staticOnLinux = true,
Seq( Seq(
"-J-Xmx4G", "-J-Xmx4G",
"--enable-all-security-services", // Note [HTTPS in the Launcher] "--enable-all-security-services", // Note [HTTPS in the Launcher]
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog", "-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$", "-H:IncludeResources=.*Main.enso$",
"--initialize-at-run-time=" + "--initialize-at-run-time=" +
"akka.protobuf.DescriptorProtos," + "akka.protobuf.DescriptorProtos," +
"com.typesafe.config.impl.ConfigImpl$EnvVariablesHolder," + "com.typesafe.config.impl.ConfigImpl$EnvVariablesHolder," +
"com.typesafe.config.impl.ConfigImpl$SystemPropertiesHolder," + "com.typesafe.config.impl.ConfigImpl$SystemPropertiesHolder," +
"org.enso.loggingservice.WSLoggerManager$" // Note [WSLoggerManager Shutdown Hook] "org.enso.loggingservice.WSLoggerManager$" // Note [WSLoggerManager Shutdown Hook]
)
) )
.value, )
.value,
test in assembly := {}, test in assembly := {},
assemblyOutputPath in assembly := file("launcher.jar") assemblyOutputPath in assembly := file("launcher.jar")
) )
.settings( .settings(
(Test / test) := (Test / test) (Test / test) := (Test / test)
.dependsOn( .dependsOn(
NativeImage.incrementalNativeImageBuild( NativeImage.incrementalNativeImageBuild(
buildNativeImage, buildNativeImage,
"enso" "enso"
)
) )
.dependsOn( )
LauncherShimsForTest.prepare(rustcVersion = rustVersion) .dependsOn(
) LauncherShimsForTest.prepare(rustcVersion = rustVersion)
.value, )
.value,
parallelExecution in Test := false parallelExecution in Test := false
) )
.dependsOn(cli) .dependsOn(cli)
@ -1144,19 +1145,19 @@ lazy val `std-bits` = project
Compile / packageBin / artifactPath := Compile / packageBin / artifactPath :=
`std-lib-polyglot-root` / "std-bits.jar", `std-lib-polyglot-root` / "std-bits.jar",
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"com.ibm.icu" % "icu4j" % icuVersion "com.ibm.icu" % "icu4j" % icuVersion
), ),
Compile / packageBin := Def.task { Compile / packageBin := Def.task {
val result = (Compile / packageBin).value val result = (Compile / packageBin).value
StdBits StdBits
.copyDependencies( .copyDependencies(
`std-lib-polyglot-root`, `std-lib-polyglot-root`,
"std-bits.jar", "std-bits.jar",
ignoreScalaLibrary = true ignoreScalaLibrary = true
) )
.value .value
result result
}.value }.value
) )
/* Note [HTTPS in the Launcher] /* Note [HTTPS in the Launcher]

View File

@ -1,16 +1,16 @@
<configuration> <configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type <!-- encoders are assigned the type
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder> <encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level [%-15thread] %-36logger{36} %msg%n</pattern> <pattern>%d{HH:mm:ss.SSS} %-5level [%-15thread] %-36logger{36} %msg%n</pattern>
</encoder> </encoder>
</appender> </appender>
<logger name="org.enso" level="TRACE"/> <logger name="org.enso" level="TRACE"/>
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT"/>
</root> </root>
</configuration> </configuration>

View File

@ -18,8 +18,7 @@ import org.enso.languageserver.runtime.RuntimeKiller.{
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.concurrent.{Await, Future} import scala.concurrent.{Await, Future}
/** /** A lifecycle component used to start and stop a Language Server.
* A lifecycle component used to start and stop a Language Server.
* *
* @param config a LS config * @param config a LS config
*/ */
@ -124,16 +123,15 @@ class LanguageServerComponent(config: LanguageServerConfig)
_ <- start() _ <- start()
} yield ComponentRestarted } yield ComponentRestarted
private val logError: PartialFunction[Throwable, Unit] = { private val logError: PartialFunction[Throwable, Unit] = { case th =>
case th => logger.error("An error occurred during stopping server", th) logger.error("An error occurred during stopping server", th)
} }
} }
object LanguageServerComponent { object LanguageServerComponent {
/** /** A running server context.
* A running server context.
* *
* @param mainModule a main module containing all components of the server * @param mainModule a main module containing all components of the server
* @param jsonBinding a http binding for rpc protocol * @param jsonBinding a http binding for rpc protocol

View File

@ -4,8 +4,7 @@ import java.util.UUID
import scala.concurrent.ExecutionContext import scala.concurrent.ExecutionContext
/** /** The config of the running Language Server instance.
* The config of the running Language Server instance.
* *
* @param interface a interface that the server listen to * @param interface a interface that the server listen to
* @param rpcPort a rpc port that the server listen to * @param rpcPort a rpc port that the server listen to

View File

@ -8,27 +8,23 @@ import org.enso.languageserver.boot.LifecycleComponent.{
import scala.concurrent.Future import scala.concurrent.Future
/** /** An abstraction for components that can be started and stopped.
* An abstraction for components that can be started and stopped.
*/ */
trait LifecycleComponent { trait LifecycleComponent {
/** /** Starts asynchronously a server.
* Starts asynchronously a server.
* *
* @return a notice that the server started successfully * @return a notice that the server started successfully
*/ */
def start(): Future[ComponentStarted.type] def start(): Future[ComponentStarted.type]
/** /** Stops asynchronously a server.
* Stops asynchronously a server.
* *
* @return a notice that the server stopped successfully * @return a notice that the server stopped successfully
*/ */
def stop(): Future[ComponentStopped.type] def stop(): Future[ComponentStopped.type]
/** /** Restarts asynchronously a server.
* Restarts asynchronously a server.
* *
* @return a notice that the server restarted successfully * @return a notice that the server restarted successfully
*/ */
@ -38,18 +34,15 @@ trait LifecycleComponent {
object LifecycleComponent { object LifecycleComponent {
/** /** Signals that component was started.
* Signals that component was started.
*/ */
case object ComponentStarted case object ComponentStarted
/** /** Signals that component was stopped.
* Signals that component was stopped.
*/ */
case object ComponentStopped case object ComponentStopped
/** /** Signals that component was restarted.
* Signals that component was restarted.
*/ */
case object ComponentRestarted case object ComponentRestarted

View File

@ -41,8 +41,7 @@ import scala.concurrent.Future
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.util.{Failure, Success} import scala.util.{Failure, Success}
/** /** A main module containing all components of the server.
* A main module containing all components of the server.
* *
* @param serverConfig configuration for the language server * @param serverConfig configuration for the language server
*/ */

View File

@ -3,8 +3,7 @@ package org.enso.languageserver.capability
import org.enso.languageserver.data.CapabilityRegistration import org.enso.languageserver.data.CapabilityRegistration
import org.enso.jsonrpc.{Error, HasParams, HasResult, Method, Unused} import org.enso.jsonrpc.{Error, HasParams, HasResult, Method, Unused}
/** /** The capability JSON RPC API provided by the language server.
* The capability JSON RPC API provided by the language server.
* See [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]] * See [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]]
* for message specifications. * for message specifications.
*/ */

View File

@ -6,8 +6,7 @@ import org.enso.languageserver.session.JsonSession
object CapabilityProtocol { object CapabilityProtocol {
/** /** Requests the Language Server grant a new capability to a client.
* Requests the Language Server grant a new capability to a client.
* *
* @param rpcSession the client to grant the capability to. * @param rpcSession the client to grant the capability to.
* @param registration the capability to grant. * @param registration the capability to grant.
@ -17,31 +16,26 @@ object CapabilityProtocol {
registration: CapabilityRegistration registration: CapabilityRegistration
) )
/** /** Signals capability acquisition status.
* Signals capability acquisition status.
*/ */
sealed trait AcquireCapabilityResponse sealed trait AcquireCapabilityResponse
/** /** Confirms client that capability has been acquired.
* Confirms client that capability has been acquired.
*/ */
case object CapabilityAcquired extends AcquireCapabilityResponse case object CapabilityAcquired extends AcquireCapabilityResponse
/** /** Signals that capability acquisition request cannot be processed.
* Signals that capability acquisition request cannot be processed.
*/ */
case object CapabilityAcquisitionBadRequest extends AcquireCapabilityResponse case object CapabilityAcquisitionBadRequest extends AcquireCapabilityResponse
/** /** Signals about capability acquisition error.
* Signals about capability acquisition error.
* *
* @param error file system failure * @param error file system failure
*/ */
case class CapabilityAcquisitionFileSystemFailure(error: FileSystemFailure) case class CapabilityAcquisitionFileSystemFailure(error: FileSystemFailure)
extends AcquireCapabilityResponse extends AcquireCapabilityResponse
/** /** Notifies the Language Server about a client releasing a capability.
* Notifies the Language Server about a client releasing a capability.
* *
* @param rpcSession the client releasing the capability. * @param rpcSession the client releasing the capability.
* @param capability the capability being released. * @param capability the capability being released.
@ -51,36 +45,30 @@ object CapabilityProtocol {
capability: CapabilityRegistration capability: CapabilityRegistration
) )
/** /** Signals capability release status.
* Signals capability release status.
*/ */
sealed trait ReleaseCapabilityResponse sealed trait ReleaseCapabilityResponse
/** /** Confirms client that capability has been released.
* Confirms client that capability has been released.
*/ */
case object CapabilityReleased extends ReleaseCapabilityResponse case object CapabilityReleased extends ReleaseCapabilityResponse
/** /** Signals that capability release request cannot be processed.
* Signals that capability release request cannot be processed.
*/ */
case object CapabilityReleaseBadRequest extends ReleaseCapabilityResponse case object CapabilityReleaseBadRequest extends ReleaseCapabilityResponse
/** /** Signals that requested capability is not acquired.
* Signals that requested capability is not acquired.
*/ */
case object CapabilityNotAcquiredResponse extends ReleaseCapabilityResponse case object CapabilityNotAcquiredResponse extends ReleaseCapabilityResponse
/** /** A notification sent by the Language Server, notifying a client about
* A notification sent by the Language Server, notifying a client about
* a capability being taken away from them. * a capability being taken away from them.
* *
* @param capability the capability being released. * @param capability the capability being released.
*/ */
case class CapabilityForceReleased(capability: CapabilityRegistration) case class CapabilityForceReleased(capability: CapabilityRegistration)
/** /** A notification sent by the Language Server, notifying a client about a new
* A notification sent by the Language Server, notifying a client about a new
* capability being granted to them. * capability being granted to them.
* *
* @param registration the capability being granted. * @param registration the capability being granted.

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.data.{
import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong}
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A content based router that routes each capability request to the
* A content based router that routes each capability request to the
* correct recipient based on the capability object. * correct recipient based on the capability object.
* *
* @param bufferRegistry the recipient of buffer capability requests * @param bufferRegistry the recipient of buffer capability requests
@ -71,8 +70,7 @@ class CapabilityRouter(
object CapabilityRouter { object CapabilityRouter {
/** /** Creates a configuration object used to create a [[CapabilityRouter]]
* Creates a configuration object used to create a [[CapabilityRouter]]
* *
* @param bufferRegistry a buffer registry ref * @param bufferRegistry a buffer registry ref
* @param receivesTreeUpdatesHandler the recipient of `receivesTreeUpdates` * @param receivesTreeUpdatesHandler the recipient of `receivesTreeUpdates`

View File

@ -5,15 +5,13 @@ import io.circe._
import org.enso.languageserver.filemanager.Path import org.enso.languageserver.filemanager.Path
import org.enso.languageserver.runtime.ExecutionApi.ContextId import org.enso.languageserver.runtime.ExecutionApi.ContextId
/** /** A superclass for all capabilities in the system.
* A superclass for all capabilities in the system.
* @param method method name used to identify the capability. * @param method method name used to identify the capability.
*/ */
sealed abstract class Capability(val method: String) sealed abstract class Capability(val method: String)
//TODO[MK]: Migrate to actual Path, once it is implemented. //TODO[MK]: Migrate to actual Path, once it is implemented.
/** /** A capability allowing the user to modify a given file.
* A capability allowing the user to modify a given file.
* @param path the file path this capability is granted for. * @param path the file path this capability is granted for.
*/ */
case class CanEdit(path: Path) extends Capability(CanEdit.methodName) case class CanEdit(path: Path) extends Capability(CanEdit.methodName)
@ -22,8 +20,7 @@ object CanEdit {
val methodName = "text/canEdit" val methodName = "text/canEdit"
} }
/** /** A capability allowing user to receive file events.
* A capability allowing user to receive file events.
* *
* @param path path to watch. * @param path path to watch.
*/ */
@ -34,8 +31,7 @@ object ReceivesTreeUpdates {
val methodName = "file/receivesTreeUpdates" val methodName = "file/receivesTreeUpdates"
} }
/** /** A capability allowing user to modify the execution context.
* A capability allowing user to modify the execution context.
* *
* @param contextId identifier of an execution conatext * @param contextId identifier of an execution conatext
*/ */
@ -46,8 +42,7 @@ object CanModify {
val methodName = "executionContext/canModify" val methodName = "executionContext/canModify"
} }
/** /** A capability allowing user to receive events from the execution context.
* A capability allowing user to receive events from the execution context.
* *
* @param contextId identifier of an execution conatext * @param contextId identifier of an execution conatext
*/ */
@ -79,8 +74,7 @@ object ReceivesSuggestionsDatabaseUpdates {
val methodName = "search/receivesSuggestionsDatabaseUpdates" val methodName = "search/receivesSuggestionsDatabaseUpdates"
} }
/** /** A capability registration object, used to identify acquired capabilities.
* A capability registration object, used to identify acquired capabilities.
* *
* @param capability the registered capability. * @param capability the registered capability.
*/ */

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.filemanager.{
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.util.Try import scala.util.Try
/** /** Configuration of the path watcher.
* Configuration of the path watcher.
* *
* @param timeout path watcher operations timeout * @param timeout path watcher operations timeout
* @param restartTimeout timeout before watcher is restarted on error * @param restartTimeout timeout before watcher is restarted on error
@ -29,8 +28,7 @@ case class PathWatcherConfig(
object PathWatcherConfig { object PathWatcherConfig {
/** /** Default path watcher config.
* Default path watcher config.
*/ */
def apply(): PathWatcherConfig = def apply(): PathWatcherConfig =
PathWatcherConfig( PathWatcherConfig(
@ -40,8 +38,7 @@ object PathWatcherConfig {
) )
} }
/** /** Configuration of the file manager.
* Configuration of the file manager.
* *
* @param timeout IO operation timeout * @param timeout IO operation timeout
* @param parallelism number of processes working with the file system * @param parallelism number of processes working with the file system
@ -50,8 +47,7 @@ case class FileManagerConfig(timeout: FiniteDuration, parallelism: Int)
object FileManagerConfig { object FileManagerConfig {
/** /** Default file manager config.
* Default file manager config.
* *
* @param timeout IO operation timeout * @param timeout IO operation timeout
*/ */
@ -62,8 +58,7 @@ object FileManagerConfig {
) )
} }
/** /** Configuration of the execution context.
* Configuration of the execution context.
* *
* @param requestTimeout timeout of requests to the engine * @param requestTimeout timeout of requests to the engine
*/ */
@ -71,8 +66,7 @@ case class ExecutionContextConfig(requestTimeout: FiniteDuration)
object ExecutionContextConfig { object ExecutionContextConfig {
/** /** Default execution context config.
* Default execution context config.
*/ */
def apply(): ExecutionContextConfig = def apply(): ExecutionContextConfig =
ExecutionContextConfig( ExecutionContextConfig(
@ -80,8 +74,7 @@ object ExecutionContextConfig {
) )
} }
/** /** Configuration of directories for storing internal files.
* Configuration of directories for storing internal files.
* *
* @param root the root directory path * @param root the root directory path
*/ */
@ -103,8 +96,7 @@ object DirectoriesConfig {
val DataDirectory: String = ".enso" val DataDirectory: String = ".enso"
val SuggestionsDatabaseFile: String = "suggestions.db" val SuggestionsDatabaseFile: String = "suggestions.db"
/** /** Create default data directory config
* Create default data directory config
* *
* @param root the root directory path * @param root the root directory path
* @return default data directory config * @return default data directory config
@ -113,8 +105,7 @@ object DirectoriesConfig {
new DirectoriesConfig(new File(root)) new DirectoriesConfig(new File(root))
} }
/** /** The config of the running Language Server instance.
* The config of the running Language Server instance.
* *
* @param contentRoots a mapping between content root id and absolute path to * @param contentRoots a mapping between content root id and absolute path to
* the content root * the content root
@ -137,13 +128,12 @@ case class Config(
.toRight(ContentRootNotFound) .toRight(ContentRootNotFound)
def findRelativePath(path: File): Option[Path] = def findRelativePath(path: File): Option[Path] =
contentRoots.view.flatMap { contentRoots.view.flatMap { case (id, root) =>
case (id, root) => if (path.toPath.startsWith(root.toPath)) {
if (path.toPath.startsWith(root.toPath)) { Some(Path(id, root.toPath.relativize(path.toPath)))
Some(Path(id, root.toPath.relativize(path.toPath))) } else {
} else { None
None }
}
}.headOption }.headOption
} }

View File

@ -1,20 +1,17 @@
package org.enso.languageserver.data package org.enso.languageserver.data
/** /** A content-based versioning calculator.
* A content-based versioning calculator.
*/ */
trait ContentBasedVersioning { trait ContentBasedVersioning {
/** /** Evaluates content-based version of document.
* Evaluates content-based version of document.
* *
* @param content a textual content * @param content a textual content
* @return a string representation of a digest * @return a string representation of a digest
*/ */
def evalVersion(content: String): String def evalVersion(content: String): String
/** /** Evaluates content-based version of document.
* Evaluates content-based version of document.
* *
* @param content a textual content * @param content a textual content
* @return a digest * @return a digest

View File

@ -3,8 +3,7 @@ package org.enso.languageserver.data
import org.bouncycastle.jcajce.provider.digest.SHA3 import org.bouncycastle.jcajce.provider.digest.SHA3
import org.bouncycastle.util.encoders.Hex import org.bouncycastle.util.encoders.Hex
/** /** SHA3-224 digest calculator.
* SHA3-224 digest calculator.
*/ */
object Sha3_224VersionCalculator extends ContentBasedVersioning { object Sha3_224VersionCalculator extends ContentBasedVersioning {

View File

@ -4,8 +4,7 @@ import java.util.UUID
package object data { package object data {
/** /** A type representing the internal id of a client.
* A type representing the internal id of a client.
*/ */
type ClientId = UUID type ClientId = UUID

View File

@ -8,21 +8,18 @@ import zio.blocking.blocking
import scala.concurrent.{Future, Promise} import scala.concurrent.{Future, Promise}
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** Abstract entity that executes effects `F`.
* Abstract entity that executes effects `F`.
*/ */
trait Exec[-F[_, _]] { trait Exec[-F[_, _]] {
/** /** Execute Zio effect.
* Execute Zio effect.
* *
* @param op effect to execute * @param op effect to execute
* @return a future containing either a failure or a result * @return a future containing either a failure or a result
*/ */
def exec[E, A](op: F[E, A]): Future[Either[E, A]] def exec[E, A](op: F[E, A]): Future[Either[E, A]]
/** /** Execute Zio effect with timeout.
* Execute Zio effect with timeout.
* *
* @param timeout execution timeout * @param timeout execution timeout
* @param op effect to execute * @param op effect to execute
@ -33,23 +30,20 @@ trait Exec[-F[_, _]] {
op: F[E, A] op: F[E, A]
): Future[Either[E, A]] ): Future[Either[E, A]]
/** /** Execute long running task in background.
* Execute long running task in background.
* *
* @param op effect to execute * @param op effect to execute
*/ */
def exec_[E, A](op: F[E, A]): Unit def exec_[E, A](op: F[E, A]): Unit
} }
/** /** Executor of Zio effects.
* Executor of Zio effects.
* *
* @param runtime zio runtime * @param runtime zio runtime
*/ */
case class ZioExec(runtime: Runtime[ZEnv]) extends Exec[ZioExec.IO] { case class ZioExec(runtime: Runtime[ZEnv]) extends Exec[ZioExec.IO] {
/** /** Execute Zio effect.
* Execute Zio effect.
* *
* @param op effect to execute * @param op effect to execute
* @return a future containing either a failure or a result * @return a future containing either a failure or a result
@ -65,8 +59,7 @@ case class ZioExec(runtime: Runtime[ZEnv]) extends Exec[ZioExec.IO] {
promise.future promise.future
} }
/** /** Execute Zio effect with timeout.
* Execute Zio effect with timeout.
* *
* @param timeout execution timeout * @param timeout execution timeout
* @param op effect to execute * @param op effect to execute
@ -91,8 +84,7 @@ case class ZioExec(runtime: Runtime[ZEnv]) extends Exec[ZioExec.IO] {
promise.future promise.future
} }
/** /** Execute long running task in background.
* Execute long running task in background.
* *
* @param op effect to execute * @param op effect to execute
*/ */

View File

@ -2,20 +2,17 @@ package org.enso.languageserver.event
import org.enso.languageserver.filemanager.Path import org.enso.languageserver.filemanager.Path
/** /** Base trait for all buffer events.
* Base trait for all buffer events.
*/ */
sealed trait BufferEvent extends Event sealed trait BufferEvent extends Event
/** /** Notifies the Language Server when new file is opened for editing.
* Notifies the Language Server when new file is opened for editing.
* *
* @param path the path to a file * @param path the path to a file
*/ */
case class BufferOpened(path: Path) extends BufferEvent case class BufferOpened(path: Path) extends BufferEvent
/** /** Notifies the Language Server when a file is closed for editing.
* Notifies the Language Server when a file is closed for editing.
* *
* @param path the path to a file * @param path the path to a file
*/ */

View File

@ -1,6 +1,5 @@
package org.enso.languageserver.event package org.enso.languageserver.event
/** /** Base trait for all server events.
* Base trait for all server events.
*/ */
trait Event trait Event

View File

@ -4,13 +4,11 @@ import java.util.UUID
import org.enso.languageserver.data.ClientId import org.enso.languageserver.data.ClientId
/** /** Base trait for all execution context events.
* Base trait for all execution context events.
*/ */
sealed trait ExecutionContextEvent extends Event sealed trait ExecutionContextEvent extends Event
/** /** Notifies the Language Server about a new execution context.
* Notifies the Language Server about a new execution context.
* *
* @param contextId the id of newly created context * @param contextId the id of newly created context
* @param owner the id of the owner of the context * @param owner the id of the owner of the context
@ -18,8 +16,7 @@ sealed trait ExecutionContextEvent extends Event
case class ExecutionContextCreated(contextId: UUID, owner: ClientId) case class ExecutionContextCreated(contextId: UUID, owner: ClientId)
extends ExecutionContextEvent extends ExecutionContextEvent
/** /** Notifies the Language Server about a termination of an execution context.
* Notifies the Language Server about a termination of an execution context.
* *
* @param contextId the id of terminated context * @param contextId the id of terminated context
* @param owner the id of the owner of the context * @param owner the id of the owner of the context

View File

@ -2,35 +2,30 @@ package org.enso.languageserver.event
import org.enso.languageserver.session.{BinarySession, JsonSession} import org.enso.languageserver.session.{BinarySession, JsonSession}
/** /** Base trait for all session events.
* Base trait for all session events.
*/ */
sealed trait SessionEvent extends Event sealed trait SessionEvent extends Event
/** /** Notifies the Language Server about a new rpc session.
* Notifies the Language Server about a new rpc session.
* *
* @param session an object representing a client session * @param session an object representing a client session
*/ */
case class JsonSessionInitialized(session: JsonSession) extends SessionEvent case class JsonSessionInitialized(session: JsonSession) extends SessionEvent
/** /** Notifies the Language Server about a client disconnecting rpc session.
* Notifies the Language Server about a client disconnecting rpc session.
* The client may not send any further messages after this one. * The client may not send any further messages after this one.
* *
* @param session an object representing a client session * @param session an object representing a client session
*/ */
case class JsonSessionTerminated(session: JsonSession) extends SessionEvent case class JsonSessionTerminated(session: JsonSession) extends SessionEvent
/** /** Notifies the Language Server about a new data session.
* Notifies the Language Server about a new data session.
* *
* @param session an object representing a client session * @param session an object representing a client session
*/ */
case class BinarySessionInitialized(session: BinarySession) extends SessionEvent case class BinarySessionInitialized(session: BinarySession) extends SessionEvent
/** /** Notifies the Language Server about a client disconnecting data session.
* Notifies the Language Server about a client disconnecting data session.
* The client may not send any further messages after this one. * The client may not send any further messages after this one.
* *
* @param session an object representing a client session * @param session an object representing a client session

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.filemanager
import java.io.File import java.io.File
/** /** A representation of tree structures of files and directories.
* A representation of tree structures of files and directories.
* *
* @param path to the directory * @param path to the directory
* @param name of the directory * @param name of the directory
@ -19,8 +18,7 @@ case class DirectoryTree(
object DirectoryTree { object DirectoryTree {
/** /** Create [[DirectoryTree]] from [[FileSystemApi.DirectoryEntry]]
* Create [[DirectoryTree]] from [[FileSystemApi.DirectoryEntry]]
* converting absolute pathes to ones relative to project root. * converting absolute pathes to ones relative to project root.
* *
* @param root path to the project root * @param root path to the project root

View File

@ -3,8 +3,7 @@ package org.enso.languageserver.filemanager
import java.io.File import java.io.File
import java.time.OffsetDateTime import java.time.OffsetDateTime
/** /** A representation of the attributes of a file.
* A representation of the attributes of a file.
* *
* @param creationTime creation time * @param creationTime creation time
* @param lastAccessTime last access time * @param lastAccessTime last access time
@ -25,8 +24,7 @@ case class FileAttributes(
object FileAttributes { object FileAttributes {
/** /** Create attributes from filesystem attributes [[FileSystemApi.Attributes]].
* Create attributes from filesystem attributes [[FileSystemApi.Attributes]].
* *
* @param root a root path * @param root a root path
* @param path a path to the file system object * @param path a path to the file system object

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.filemanager
import org.enso.languageserver.event.Event import org.enso.languageserver.event.Event
/** /** A notification about successful file deletion action
* A notification about successful file deletion action
* *
* @param file the deleted file * @param file the deleted file
*/ */

View File

@ -4,8 +4,7 @@ import java.io.File
import enumeratum._ import enumeratum._
/** /** A representation of filesystem event.
* A representation of filesystem event.
* *
* @param path path to the file system object * @param path path to the file system object
* @param kind type of file system event * @param kind type of file system event
@ -14,8 +13,7 @@ case class FileEvent(path: Path, kind: FileEventKind)
object FileEvent { object FileEvent {
/** /** Conversion from file system event.
* Conversion from file system event.
* *
* @param root a project root * @param root a project root
* @param base a watched path * @param base a watched path
@ -33,32 +31,27 @@ object FileEvent {
) )
} }
/** /** Type of a file event.
* Type of a file event.
*/ */
sealed trait FileEventKind extends EnumEntry sealed trait FileEventKind extends EnumEntry
object FileEventKind extends Enum[FileEventKind] with CirceEnum[FileEventKind] { object FileEventKind extends Enum[FileEventKind] with CirceEnum[FileEventKind] {
/** /** Event type indicating file creation.
* Event type indicating file creation.
*/ */
case object Added extends FileEventKind case object Added extends FileEventKind
/** /** Event type indicating file deletion.
* Event type indicating file deletion.
*/ */
case object Removed extends FileEventKind case object Removed extends FileEventKind
/** /** Event type indicating file modification.
* Event type indicating file modification.
*/ */
case object Modified extends FileEventKind case object Modified extends FileEventKind
override val values = findValues override val values = findValues
/** /** Create [[FileEventKind]] from [[WatcherAdapter.EventType]].
* Create [[FileEventKind]] from [[WatcherAdapter.EventType]].
* *
* @param eventType file system event type * @param eventType file system event type
* @return file event kind * @return file event kind

View File

@ -9,8 +9,7 @@ import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong}
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
import zio._ import zio._
/** /** Handles the [[FileManagerProtocol]] messages, executes the [[FileSystem]]
* Handles the [[FileManagerProtocol]] messages, executes the [[FileSystem]]
* effects and forms the responses. * effects and forms the responses.
* *
* @param config configuration * @param config configuration
@ -96,7 +95,7 @@ class FileManager(
() ()
case FileManagerProtocol.CreateFile( case FileManagerProtocol.CreateFile(
FileSystemObject.Directory(name, path) FileSystemObject.Directory(name, path)
) => ) =>
val result = val result =
for { for {

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.filemanager
import org.enso.jsonrpc.{Error, HasParams, HasResult, Method, Unused} import org.enso.jsonrpc.{Error, HasParams, HasResult, Method, Unused}
/** /** The file manager JSON RPC API provided by the language server.
* The file manager JSON RPC API provided by the language server.
* See [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]] * See [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]]
* for message specifications. * for message specifications.
*/ */

View File

@ -5,73 +5,63 @@ import java.util.UUID
object FileManagerProtocol { object FileManagerProtocol {
/** /** Transfer object containing textual contents of the file with its path.
* Transfer object containing textual contents of the file with its path.
* *
* @param path a path to a file * @param path a path to a file
* @param content the textual contents * @param content the textual contents
*/ */
case class TextualFileContent(path: File, content: String) case class TextualFileContent(path: File, content: String)
/** /** Transfer object containing binary contents of the file with its path.
* Transfer object containing binary contents of the file with its path.
* *
* @param path a path to a file * @param path a path to a file
* @param contents the binary contents * @param contents the binary contents
*/ */
case class BinaryFileContent(path: File, contents: Array[Byte]) case class BinaryFileContent(path: File, contents: Array[Byte])
/** /** Gets all content roots.
* Gets all content roots.
*/ */
case object GetContentRoots case object GetContentRoots
/** /** Response containing all content roots.
* Response containing all content roots.
* *
* @param contentRoots content roots * @param contentRoots content roots
*/ */
case class ContentRootsResult(contentRoots: Set[UUID]) case class ContentRootsResult(contentRoots: Set[UUID])
/** /** Requests the Language Server write textual content to an arbitrary file.
* Requests the Language Server write textual content to an arbitrary file.
* *
* @param path a path to a file * @param path a path to a file
* @param content a textual content * @param content a textual content
*/ */
case class WriteFile(path: Path, content: String) case class WriteFile(path: Path, content: String)
/** /** Requests the Language Server write binary contents to an arbitrary file.
* Requests the Language Server write binary contents to an arbitrary file.
* *
* @param path a path to a file * @param path a path to a file
* @param contents binary contents * @param contents binary contents
*/ */
case class WriteBinaryFile(path: Path, contents: Array[Byte]) case class WriteBinaryFile(path: Path, contents: Array[Byte])
/** /** Signals file manipulation status.
* Signals file manipulation status.
* *
* @param result either file system failure or unit representing success * @param result either file system failure or unit representing success
*/ */
case class WriteFileResult(result: Either[FileSystemFailure, Unit]) case class WriteFileResult(result: Either[FileSystemFailure, Unit])
/** /** Requests the Language Server read a file.
* Requests the Language Server read a file.
* *
* @param path a path to a file * @param path a path to a file
*/ */
case class ReadFile(path: Path) case class ReadFile(path: Path)
/** /** Requests the Language Server to read a binary content of a file.
* Requests the Language Server to read a binary content of a file.
* *
* @param path a path to a file * @param path a path to a file
*/ */
case class ReadBinaryFile(path: Path) case class ReadBinaryFile(path: Path)
/** /** Returns a result of reading a file.
* Returns a result of reading a file.
* *
* @param result either file system failure or content of a file * @param result either file system failure or content of a file
*/ */
@ -79,8 +69,7 @@ object FileManagerProtocol {
result: Either[FileSystemFailure, TextualFileContent] result: Either[FileSystemFailure, TextualFileContent]
) )
/** /** Returns a result of reading binary contents of a file.
* Returns a result of reading binary contents of a file.
* *
* @param result either file system failure or content of a file * @param result either file system failure or content of a file
*/ */
@ -88,87 +77,75 @@ object FileManagerProtocol {
result: Either[FileSystemFailure, BinaryFileContent] result: Either[FileSystemFailure, BinaryFileContent]
) )
/** /** Requests the Language Server create a file system object.
* Requests the Language Server create a file system object.
* *
* @param `object` a file system object * @param `object` a file system object
*/ */
case class CreateFile(`object`: FileSystemObject) case class CreateFile(`object`: FileSystemObject)
/** /** Returns a result of creating a file system object.
* Returns a result of creating a file system object.
* *
* @param result either file system failure or unit representing success * @param result either file system failure or unit representing success
*/ */
case class CreateFileResult(result: Either[FileSystemFailure, Unit]) case class CreateFileResult(result: Either[FileSystemFailure, Unit])
/** /** Requests the Language Server delete a file system object.
* Requests the Language Server delete a file system object.
* *
* @param path a path to a file * @param path a path to a file
*/ */
case class DeleteFile(path: Path) case class DeleteFile(path: Path)
/** /** Returns a result of deleting a file system object.
* Returns a result of deleting a file system object.
* *
* @param result either file system failure or unit representing success * @param result either file system failure or unit representing success
*/ */
case class DeleteFileResult(result: Either[FileSystemFailure, Unit]) case class DeleteFileResult(result: Either[FileSystemFailure, Unit])
/** /** Requests the Language Server copy a file system object.
* Requests the Language Server copy a file system object.
* *
* @param from a path to the source * @param from a path to the source
* @param to a path to the destination * @param to a path to the destination
*/ */
case class CopyFile(from: Path, to: Path) case class CopyFile(from: Path, to: Path)
/** /** Returns a result of copying a file system object.
* Returns a result of copying a file system object.
* *
* @param result either file system failure or unit representing success * @param result either file system failure or unit representing success
*/ */
case class CopyFileResult(result: Either[FileSystemFailure, Unit]) case class CopyFileResult(result: Either[FileSystemFailure, Unit])
/** /** Requests the Language Server move a file system object.
* Requests the Language Server move a file system object.
* *
* @param from a path to the source * @param from a path to the source
* @param to a path to the destination * @param to a path to the destination
*/ */
case class MoveFile(from: Path, to: Path) case class MoveFile(from: Path, to: Path)
/** /** Returns a result of moving a file system object.
* Returns a result of moving a file system object.
* *
* @param result either file system failure or unit representing success * @param result either file system failure or unit representing success
*/ */
case class MoveFileResult(result: Either[FileSystemFailure, Unit]) case class MoveFileResult(result: Either[FileSystemFailure, Unit])
/** /** Requests the Language Server to check the existence of file system object.
* Requests the Language Server to check the existence of file system object.
* *
* @param path a path to a file * @param path a path to a file
*/ */
case class ExistsFile(path: Path) case class ExistsFile(path: Path)
/** /** Returns a result of checking the existence of file system object.
* Returns a result of checking the existence of file system object.
* *
* @param result either file system failure or file existence flag * @param result either file system failure or file existence flag
*/ */
case class ExistsFileResult(result: Either[FileSystemFailure, Boolean]) case class ExistsFileResult(result: Either[FileSystemFailure, Boolean])
/** /** Requests the Language Server to list a directory contents.
* Requests the Language Server to list a directory contents.
* *
* @param path to the file system object * @param path to the file system object
*/ */
case class ListFile(path: Path) case class ListFile(path: Path)
/** /** Returns a tree representation of a file system object.
* Returns a tree representation of a file system object.
* *
* @param result either file system failure or directory tree * @param result either file system failure or directory tree
*/ */
@ -176,29 +153,25 @@ object FileManagerProtocol {
result: Either[FileSystemFailure, Vector[FileSystemObject]] result: Either[FileSystemFailure, Vector[FileSystemObject]]
) )
/** /** Requests the Language Server to get a tree of a file system object.
* Requests the Language Server to get a tree of a file system object.
* *
* @param path to the file system object * @param path to the file system object
*/ */
case class TreeFile(path: Path, depth: Option[Int]) case class TreeFile(path: Path, depth: Option[Int])
/** /** Returns a tree representation of a file system object.
* Returns a tree representation of a file system object.
* *
* @param result either file system failure or directory tree * @param result either file system failure or directory tree
*/ */
case class TreeFileResult(result: Either[FileSystemFailure, DirectoryTree]) case class TreeFileResult(result: Either[FileSystemFailure, DirectoryTree])
/** /** Requests the Language Server to get attributes of a file system object.
* Requests the Language Server to get attributes of a file system object.
* *
* @param path to the file system object * @param path to the file system object
*/ */
case class InfoFile(path: Path) case class InfoFile(path: Path)
/** /** Returns an attributes of a file system object.
* Returns an attributes of a file system object.
* *
* @param result either file system failure or attributes * @param result either file system failure or attributes
*/ */

View File

@ -11,8 +11,7 @@ import zio.blocking.effectBlocking
import scala.collection.mutable import scala.collection.mutable
/** /** File manipulation facility.
* File manipulation facility.
* *
* @tparam F represents target monad * @tparam F represents target monad
*/ */
@ -20,8 +19,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
import FileSystemApi._ import FileSystemApi._
/** /** Writes textual content to a file.
* Writes textual content to a file.
* *
* @param file path to the file * @param file path to the file
* @param content a textual content of the file * @param content a textual content of the file
@ -34,7 +32,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
effectBlocking(FileUtils.write(file, content, "UTF-8")) effectBlocking(FileUtils.write(file, content, "UTF-8"))
.mapError(errorHandling) .mapError(errorHandling)
/** @inheritdoc **/ /** @inheritdoc */
override def writeBinary( override def writeBinary(
file: File, file: File,
contents: Array[Byte] contents: Array[Byte]
@ -42,8 +40,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
effectBlocking(FileUtils.writeByteArrayToFile(file, contents)) effectBlocking(FileUtils.writeByteArrayToFile(file, contents))
.mapError(errorHandling) .mapError(errorHandling)
/** /** Reads the contents of a textual file.
* Reads the contents of a textual file.
* *
* @param file path to the file * @param file path to the file
* @return either [[FileSystemFailure]] or the content of a file as a String * @return either [[FileSystemFailure]] or the content of a file as a String
@ -52,15 +49,14 @@ class FileSystem extends FileSystemApi[BlockingIO] {
effectBlocking(FileUtils.readFileToString(file, "UTF-8")) effectBlocking(FileUtils.readFileToString(file, "UTF-8"))
.mapError(errorHandling) .mapError(errorHandling)
/** @inheritdoc **/ /** @inheritdoc */
override def readBinary( override def readBinary(
file: File file: File
): BlockingIO[FileSystemFailure, Array[Byte]] = ): BlockingIO[FileSystemFailure, Array[Byte]] =
effectBlocking(FileUtils.readFileToByteArray(file)) effectBlocking(FileUtils.readFileToByteArray(file))
.mapError(errorHandling) .mapError(errorHandling)
/** /** Deletes the specified file or directory recursively.
* Deletes the specified file or directory recursively.
* *
* @param file path to the file or directory * @param file path to the file or directory
* @return either [[FileSystemFailure]] or Unit * @return either [[FileSystemFailure]] or Unit
@ -74,8 +70,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
} }
}.mapError(errorHandling) }.mapError(errorHandling)
/** /** Creates an empty file with parent directory.
* Creates an empty file with parent directory.
* *
* @param file path to the file * @param file path to the file
* @return * @return
@ -90,8 +85,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
effectBlocking(file.createNewFile(): Unit) effectBlocking(file.createNewFile(): Unit)
.mapError(errorHandling) .mapError(errorHandling)
/** /** Creates a directory, including any necessary but nonexistent parent
* Creates a directory, including any necessary but nonexistent parent
* directories. * directories.
* *
* @param file path to the file * @param file path to the file
@ -103,8 +97,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
effectBlocking(FileUtils.forceMkdir(file)) effectBlocking(FileUtils.forceMkdir(file))
.mapError(errorHandling) .mapError(errorHandling)
/** /** Copy a file or directory recursively.
* Copy a file or directory recursively.
* *
* @param from a path to the source * @param from a path to the source
* @param to a path to the destination. If from is a file, then to * @param to a path to the destination. If from is a file, then to
@ -127,8 +120,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
}.mapError(errorHandling) }.mapError(errorHandling)
} }
/** /** Move a file or directory recursively
* Move a file or directory recursively
* *
* @param from a path to the source * @param from a path to the source
* @param to a path to the destination * @param to a path to the destination
@ -146,8 +138,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
} }
}.mapError(errorHandling) }.mapError(errorHandling)
/** /** Checks if the specified file exists.
* Checks if the specified file exists.
* *
* @param file path to the file or directory * @param file path to the file or directory
* @return either [[FileSystemFailure]] or file existence flag * @return either [[FileSystemFailure]] or file existence flag
@ -156,8 +147,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
effectBlocking(Files.exists(file.toPath)) effectBlocking(Files.exists(file.toPath))
.mapError(errorHandling) .mapError(errorHandling)
/** /** List contents of a given path.
* List contents of a given path.
* *
* @param path to the file system object * @param path to the file system object
* @return either [[FileSystemFailure]] or list of entries * @return either [[FileSystemFailure]] or list of entries
@ -181,8 +171,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
IO.fail(FileNotFound) IO.fail(FileNotFound)
} }
/** /** Returns tree of a given path.
* Returns tree of a given path.
* *
* @param path to the file system object * @param path to the file system object
* @param depth maximum depth of a directory tree * @param depth maximum depth of a directory tree
@ -214,8 +203,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
} }
} }
/** /** Returns attributes of a given path.
* Returns attributes of a given path.
* *
* @param path to the file system object * @param path to the file system object
* @return either [[FileSystemFailure]] or file attributes * @return either [[FileSystemFailure]] or file attributes
@ -247,8 +235,7 @@ object FileSystem {
import FileSystemApi._ import FileSystemApi._
/** /** Represent a depth limit when recursively traversing a directory.
* Represent a depth limit when recursively traversing a directory.
*/ */
sealed private trait Depth { sealed private trait Depth {
@ -281,8 +268,7 @@ object FileSystem {
UnlimitedDepth UnlimitedDepth
} }
/** /** Represents subdirectory in the tree algorithm.
* Represents subdirectory in the tree algorithm.
* *
* @param entry subdir entry * @param entry subdir entry
* @param level subdir depth level * @param level subdir depth level
@ -294,8 +280,7 @@ object FileSystem {
visited: Vector[SymbolicLinkEntry] visited: Vector[SymbolicLinkEntry]
) )
/** /** Read an entry without following the symlinks.
* Read an entry without following the symlinks.
*/ */
private def readEntry(path: Path): Entry = { private def readEntry(path: Path): Entry = {
if (Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS)) { if (Files.isRegularFile(path, LinkOption.NOFOLLOW_LINKS)) {
@ -314,8 +299,7 @@ object FileSystem {
} }
} }
/** /** Read the target of a symlink.
* Read the target of a symlink.
*/ */
private def readSymbolicLink(path: Path): Entry = { private def readSymbolicLink(path: Path): Entry = {
if (Files.isRegularFile(path)) { if (Files.isRegularFile(path)) {
@ -327,8 +311,7 @@ object FileSystem {
} }
} }
/** /** Returns the entries of the provided path. Symlinks are not resolved.
* Returns the entries of the provided path. Symlinks are not resolved.
* *
* @param path to the directory * @param path to the directory
* @return list of entries * @return list of entries
@ -344,8 +327,7 @@ object FileSystem {
.sortBy(_.path) .sortBy(_.path)
} }
/** /** Makes BFS traversal and updates provided directory [[DirectoryEntry]].
* Makes BFS traversal and updates provided directory [[DirectoryEntry]].
* Symlinks are resolved. Returned [[SymbolicLinkEntry]] indicates a loop. * Symlinks are resolved. Returned [[SymbolicLinkEntry]] indicates a loop.
* *
* @param directory current directory * @param directory current directory

View File

@ -9,8 +9,7 @@ import org.enso.languageserver.effect.BlockingIO
import scala.collection.mutable.ArrayBuffer import scala.collection.mutable.ArrayBuffer
/** /** File manipulation API.
* File manipulation API.
* *
* @tparam F represents target monad * @tparam F represents target monad
*/ */
@ -18,8 +17,7 @@ trait FileSystemApi[F[_, _]] {
import FileSystemApi._ import FileSystemApi._
/** /** Writes textual content to a file.
* Writes textual content to a file.
* *
* @param file path to the file * @param file path to the file
* @param content a textual content of the file * @param content a textual content of the file
@ -30,8 +28,7 @@ trait FileSystemApi[F[_, _]] {
content: String content: String
): F[FileSystemFailure, Unit] ): F[FileSystemFailure, Unit]
/** /** Writes binary content to a file.
* Writes binary content to a file.
* *
* @param file path to the file * @param file path to the file
* @param contents a binary content of the file * @param contents a binary content of the file
@ -42,16 +39,14 @@ trait FileSystemApi[F[_, _]] {
contents: Array[Byte] contents: Array[Byte]
): BlockingIO[FileSystemFailure, Unit] ): BlockingIO[FileSystemFailure, Unit]
/** /** Reads the contents of a textual file.
* Reads the contents of a textual file.
* *
* @param file path to the file * @param file path to the file
* @return either [[FileSystemFailure]] or the content of a file as a String * @return either [[FileSystemFailure]] or the content of a file as a String
*/ */
def read(file: File): F[FileSystemFailure, String] def read(file: File): F[FileSystemFailure, String]
/** /** Reads the contents of a binary file.
* Reads the contents of a binary file.
* *
* @param file path to the file * @param file path to the file
* @return either [[FileSystemFailure]] or the content of a file as a byte * @return either [[FileSystemFailure]] or the content of a file as a byte
@ -59,24 +54,21 @@ trait FileSystemApi[F[_, _]] {
*/ */
def readBinary(file: File): BlockingIO[FileSystemFailure, Array[Byte]] def readBinary(file: File): BlockingIO[FileSystemFailure, Array[Byte]]
/** /** Deletes the specified file or directory recursively.
* Deletes the specified file or directory recursively.
* *
* @param file path to the file or directory * @param file path to the file or directory
* @return either [[FileSystemFailure]] or Unit * @return either [[FileSystemFailure]] or Unit
*/ */
def delete(file: File): F[FileSystemFailure, Unit] def delete(file: File): F[FileSystemFailure, Unit]
/** /** Creates an empty file with parent directory.
* Creates an empty file with parent directory.
* *
* @param file path to the file * @param file path to the file
* @return * @return
*/ */
def createFile(file: File): F[FileSystemFailure, Unit] def createFile(file: File): F[FileSystemFailure, Unit]
/** /** Creates a directory, including any necessary but nonexistent parent
* Creates a directory, including any necessary but nonexistent parent
* directories. * directories.
* *
* @param file path to the file * @param file path to the file
@ -84,8 +76,7 @@ trait FileSystemApi[F[_, _]] {
*/ */
def createDirectory(file: File): F[FileSystemFailure, Unit] def createDirectory(file: File): F[FileSystemFailure, Unit]
/** /** Copy a file or directory recursively
* Copy a file or directory recursively
* *
* @param from a path to the source * @param from a path to the source
* @param to a path to the destination * @param to a path to the destination
@ -96,8 +87,7 @@ trait FileSystemApi[F[_, _]] {
to: File to: File
): F[FileSystemFailure, Unit] ): F[FileSystemFailure, Unit]
/** /** Move a file or directory recursively
* Move a file or directory recursively
* *
* @param from a path to the source * @param from a path to the source
* @param to a path to the destination * @param to a path to the destination
@ -108,24 +98,21 @@ trait FileSystemApi[F[_, _]] {
to: File to: File
): F[FileSystemFailure, Unit] ): F[FileSystemFailure, Unit]
/** /** Checks if the specified file exists.
* Checks if the specified file exists.
* *
* @param file path to the file or directory * @param file path to the file or directory
* @return either [[FileSystemFailure]] or file existence flag * @return either [[FileSystemFailure]] or file existence flag
*/ */
def exists(file: File): F[FileSystemFailure, Boolean] def exists(file: File): F[FileSystemFailure, Boolean]
/** /** List contents of a given path.
* List contents of a given path.
* *
* @param path to the file system object * @param path to the file system object
* @return either [[FileSystemFailure]] or list of entries * @return either [[FileSystemFailure]] or list of entries
*/ */
def list(path: File): F[FileSystemFailure, Vector[Entry]] def list(path: File): F[FileSystemFailure, Vector[Entry]]
/** /** Returns contents of a given path.
* Returns contents of a given path.
* *
* @param path to the file system object * @param path to the file system object
* @param depth maximum depth of a directory tree * @param depth maximum depth of a directory tree
@ -136,8 +123,7 @@ trait FileSystemApi[F[_, _]] {
depth: Option[Int] depth: Option[Int]
): F[FileSystemFailure, DirectoryEntry] ): F[FileSystemFailure, DirectoryEntry]
/** /** Returns attributes of a given path.
* Returns attributes of a given path.
* *
* @param path to the file system object * @param path to the file system object
* @return either [[FileSystemFailure]] or file attributes * @return either [[FileSystemFailure]] or file attributes
@ -147,8 +133,7 @@ trait FileSystemApi[F[_, _]] {
object FileSystemApi { object FileSystemApi {
/** /** An object representing abstract file system entry.
* An object representing abstract file system entry.
*/ */
sealed trait Entry { sealed trait Entry {
def path: Path def path: Path
@ -156,8 +141,7 @@ object FileSystemApi {
object Entry { object Entry {
/** /** Creates [[Entry]] from file system attributes.
* Creates [[Entry]] from file system attributes.
* *
* @param path a path to the file system object * @param path a path to the file system object
* @param attrs a file system attributes * @param attrs a file system attributes
@ -173,8 +157,7 @@ object FileSystemApi {
} }
} }
/** /** An entry representing a directory.
* An entry representing a directory.
* *
* @param path to the directory * @param path to the directory
* @param children a paths to the children entries * @param children a paths to the children entries
@ -188,35 +171,30 @@ object FileSystemApi {
DirectoryEntry(path, ArrayBuffer()) DirectoryEntry(path, ArrayBuffer())
} }
/** /** An entry representing a directory with contents truncated.
* An entry representing a directory with contents truncated.
* *
* @param path to the directory * @param path to the directory
*/ */
case class DirectoryEntryTruncated(path: Path) extends Entry case class DirectoryEntryTruncated(path: Path) extends Entry
/** /** An entry representing a symbolic link.
* An entry representing a symbolic link.
* *
* @param path to the symlink * @param path to the symlink
* @param target of the symlink. * @param target of the symlink.
*/ */
case class SymbolicLinkEntry(path: Path, target: Path) extends Entry case class SymbolicLinkEntry(path: Path, target: Path) extends Entry
/** /** An entry representing a file.
* An entry representing a file.
* *
* @param path to the file * @param path to the file
*/ */
case class FileEntry(path: Path) extends Entry case class FileEntry(path: Path) extends Entry
/** /** Unrecognized file system entry. Example is a broken symlink.
* Unrecognized file system entry. Example is a broken symlink.
*/ */
case class OtherEntry(path: Path) extends Entry case class OtherEntry(path: Path) extends Entry
/** /** Basic attributes of an [[Entry]].
* Basic attributes of an [[Entry]].
* *
* @param creationTime creation time * @param creationTime creation time
* @param lastAccessTime last access time * @param lastAccessTime last access time
@ -234,8 +212,7 @@ object FileSystemApi {
object Attributes { object Attributes {
/** /** Creates attributes using the `FileTime` time.
* Creates attributes using the `FileTime` time.
* *
* @param creationTime creation time * @param creationTime creation time
* @param lastAccessTime last access time * @param lastAccessTime last access time
@ -259,8 +236,7 @@ object FileSystemApi {
byteSize = byteSize byteSize = byteSize
) )
/** /** Creates [[Attributes]] from file system attributes
* Creates [[Attributes]] from file system attributes
* *
* @param path to the file system object * @param path to the file system object
* @param attributes of a file system object * @param attributes of a file system object

View File

@ -1,42 +1,34 @@
package org.enso.languageserver.filemanager package org.enso.languageserver.filemanager
/** /** Represents file system failures.
* Represents file system failures.
*/ */
sealed trait FileSystemFailure sealed trait FileSystemFailure
/** /** Informs that the requested content root cannot be found.
* Informs that the requested content root cannot be found.
*/ */
case object ContentRootNotFound extends FileSystemFailure case object ContentRootNotFound extends FileSystemFailure
/** /** Signals that a user doesn't have access to a file.
* Signals that a user doesn't have access to a file.
*/ */
case object AccessDenied extends FileSystemFailure case object AccessDenied extends FileSystemFailure
/** /** Signals that the file cannot be found.
* Signals that the file cannot be found.
*/ */
case object FileNotFound extends FileSystemFailure case object FileNotFound extends FileSystemFailure
/** /** Signals that the file already exists.
* Signals that the file already exists.
*/ */
case object FileExists extends FileSystemFailure case object FileExists extends FileSystemFailure
/** /** Signal that the operation timed out.
* Signal that the operation timed out.
*/ */
case object OperationTimeout extends FileSystemFailure case object OperationTimeout extends FileSystemFailure
/** /** Signal that the provided path is not directory.
* Signal that the provided path is not directory.
*/ */
case object NotDirectory extends FileSystemFailure case object NotDirectory extends FileSystemFailure
/** /** Signals file system specific errors.
* Signals file system specific errors.
* *
* @param reason a reason of failure * @param reason a reason of failure
*/ */

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.protocol.json.ErrorApi
object FileSystemFailureMapper { object FileSystemFailureMapper {
/** /** Maps [[FileSystemFailure]] into JSON RPC error.
* Maps [[FileSystemFailure]] into JSON RPC error.
* *
* @param fileSystemFailure file system specific failure * @param fileSystemFailure file system specific failure
* @return JSON RPC error * @return JSON RPC error

View File

@ -4,23 +4,20 @@ import io.circe.generic.auto._
import io.circe.syntax._ import io.circe.syntax._
import io.circe.{Decoder, Encoder, Json} import io.circe.{Decoder, Encoder, Json}
/** /** A representation of filesystem object.
* A representation of filesystem object.
*/ */
sealed trait FileSystemObject sealed trait FileSystemObject
object FileSystemObject { object FileSystemObject {
/** /** Represents a directory.
* Represents a directory.
* *
* @param name a name of the directory * @param name a name of the directory
* @param path a path to the directory * @param path a path to the directory
*/ */
case class Directory(name: String, path: Path) extends FileSystemObject case class Directory(name: String, path: Path) extends FileSystemObject
/** /** Represents a symbolic link that creates a loop.
* Represents a symbolic link that creates a loop.
* *
* @param name a name of the symlink * @param name a name of the symlink
* @param path a path to the symlink * @param path a path to the symlink
@ -30,16 +27,14 @@ object FileSystemObject {
case class SymlinkLoop(name: String, path: Path, target: Path) case class SymlinkLoop(name: String, path: Path, target: Path)
extends FileSystemObject extends FileSystemObject
/** /** Represents a file.
* Represents a file.
* *
* @param name a name of the file * @param name a name of the file
* @param path a path to the file * @param path a path to the file
*/ */
case class File(name: String, path: Path) extends FileSystemObject case class File(name: String, path: Path) extends FileSystemObject
/** /** Represents unrecognized object. Example is a broken symlink.
* Represents unrecognized object. Example is a broken symlink.
*/ */
case class Other(name: String, path: Path) extends FileSystemObject case class Other(name: String, path: Path) extends FileSystemObject

View File

@ -5,8 +5,7 @@ import java.nio
import java.nio.file.Paths import java.nio.file.Paths
import java.util.UUID import java.util.UUID
/** /** A representation of a path relative to a specified content root.
* A representation of a path relative to a specified content root.
* *
* @param rootId a content root id that the path is relative to * @param rootId a content root id that the path is relative to
* @param segments path segments * @param segments path segments
@ -14,8 +13,8 @@ import java.util.UUID
case class Path(rootId: UUID, segments: Vector[String]) { case class Path(rootId: UUID, segments: Vector[String]) {
def toFile(rootPath: File): File = def toFile(rootPath: File): File =
segments.foldLeft(rootPath) { segments.foldLeft(rootPath) { case (parent, child) =>
case (parent, child) => new File(parent, child) new File(parent, child)
} }
def toFile(rootPath: File, fileName: String): File = { def toFile(rootPath: File, fileName: String): File = {
@ -38,8 +37,7 @@ object Path {
b.result().filter(_.nonEmpty) b.result().filter(_.nonEmpty)
} }
/** /** Get path relative to the root.
* Get path relative to the root.
* *
* @param root a root path * @param root a root path
* @param base a path relative to the root * @param base a path relative to the root
@ -49,8 +47,7 @@ object Path {
def getRelativePath(root: File, base: Path, path: nio.file.Path): Path = def getRelativePath(root: File, base: Path, path: nio.file.Path): Path =
Path(base.rootId, root.toPath.relativize(path)) Path(base.rootId, root.toPath.relativize(path))
/** /** Get path relative to the root, and return a parent path.
* Get path relative to the root, and return a parent path.
* *
* @param root a root path * @param root a root path
* @param base a path relative to the root * @param base a path relative to the root

View File

@ -23,8 +23,7 @@ import zio._
import scala.concurrent.Await import scala.concurrent.Await
/** /** Starts [[WatcherAdapter]], handles errors, converts and sends
* Starts [[WatcherAdapter]], handles errors, converts and sends
* events to the client. * events to the client.
* *
* @param config configuration * @param config configuration
@ -55,33 +54,32 @@ final class PathWatcher(
override def receive: Receive = uninitializedStage override def receive: Receive = uninitializedStage
private def uninitializedStage: Receive = { private def uninitializedStage: Receive = { case WatchPath(path, clients) =>
case WatchPath(path, clients) => val pathToWatchResult = config
val pathToWatchResult = config .findContentRoot(path.rootId)
.findContentRoot(path.rootId) .map(path.toFile(_))
.map(path.toFile(_)) val result: BlockingIO[FileSystemFailure, Unit] =
val result: BlockingIO[FileSystemFailure, Unit] = for {
for { pathToWatch <- IO.fromEither(pathToWatchResult)
pathToWatch <- IO.fromEither(pathToWatchResult) _ <- validatePath(pathToWatch)
_ <- validatePath(pathToWatch) watcher <- IO.fromEither(buildWatcher(pathToWatch))
watcher <- IO.fromEither(buildWatcher(pathToWatch)) _ <- IO.fromEither(startWatcher(watcher))
_ <- IO.fromEither(startWatcher(watcher)) } yield ()
} yield ()
exec exec
.exec(result) .exec(result)
.map { .map {
case Right(()) => CapabilityAcquired case Right(()) => CapabilityAcquired
case Left(err) => CapabilityAcquisitionFileSystemFailure(err) case Left(err) => CapabilityAcquisitionFileSystemFailure(err)
}
.pipeTo(sender())
pathToWatchResult match {
case Right(root) =>
context.become(initializedStage(root, path, clients))
case Left(_) =>
context.stop(self)
} }
.pipeTo(sender())
pathToWatchResult match {
case Right(root) =>
context.become(initializedStage(root, path, clients))
case Left(_) =>
context.stop(self)
}
} }
private def initializedStage( private def initializedStage(
@ -178,8 +176,7 @@ final class PathWatcher(
object PathWatcher { object PathWatcher {
/** /** Counter for unsuccessful file watcher restarts.
* Counter for unsuccessful file watcher restarts.
* *
* @param maxRestarts maximum restart attempts * @param maxRestarts maximum restart attempts
*/ */
@ -187,33 +184,28 @@ object PathWatcher {
private var restartCount: Int = 0 private var restartCount: Int = 0
/** /** Return current restart count.
* Return current restart count.
*/ */
def count: Int = def count: Int =
restartCount restartCount
/** /** Increment restart count.
* Increment restart count.
*/ */
def inc(): Unit = def inc(): Unit =
restartCount += 1 restartCount += 1
/** /** Reset restart count.
* Reset restart count.
*/ */
def reset(): Unit = def reset(): Unit =
restartCount = 0 restartCount = 0
/** /** Return true if we hit the maximum number of restarts.
* Return true if we hit the maximum number of restarts.
*/ */
def canRestart: Boolean = def canRestart: Boolean =
restartCount < maxRestarts restartCount < maxRestarts
} }
/** /** Creates a configuration object used to create a [[PathWatcher]].
* Creates a configuration object used to create a [[PathWatcher]].
* *
* @param config configuration * @param config configuration
* @param fs file system * @param fs file system

View File

@ -4,8 +4,7 @@ import akka.actor.ActorRef
object PathWatcherProtocol { object PathWatcherProtocol {
/** /** Requests event manager to watch the path.
* Requests event manager to watch the path.
* *
* @param path path to watch * @param path path to watch
*/ */
@ -17,13 +16,11 @@ object PathWatcherProtocol {
WatchPath(path, Set(client)) WatchPath(path, Set(client))
} }
/** /** Requests event manager to stop watching.
* Requests event manager to stop watching.
*/ */
case class UnwatchPath(client: ActorRef) case class UnwatchPath(client: ActorRef)
/** /** Returns a file event result.
* Returns a file event result.
* *
* @param result file event * @param result file event
*/ */

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.data.{
import org.enso.languageserver.effect._ import org.enso.languageserver.effect._
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** Handles `receivesTreeUpdates` capabilities acquisition and release.
* Handles `receivesTreeUpdates` capabilities acquisition and release.
* *
* == Implementation == * == Implementation ==
* *
@ -64,8 +63,8 @@ final class ReceivesTreeUpdatesHandler(
private def withStore(store: Store): Receive = { private def withStore(store: Store): Receive = {
case AcquireCapability( case AcquireCapability(
client, client,
CapabilityRegistration(ReceivesTreeUpdates(path)) CapabilityRegistration(ReceivesTreeUpdates(path))
) => ) =>
store.getWatcher(path) match { store.getWatcher(path) match {
case Some(watcher) => case Some(watcher) =>
@ -83,8 +82,8 @@ final class ReceivesTreeUpdatesHandler(
} }
case ReleaseCapability( case ReleaseCapability(
client, client,
CapabilityRegistration(ReceivesTreeUpdates(path)) CapabilityRegistration(ReceivesTreeUpdates(path))
) => ) =>
store.getWatcher(path) match { store.getWatcher(path) match {
case Some(watcher) => case Some(watcher) =>
@ -100,15 +99,13 @@ final class ReceivesTreeUpdatesHandler(
object ReceivesTreeUpdatesHandler { object ReceivesTreeUpdatesHandler {
/** /** Internal state of a [[ReceivesTreeUpdatesHandler]].
* Internal state of a [[ReceivesTreeUpdatesHandler]].
* *
* @param watchers mappings of a path watcher with a path * @param watchers mappings of a path watcher with a path
*/ */
case class Store(watchers: Map[Path, ActorRef]) { case class Store(watchers: Map[Path, ActorRef]) {
/** /** Returns watcher associated with the provided path.
* Returns watcher associated with the provided path.
* *
* @param path watched path * @param path watched path
* @return optional watcher associated with this path * @return optional watcher associated with this path
@ -116,8 +113,7 @@ object ReceivesTreeUpdatesHandler {
def getWatcher(path: Path): Option[ActorRef] = def getWatcher(path: Path): Option[ActorRef] =
watchers.get(path) watchers.get(path)
/** /** Add new watcher with the path to the store.
* Add new watcher with the path to the store.
* *
* @param watcher path watcher * @param watcher path watcher
* @param path watched path * @param path watched path
@ -126,8 +122,7 @@ object ReceivesTreeUpdatesHandler {
def addWatcher(watcher: ActorRef, path: Path): Store = def addWatcher(watcher: ActorRef, path: Path): Store =
copy(watchers = watchers + (path -> watcher)) copy(watchers = watchers + (path -> watcher))
/** /** Remove watcher from the store.
* Remove watcher from the store.
* *
* @param watcher path watcher * @param watcher path watcher
* @return updated store * @return updated store
@ -142,8 +137,7 @@ object ReceivesTreeUpdatesHandler {
new Store(Map()) new Store(Map())
} }
/** /** Creates a configuration object used to create a
* Creates a configuration object used to create a
* [[ReceivesTreeUpdatesHandler]]. * [[ReceivesTreeUpdatesHandler]].
* *
* @param config configuration * @param config configuration

View File

@ -5,8 +5,7 @@ import java.nio.file.Path
import io.methvin.watcher._ import io.methvin.watcher._
import zio._ import zio._
/** /** Watches the root with subdirectories and executes callback on file event.
* Watches the root with subdirectories and executes callback on file event.
* *
* @param root directory to watch * @param root directory to watch
* @param eventCallback callback that fires on the file system events * @param eventCallback callback that fires on the file system events
@ -26,20 +25,17 @@ final class WatcherAdapter(
.listener(this) .listener(this)
.build() .build()
/** /** Start watcher.
* Start watcher.
*/ */
def start(): IO[Throwable, Unit] = def start(): IO[Throwable, Unit] =
IO(watcher.watch()) IO(watcher.watch())
/** /** Stop watcher.
* Stop watcher.
*/ */
def stop(): IO[Throwable, Unit] = def stop(): IO[Throwable, Unit] =
IO(watcher.close()) IO(watcher.close())
/** /** A callback executed by `DirectoryWatcher` on file system event.
* A callback executed by `DirectoryWatcher` on file system event.
*/ */
override def onEvent(event: DirectoryChangeEvent): Unit = { override def onEvent(event: DirectoryChangeEvent): Unit = {
WatcherEvent WatcherEvent
@ -54,15 +50,13 @@ final class WatcherAdapter(
object WatcherAdapter { object WatcherAdapter {
/** /** Type of a file event.
* Type of a file event.
*/ */
sealed trait EventType sealed trait EventType
private object EventType { private object EventType {
/** /** Creates [[EventType]] from file system event type.
* Creates [[EventType]] from file system event type.
* *
* @param eventType file system event type * @param eventType file system event type
* @return watcher event type * @return watcher event type
@ -76,23 +70,19 @@ object WatcherAdapter {
} }
} }
/** /** Event type indicating file creation.
* Event type indicating file creation.
*/ */
case object EventTypeCreate extends EventType case object EventTypeCreate extends EventType
/** /** Event type indicating file modification.
* Event type indicating file modification.
*/ */
case object EventTypeModify extends EventType case object EventTypeModify extends EventType
/** /** Event type indicating file deletion.
* Event type indicating file deletion.
*/ */
case object EventTypeDelete extends EventType case object EventTypeDelete extends EventType
/** /** Object representing file system event.
* Object representing file system event.
* *
* @param path path to the file system object * @param path path to the file system object
* @param eventType event type * @param eventType event type
@ -101,8 +91,7 @@ object WatcherAdapter {
object WatcherEvent { object WatcherEvent {
/** /** Conversion form file system event to [[WatcherEvent]]
* Conversion form file system event to [[WatcherEvent]]
* *
* @param event file system event * @param event file system event
* @return watcher event * @return watcher event
@ -113,8 +102,7 @@ object WatcherAdapter {
.map(WatcherEvent(event.path(), _)) .map(WatcherEvent(event.path(), _))
} }
/** /** Object representing en error.
* Object representing en error.
* *
* @param exception an error * @param exception an error
*/ */

View File

@ -2,44 +2,37 @@ package org.enso.languageserver.http.server
import akka.actor.ActorRef import akka.actor.ActorRef
/** /** A web socket control protocol used to manage connections created by
* A web socket control protocol used to manage connections created by
* a [[BinaryWebSocketServer]]. * a [[BinaryWebSocketServer]].
*/ */
object BinaryWebSocketControlProtocol { object BinaryWebSocketControlProtocol {
/** /** Base trait for web socket events.
* Base trait for web socket events.
*/ */
sealed trait WsEvent sealed trait WsEvent
/** /** Base trait for web socket commands.
* Base trait for web socket commands.
*/ */
sealed trait WsCommand sealed trait WsCommand
/** /** Signals that a connection has been closed.
* Signals that a connection has been closed.
*/ */
case object ConnectionClosed extends WsEvent case object ConnectionClosed extends WsEvent
/** /** Signals connection failure.
* Signals connection failure.
* *
* @param throwable a throwable * @param throwable a throwable
*/ */
case class ConnectionFailed(throwable: Throwable) extends WsEvent case class ConnectionFailed(throwable: Throwable) extends WsEvent
/** /** Signals that a connection has been established.
* Signals that a connection has been established.
* *
* @param outboundChannel an outbound sender * @param outboundChannel an outbound sender
*/ */
case class OutboundStreamEstablished(outboundChannel: ActorRef) case class OutboundStreamEstablished(outboundChannel: ActorRef)
extends WsEvent extends WsEvent
/** /** Command that closes a connection.
* Command that closes a connection.
*/ */
case object CloseConnection extends WsCommand case object CloseConnection extends WsCommand

View File

@ -28,8 +28,7 @@ import org.enso.languageserver.util.binary.{
import scala.concurrent.duration._ import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
/** /** A web socket server using a binary protocol.
* A web socket server using a binary protocol.
* *
* @param decoder a decoder for inbound packets * @param decoder a decoder for inbound packets
* @param encoder an encoder for outbound packets * @param encoder an encoder for outbound packets
@ -68,8 +67,7 @@ class BinaryWebSocketServer[A, B](
} }
} }
/** /** Binds this server instance to a given port and interface, allowing
* Binds this server instance to a given port and interface, allowing
* future connections. * future connections.
* *
* @param interface the interface to bind to. * @param interface the interface to bind to.
@ -150,8 +148,7 @@ class BinaryWebSocketServer[A, B](
object BinaryWebSocketServer { object BinaryWebSocketServer {
/** /** A configuration object for properties of the [[BinaryWebSocketServer]].
* A configuration object for properties of the [[BinaryWebSocketServer]].
* *
* @param outgoingBufferSize the number of messages buffered internally * @param outgoingBufferSize the number of messages buffered internally
* if the downstream connection is lagging behind. * if the downstream connection is lagging behind.
@ -167,8 +164,7 @@ object BinaryWebSocketServer {
case object Config { case object Config {
/** /** Creates a default instance of [[Config]].
* Creates a default instance of [[Config]].
* *
* @return a default config. * @return a default config.
*/ */

View File

@ -3,13 +3,11 @@ package org.enso.languageserver.http.server
import akka.actor.ActorRef import akka.actor.ActorRef
import akka.http.scaladsl.model.RemoteAddress import akka.http.scaladsl.model.RemoteAddress
/** /** A factory of connection controllers.
* A factory of connection controllers.
*/ */
trait ConnectionControllerFactory { trait ConnectionControllerFactory {
/** /** Creates a connection controller that acts as front controller.
* Creates a connection controller that acts as front controller.
* *
* @param clientIp a client ip that the connection controller is created for * @param clientIp a client ip that the connection controller is created for
* @return actor ref of created connection controller * @return actor ref of created connection controller

View File

@ -1,8 +1,7 @@
package org.enso.languageserver.io package org.enso.languageserver.io
import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused} import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused}
/** /** The input/output JSON RPC API provided by the language server.
* The input/output JSON RPC API provided by the language server.
* *
* @see [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]] * @see [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]]
*/ */

View File

@ -4,23 +4,20 @@ import org.enso.languageserver.data.ClientId
object InputOutputProtocol { object InputOutputProtocol {
/** /** A command to the output controller responsible for redirecting an output.
* A command to the output controller responsible for redirecting an output.
* *
* @param clientId the client that the redirection is performed for * @param clientId the client that the redirection is performed for
*/ */
case class RedirectOutput(clientId: ClientId) case class RedirectOutput(clientId: ClientId)
/** /** A command to the output controller responsible for suppressing a
* A command to the output controller responsible for suppressing a
* redirection of an output. * redirection of an output.
* *
* @param clientId the client that the suppression is performed for * @param clientId the client that the suppression is performed for
*/ */
case class SuppressOutput(clientId: ClientId) case class SuppressOutput(clientId: ClientId)
/** /** A notification that signals that new output was appended to the stdout or
* A notification that signals that new output was appended to the stdout or
* stderr. * stderr.
* *
* @param output the new data * @param output the new data
@ -28,8 +25,7 @@ object InputOutputProtocol {
*/ */
case class OutputAppended(output: String, outputKind: OutputKind) case class OutputAppended(output: String, outputKind: OutputKind)
/** /** A command that feeds the standard input.
* A command that feeds the standard input.
* *
* @param input the data that feeds stdin * @param input the data that feeds stdin
* @param isLineTerminated signals if the input is terminated with a line * @param isLineTerminated signals if the input is terminated with a line
@ -37,8 +33,7 @@ object InputOutputProtocol {
*/ */
case class FeedStandardInput(input: String, isLineTerminated: Boolean) case class FeedStandardInput(input: String, isLineTerminated: Boolean)
/** /** Signals that a user program is blocked by `IO.readln` operation.
* Signals that a user program is blocked by `IO.readln` operation.
*/ */
case object WaitingForStandardInput case object WaitingForStandardInput

View File

@ -23,8 +23,7 @@ import org.enso.languageserver.io.ObservablePipedInputStream.{
import org.enso.languageserver.session.SessionRouter.DeliverToJsonController import org.enso.languageserver.session.SessionRouter.DeliverToJsonController
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A stdin redirection controller responsible for feeding stdin and notifying
* A stdin redirection controller responsible for feeding stdin and notifying
* execution context owners that executed program is blocked on `IO.readln`. * execution context owners that executed program is blocked on `IO.readln`.
* *
* @param stdIn a stream from which programs read its input data * @param stdIn a stream from which programs read its input data
@ -70,16 +69,15 @@ class InputRedirectionController(
case ReadBlocked => case ReadBlocked =>
log.debug("Blocked read detected") log.debug("Blocked read detected")
liveContexts foreach { liveContexts foreach { case ContextData(_, owner) =>
case ContextData(_, owner) => sessionRouter ! DeliverToJsonController(
sessionRouter ! DeliverToJsonController( owner,
owner, WaitingForStandardInput
WaitingForStandardInput )
)
} }
} }
/** @inheritdoc **/ /** @inheritdoc */
override def update(event: InputStreamEvent): Unit = { self ! event } override def update(event: InputStreamEvent): Unit = { self ! event }
override def preRestart(reason: Throwable, message: Option[Any]): Unit = { override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
@ -97,8 +95,7 @@ object InputRedirectionController {
private case class ContextData(contextId: UUID, owner: ClientId) private case class ContextData(contextId: UUID, owner: ClientId)
/** /** Creates a configuration object used to create a
* Creates a configuration object used to create a
* [[InputRedirectionController]]. * [[InputRedirectionController]].
* *
* @param stdIn a stream from which programs read its input data * @param stdIn a stream from which programs read its input data

View File

@ -4,8 +4,7 @@ import java.io.OutputStream
import org.enso.languageserver.io.ObservableOutputStream.OutputObserver import org.enso.languageserver.io.ObservableOutputStream.OutputObserver
/** /** An observable output stream of bytes. It accepts output bytes
* An observable output stream of bytes. It accepts output bytes
* and sends them to attached observers. Observers can dynamically * and sends them to attached observers. Observers can dynamically
* subscribe and unsubscribe for output bytes. It's thread-safe. * subscribe and unsubscribe for output bytes. It's thread-safe.
*/ */
@ -15,19 +14,19 @@ class ObservableOutputStream extends OutputStream {
private var observers = Set.empty[OutputObserver] private var observers = Set.empty[OutputObserver]
/** @inheritdoc **/ /** @inheritdoc */
override def write(byte: Int): Unit = lock.synchronized { override def write(byte: Int): Unit = lock.synchronized {
notify(Array[Byte](byte.toByte)) notify(Array[Byte](byte.toByte))
} }
/** @inheritdoc **/ /** @inheritdoc */
override def write(bytes: Array[Byte]): Unit = lock.synchronized { override def write(bytes: Array[Byte]): Unit = lock.synchronized {
if (bytes.length > 0) { if (bytes.length > 0) {
notify(bytes) notify(bytes)
} }
} }
/** @inheritdoc **/ /** @inheritdoc */
override def write(bytes: Array[Byte], off: Int, len: Int): Unit = override def write(bytes: Array[Byte], off: Int, len: Int): Unit =
lock.synchronized { lock.synchronized {
if (len > 0) { if (len > 0) {
@ -37,8 +36,7 @@ class ObservableOutputStream extends OutputStream {
} }
} }
/** /** Attaches an output observer.
* Attaches an output observer.
* *
* @param observer the observer that subscribe for output bytes * @param observer the observer that subscribe for output bytes
*/ */
@ -46,8 +44,7 @@ class ObservableOutputStream extends OutputStream {
observers += observer observers += observer
} }
/** /** Detaches an output observer.
* Detaches an output observer.
* *
* @param observer the observer that was subscribed for output bytes * @param observer the observer that was subscribed for output bytes
*/ */
@ -63,14 +60,12 @@ class ObservableOutputStream extends OutputStream {
object ObservableOutputStream { object ObservableOutputStream {
/** /** Defines an updating interface for objects that should be notified of new
* Defines an updating interface for objects that should be notified of new
* data accepted by an output stream. * data accepted by an output stream.
*/ */
trait OutputObserver { trait OutputObserver {
/** /** Method used to notify an observer about output changes.
* Method used to notify an observer about output changes.
* *
* @param output the new data * @param output the new data
*/ */

View File

@ -10,8 +10,7 @@ import org.enso.languageserver.io.ObservablePipedInputStream.{
ReadBlocked ReadBlocked
} }
/** /** An observable piped input stream connected to a observable output stream.
* An observable piped input stream connected to a observable output stream.
* This stream provides data bytes that are written to the output stream. * This stream provides data bytes that are written to the output stream.
* It notifies observers when read operation waits for output stream. The * It notifies observers when read operation waits for output stream. The
* stream stores buffered bytes in a rope-like immutable data structure that * stream stores buffered bytes in a rope-like immutable data structure that
@ -31,7 +30,7 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
private var buffer: ByteString = ByteString.empty private var buffer: ByteString = ByteString.empty
/** @inheritdoc **/ /** @inheritdoc */
override def read(): Int = lock.synchronized { override def read(): Int = lock.synchronized {
waitForBuffer() waitForBuffer()
val byte = buffer.head val byte = buffer.head
@ -40,10 +39,10 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
byte.toInt byte.toInt
} }
/** @inheritdoc **/ /** @inheritdoc */
override def read(array: Array[Byte]): Int = read(array, 0, array.length) override def read(array: Array[Byte]): Int = read(array, 0, array.length)
/** @inheritdoc **/ /** @inheritdoc */
override def read(array: Array[Byte], off: Int, len: Int): Int = override def read(array: Array[Byte], off: Int, len: Int): Int =
lock.synchronized { lock.synchronized {
waitForBuffer() waitForBuffer()
@ -61,12 +60,12 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
lock.wait() lock.wait()
} }
/** @inheritdoc **/ /** @inheritdoc */
override def available(): Int = lock.synchronized { override def available(): Int = lock.synchronized {
buffer.length buffer.length
} }
/** @inheritdoc **/ /** @inheritdoc */
override def update(output: Array[Byte]): Unit = lock.synchronized { override def update(output: Array[Byte]): Unit = lock.synchronized {
buffer = ByteString.createBuilder buffer = ByteString.createBuilder
.append(buffer) .append(buffer)
@ -75,8 +74,7 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
lock.notifyAll() lock.notifyAll()
} }
/** /** Attaches an input observer.
* Attaches an input observer.
* *
* @param observer the observer that subscribe for input events * @param observer the observer that subscribe for input events
*/ */
@ -84,8 +82,7 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
observers += observer observers += observer
} }
/** /** Detaches an input observer.
* Detaches an input observer.
* *
* @param observer the observer that was subscribed for input events * @param observer the observer that was subscribed for input events
*/ */
@ -102,25 +99,21 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
object ObservablePipedInputStream { object ObservablePipedInputStream {
/** /** Base trait of input stream events.
* Base trait of input stream events.
*/ */
sealed trait InputStreamEvent sealed trait InputStreamEvent
/** /** Signals that read operation is blocked and waits for data provided by
* Signals that read operation is blocked and waits for data provided by
* connected output stream. * connected output stream.
*/ */
case object ReadBlocked extends InputStreamEvent case object ReadBlocked extends InputStreamEvent
/** /** Defines an updating interface for objects that should be notified of
* Defines an updating interface for objects that should be notified of
* events fired by the input stream. * events fired by the input stream.
*/ */
trait InputObserver { trait InputObserver {
/** /** Method used to notify an observer about input events.
* Method used to notify an observer about input events.
* *
* @param event the input stream event * @param event the input stream event
*/ */

View File

@ -1,19 +1,16 @@
package org.enso.languageserver.io package org.enso.languageserver.io
/** /** A base trait for output kind.
* A base trait for output kind.
*/ */
sealed trait OutputKind sealed trait OutputKind
object OutputKind { object OutputKind {
/** /** Standard output is a stream to which a program writes its output data.
* Standard output is a stream to which a program writes its output data.
*/ */
case object StandardOutput extends OutputKind case object StandardOutput extends OutputKind
/** /** Standard error is output stream used by programs to write error messages
* Standard error is output stream used by programs to write error messages
* or status information. * or status information.
*/ */
case object StandardError extends OutputKind case object StandardError extends OutputKind

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.io.OutputRedirectionController.CharOutputAppended
import org.enso.languageserver.session.SessionRouter.DeliverToJsonController import org.enso.languageserver.session.SessionRouter.DeliverToJsonController
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A redirection controller that listen to stdout or stderr data changes and
* A redirection controller that listen to stdout or stderr data changes and
* dispatches new output to clients that has redirected stdout or err. * dispatches new output to clients that has redirected stdout or err.
* *
* @param outputStream stdout or stderr * @param outputStream stdout or stderr
@ -57,7 +56,7 @@ class OutputRedirectionController(
context.become(running(subscribers - session.clientId)) context.become(running(subscribers - session.clientId))
} }
/** @inheritdoc **/ /** @inheritdoc */
override def update(output: Array[Byte]): Unit = override def update(output: Array[Byte]): Unit =
self ! CharOutputAppended(new String(output)) self ! CharOutputAppended(new String(output))
@ -76,8 +75,7 @@ object OutputRedirectionController {
private case class CharOutputAppended(output: String) private case class CharOutputAppended(output: String)
/** /** Creates a configuration object used to create a
* Creates a configuration object used to create a
* [[OutputRedirectionController]]. * [[OutputRedirectionController]].
* *
* @param outputStream stdout or stderr * @param outputStream stdout or stderr

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.monitoring
import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused} import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused}
/** /** The monitoring JSON RPC API provided by the language server.
* The monitoring JSON RPC API provided by the language server.
* See [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]] * See [[https://github.com/enso-org/enso/blob/main/docs/language-server/README.md]]
* for message specifications. * for message specifications.
*/ */

View File

@ -2,13 +2,11 @@ package org.enso.languageserver.monitoring
object MonitoringProtocol { object MonitoringProtocol {
/** /** A ping command.
* A ping command.
*/ */
case object Ping case object Ping
/** /** A pong reply.
* A pong reply.
*/ */
case object Pong case object Pong

View File

@ -47,8 +47,7 @@ import org.enso.languageserver.util.binary.DecodingFailure.{
import scala.annotation.unused import scala.annotation.unused
import scala.concurrent.duration._ import scala.concurrent.duration._
/** /** An actor handling data communications between a single client and the
* An actor handling data communications between a single client and the
* language server. It acts as a front controller responsible for handling * language server. It acts as a front controller responsible for handling
* all incoming requests and dispatching commands. * all incoming requests and dispatching commands.
* *

View File

@ -4,16 +4,15 @@ import akka.actor.{ActorRef, ActorSystem, Props}
import akka.http.scaladsl.model.RemoteAddress import akka.http.scaladsl.model.RemoteAddress
import org.enso.languageserver.http.server.ConnectionControllerFactory import org.enso.languageserver.http.server.ConnectionControllerFactory
/** /** A factory for binary connection controllers.
* A factory for binary connection controllers.
* *
* @param system an actor system that hosts created connection controllers * @param system an actor system that hosts created connection controllers
*/ */
class BinaryConnectionControllerFactory(fileManager: ActorRef)( class BinaryConnectionControllerFactory(fileManager: ActorRef)(implicit
implicit system: ActorSystem system: ActorSystem
) extends ConnectionControllerFactory { ) extends ConnectionControllerFactory {
/** @inheritdoc **/ /** @inheritdoc */
override def createController(clientIp: RemoteAddress.IP): ActorRef = { override def createController(clientIp: RemoteAddress.IP): ActorRef = {
system.actorOf(Props(new BinaryConnectionController(clientIp, fileManager))) system.actorOf(Props(new BinaryConnectionController(clientIp, fileManager)))
} }

View File

@ -10,12 +10,11 @@ import org.enso.languageserver.util.binary.DecodingFailure.{
} }
import org.enso.languageserver.util.binary.{BinaryDecoder, DecodingFailure} import org.enso.languageserver.util.binary.{BinaryDecoder, DecodingFailure}
/** /** A decoder for an [[InboundMessage]].
* A decoder for an [[InboundMessage]].
*/ */
object InboundMessageDecoder extends BinaryDecoder[InboundMessage] { object InboundMessageDecoder extends BinaryDecoder[InboundMessage] {
/** @inheritdoc **/ /** @inheritdoc */
override def decode( override def decode(
bytes: ByteBuffer bytes: ByteBuffer
): Either[DecodingFailure, InboundMessage] = ): Either[DecodingFailure, InboundMessage] =

View File

@ -7,8 +7,7 @@ import org.enso.languageserver.protocol.binary.EnsoUUID
object EnsoUuidFactory { object EnsoUuidFactory {
/** /** Creates EnsoUUID inside a [[FlatBufferBuilder]].
* Creates EnsoUUID inside a [[FlatBufferBuilder]].
* *
* @param uuid a uuid to serialize * @param uuid a uuid to serialize
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of
@ -24,8 +23,7 @@ object EnsoUuidFactory {
) )
} }
/** /** Creates an [[EnsoUUID]] inside a [[FlatBufferBuilder]].
* Creates an [[EnsoUUID]] inside a [[FlatBufferBuilder]].
* *
* @param uuid a uuid to serialize * @param uuid a uuid to serialize
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of

View File

@ -9,24 +9,21 @@ import org.enso.languageserver.protocol.binary.{EnsoUUID, Error}
object ErrorFactory { object ErrorFactory {
/** /** Creates a ReceivedCorruptedDataError inside a [[FlatBufferBuilder]].
* Creates a ReceivedCorruptedDataError inside a [[FlatBufferBuilder]].
* *
* @return an FlatBuffer representation of the created error * @return an FlatBuffer representation of the created error
*/ */
def createReceivedCorruptedDataError(): ByteBuffer = def createReceivedCorruptedDataError(): ByteBuffer =
createGenericError(1, "Received corrupted data") createGenericError(1, "Received corrupted data")
/** /** Creates a ReceivedEmptyPayloadError inside a [[FlatBufferBuilder]].
* Creates a ReceivedEmptyPayloadError inside a [[FlatBufferBuilder]].
* *
* @return an FlatBuffer representation of the created error * @return an FlatBuffer representation of the created error
*/ */
def createReceivedEmptyPayloadError(): ByteBuffer = def createReceivedEmptyPayloadError(): ByteBuffer =
createGenericError(2, "Received empty payload in the inbound message") createGenericError(2, "Received empty payload in the inbound message")
/** /** Creates a ServiceError inside a [[FlatBufferBuilder]].
* Creates a ServiceError inside a [[FlatBufferBuilder]].
* *
* @return an FlatBuffer representation of the created error * @return an FlatBuffer representation of the created error
*/ */
@ -35,8 +32,7 @@ object ErrorFactory {
): ByteBuffer = ): ByteBuffer =
createGenericError(0, "Service error", maybeCorrelationId) createGenericError(0, "Service error", maybeCorrelationId)
/** /** Creates a visualisation expression error as a binary packet.
* Creates a visualisation expression error as a binary packet.
* *
* @param msg an error message * @param msg an error message
* @return an FlatBuffer representation of the created error * @return an FlatBuffer representation of the created error
@ -47,8 +43,7 @@ object ErrorFactory {
s"Evaluation of the visualisation failed [$msg]" s"Evaluation of the visualisation failed [$msg]"
) )
/** /** Creates a generic error inside a [[FlatBufferBuilder]].
* Creates a generic error inside a [[FlatBufferBuilder]].
* *
* @param code an error code * @param code an error code
* @param message an error textual message * @param message an error textual message

View File

@ -10,8 +10,7 @@ import org.enso.languageserver.protocol.binary.EnsoUUID
object FileContentsReplyFactory { object FileContentsReplyFactory {
/** /** Creates a [[FileContentsReply]] inside a [[FlatBufferBuilder]].
* Creates a [[FileContentsReply]] inside a [[FlatBufferBuilder]].
* *
* @param contents the binary contents of a file * @param contents the binary contents of a file
* @param correlationId correlation id used to correlate a response with a * @param correlationId correlation id used to correlate a response with a

View File

@ -8,8 +8,7 @@ import org.enso.languageserver.protocol.binary.EnsoUUID
object OutboundMessageFactory { object OutboundMessageFactory {
/** /** Creates an [[OutboundMessage]] inside a [[FlatBufferBuilder]].
* Creates an [[OutboundMessage]] inside a [[FlatBufferBuilder]].
* *
* @param messageId a unique id of the message sent from the server * @param messageId a unique id of the message sent from the server
* @param maybeCorrelationId an optional correlation id used to correlate * @param maybeCorrelationId an optional correlation id used to correlate

View File

@ -9,8 +9,7 @@ import org.enso.languageserver.protocol.binary.{EnsoUUID, Success}
object SuccessReplyFactory { object SuccessReplyFactory {
/** /** Creates a [[Success]] inside a [[FlatBufferBuilder]].
* Creates a [[Success]] inside a [[FlatBufferBuilder]].
* *
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of
* complex objects * complex objects
@ -22,8 +21,7 @@ object SuccessReplyFactory {
Success.endSuccess(builder) Success.endSuccess(builder)
} }
/** /** Creates a [[Success]] inside a [[FlatBufferBuilder]].
* Creates a [[Success]] inside a [[FlatBufferBuilder]].
* *
* @param correlationId correlation id used to correlate a response with a * @param correlationId correlation id used to correlate a response with a
* request * request

View File

@ -12,8 +12,7 @@ import org.enso.languageserver.runtime.ContextRegistryProtocol.{
object VisualisationUpdateFactory { object VisualisationUpdateFactory {
/** /** Creates a [[VisualisationUpdate]] inside a [[FlatBufferBuilder]].
* Creates a [[VisualisationUpdate]] inside a [[FlatBufferBuilder]].
* *
* @param update a visualisation update * @param update a visualisation update
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of
@ -21,8 +20,8 @@ object VisualisationUpdateFactory {
* @return an offset pointing to the FlatBuffer representation of the * @return an offset pointing to the FlatBuffer representation of the
* created object * created object
*/ */
def create(update: VisualisationUpdate)( def create(update: VisualisationUpdate)(implicit
implicit builder: FlatBufferBuilder builder: FlatBufferBuilder
): Int = { ): Int = {
val ctx = createVisualisationCtx(update.visualisationContext) val ctx = createVisualisationCtx(update.visualisationContext)
val data = val data =
@ -34,8 +33,7 @@ object VisualisationUpdateFactory {
) )
} }
/** /** Creates a [[VisualisationContext]] inside a [[FlatBufferBuilder]].
* Creates a [[VisualisationContext]] inside a [[FlatBufferBuilder]].
* *
* @param ctx a VisualisationContext * @param ctx a VisualisationContext
* @param builder a class that helps build a FlatBuffer representation of * @param builder a class that helps build a FlatBuffer representation of
@ -43,8 +41,8 @@ object VisualisationUpdateFactory {
* @return an offset pointing to the FlatBuffer representation of the * @return an offset pointing to the FlatBuffer representation of the
* created object * created object
*/ */
def createVisualisationCtx(ctx: VisualisationContext)( def createVisualisationCtx(ctx: VisualisationContext)(implicit
implicit builder: FlatBufferBuilder builder: FlatBufferBuilder
): Int = { ): Int = {
BinaryVisualisationContext.startVisualisationContext(builder) BinaryVisualisationContext.startVisualisationContext(builder)
BinaryVisualisationContext.addContextId( BinaryVisualisationContext.addContextId(

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.protocol.json
import org.enso.jsonrpc.Error import org.enso.jsonrpc.Error
/** /** Generic errors provided by the language server.
* Generic errors provided by the language server.
* *
* @see [[https://github.com/enso-org/enso/blob/main/docs/language-server/protocol-language-server.md#errors---language-server]] * @see [[https://github.com/enso-org/enso/blob/main/docs/language-server/protocol-language-server.md#errors---language-server]]
*/ */

View File

@ -61,8 +61,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration._ import scala.concurrent.duration._
/** /** An actor handling communications between a single client and the language
* An actor handling communications between a single client and the language
* server. * server.
* *
* @param connectionId the internal connection id. * @param connectionId the internal connection id.
@ -309,8 +308,7 @@ class JsonConnectionController(
object JsonConnectionController { object JsonConnectionController {
/** /** Creates a configuration object used to create a [[JsonConnectionController]].
* Creates a configuration object used to create a [[JsonConnectionController]].
* *
* @param connectionId the internal connection id. * @param connectionId the internal connection id.
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests

View File

@ -5,8 +5,7 @@ import java.util.UUID
import akka.actor.{ActorRef, ActorSystem} import akka.actor.{ActorRef, ActorSystem}
import org.enso.jsonrpc.ClientControllerFactory import org.enso.jsonrpc.ClientControllerFactory
/** /** Language server client controller factory.
* Language server client controller factory.
* *
* @param bufferRegistry the buffer registry actor ref * @param bufferRegistry the buffer registry actor ref
* @param capabilityRouter the capability router actor ref * @param capabilityRouter the capability router actor ref
@ -25,8 +24,7 @@ class JsonConnectionControllerFactory(
)(implicit system: ActorSystem) )(implicit system: ActorSystem)
extends ClientControllerFactory { extends ClientControllerFactory {
/** /** Creates a client controller actor.
* Creates a client controller actor.
* *
* @param clientId the internal client id. * @param clientId the internal client id.
* @return * @return

View File

@ -20,8 +20,7 @@ import org.enso.languageserver.text.TextApi._
object JsonRpc { object JsonRpc {
/** /** A description of supported JSON RPC messages.
* A description of supported JSON RPC messages.
*/ */
val protocol: Protocol = Protocol.empty val protocol: Protocol = Protocol.empty
.registerRequest(Ping) .registerRequest(Ping)

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.refactoring
import org.enso.languageserver.event.Event import org.enso.languageserver.event.Event
/** /** An event notifying that project name has changed.
* An event notifying that project name has changed.
* *
* @param oldName the old name of the project * @param oldName the old name of the project
* @param newName the new project name * @param newName the new project name

View File

@ -2,8 +2,7 @@ package org.enso.languageserver.refactoring
import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused} import org.enso.jsonrpc.{HasParams, HasResult, Method, Unused}
/** /** The refactoring JSON RPC API provided by the language server.
* The refactoring JSON RPC API provided by the language server.
* See [[https://github.com/luna/enso/blob/main/docs/language-server/README.md]] * See [[https://github.com/luna/enso/blob/main/docs/language-server/README.md]]
* for message specifications. * for message specifications.
*/ */

View File

@ -1,6 +1,5 @@
package org.enso.languageserver.requesthandler package org.enso.languageserver.requesthandler
/** /** Signals that operation has timed out.
* Signals that operation has timed out.
*/ */
case object RequestTimeout case object RequestTimeout

View File

@ -18,8 +18,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `capability/acquire` commands.
* A request handler for `capability/acquire` commands.
* *
* @param capabilityRouter a router that dispatches capability requests * @param capabilityRouter a router that dispatches capability requests
* @param timeout a request timeout * @param timeout a request timeout
@ -80,8 +79,7 @@ class AcquireCapabilityHandler(
object AcquireCapabilityHandler { object AcquireCapabilityHandler {
/** /** Creates a configuration object used to create a [[AcquireCapabilityHandler]]
* Creates a configuration object used to create a [[AcquireCapabilityHandler]]
* *
* @param capabilityRouter a router that dispatches capability requests * @param capabilityRouter a router that dispatches capability requests
* @param requestTimeout a request timeout * @param requestTimeout a request timeout

View File

@ -20,8 +20,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `capability/release` commands.
* A request handler for `capability/release` commands.
* *
* @param capabilityRouter a router that dispatches capability requests * @param capabilityRouter a router that dispatches capability requests
* @param timeout a request timeout * @param timeout a request timeout
@ -75,8 +74,7 @@ class ReleaseCapabilityHandler(
object ReleaseCapabilityHandler { object ReleaseCapabilityHandler {
/** /** Creates a configuration object used to create a [[ReleaseCapabilityHandler]]
* Creates a configuration object used to create a [[ReleaseCapabilityHandler]]
* *
* @param capabilityRouter a router that dispatches capability requests * @param capabilityRouter a router that dispatches capability requests
* @param requestTimeout a request timeout * @param requestTimeout a request timeout

View File

@ -19,8 +19,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/create` commands.
* A request handler for `executionContext/create` commands.
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
@ -75,8 +74,7 @@ class CreateHandler(
object CreateHandler { object CreateHandler {
/** /** Creates configuration object used to create a [[CreateHandler]].
* Creates configuration object used to create a [[CreateHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/destroy` commands.
* A request handler for `executionContext/destroy` commands.
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
@ -36,9 +35,9 @@ class DestroyHandler(
private def requestStage: Receive = { private def requestStage: Receive = {
case Request( case Request(
ExecutionContextDestroy, ExecutionContextDestroy,
id, id,
params: ExecutionContextDestroy.Params params: ExecutionContextDestroy.Params
) => ) =>
contextRegistry ! DestroyContextRequest(session, params.contextId) contextRegistry ! DestroyContextRequest(session, params.contextId)
val cancellable = val cancellable =
@ -70,8 +69,7 @@ class DestroyHandler(
object DestroyHandler { object DestroyHandler {
/** /** Creates configuration object used to create a [[DestroyHandler]].
* Creates configuration object used to create a [[DestroyHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/push` commands.
* A request handler for `executionContext/push` commands.
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
@ -66,8 +65,7 @@ class PopHandler(
object PopHandler { object PopHandler {
/** /** Creates configuration object used to create a [[PopHandler]].
* Creates configuration object used to create a [[PopHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/push` commands.
* A request handler for `executionContext/push` commands.
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
@ -36,9 +35,9 @@ class PushHandler(
private def requestStage: Receive = { private def requestStage: Receive = {
case Request( case Request(
ExecutionContextPush, ExecutionContextPush,
id, id,
params: ExecutionContextPush.Params params: ExecutionContextPush.Params
) => ) =>
contextRegistry ! PushContextRequest( contextRegistry ! PushContextRequest(
session, session,
@ -74,8 +73,7 @@ class PushHandler(
object PushHandler { object PushHandler {
/** /** Creates configuration object used to create a [[PushHandler]].
* Creates configuration object used to create a [[PushHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/recompute` commands.
* A request handler for `executionContext/recompute` commands.
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.
@ -36,9 +35,9 @@ class RecomputeHandler(
private def requestStage: Receive = { private def requestStage: Receive = {
case Request( case Request(
ExecutionContextRecompute, ExecutionContextRecompute,
id, id,
params: ExecutionContextRecompute.Params params: ExecutionContextRecompute.Params
) => ) =>
contextRegistry ! RecomputeContextRequest( contextRegistry ! RecomputeContextRequest(
session, session,
@ -74,8 +73,7 @@ class RecomputeHandler(
object RecomputeHandler { object RecomputeHandler {
/** /** Creates configuration object used to create a [[RecomputeHandler]].
* Creates configuration object used to create a [[RecomputeHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param contextRegistry a reference to the context registry. * @param contextRegistry a reference to the context registry.

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `file/info` command.
* A request handler for `file/info` command.
* *
* @param requestTimeout a request timeout * @param requestTimeout a request timeout
* @param fileManager a file system manager actor * @param fileManager a file system manager actor
@ -69,8 +68,7 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
object InfoFileHandler { object InfoFileHandler {
/** /** Creates a configuration object used to create a [[InfoFileHandler]]
* Creates a configuration object used to create a [[InfoFileHandler]]
* *
* @param requestTimeout a request timeout * @param requestTimeout a request timeout
* @param fileManager a file system manager actor * @param fileManager a file system manager actor

View File

@ -20,8 +20,7 @@ import org.enso.languageserver.util.file.PathUtils
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for [[ReadFileCommand]].
* A request handler for [[ReadFileCommand]].
* *
* @param requestTimeout a request timeout * @param requestTimeout a request timeout
* @param fileManager a file system manager actor * @param fileManager a file system manager actor
@ -39,15 +38,14 @@ class ReadBinaryFileHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { private def requestStage: Receive = { case msg: InboundMessage =>
case msg: InboundMessage => val payload =
val payload = msg.payload(new ReadFileCommand).asInstanceOf[ReadFileCommand]
msg.payload(new ReadFileCommand).asInstanceOf[ReadFileCommand] val path = PathUtils.convertBinaryPath(payload.path())
val path = PathUtils.convertBinaryPath(payload.path()) fileManager ! FileManagerProtocol.ReadBinaryFile(path)
fileManager ! FileManagerProtocol.ReadBinaryFile(path) val cancellable = context.system.scheduler
val cancellable = context.system.scheduler .scheduleOnce(requestTimeout, self, RequestTimeout)
.scheduleOnce(requestTimeout, self, RequestTimeout) context.become(responseStage(msg.messageId(), cancellable))
context.become(responseStage(msg.messageId(), cancellable))
} }
private def responseStage( private def responseStage(
@ -90,8 +88,7 @@ class ReadBinaryFileHandler(
object ReadBinaryFileHandler { object ReadBinaryFileHandler {
/** /** Creates a configuration object used to create a [[ReadBinaryFileHandler]]
* Creates a configuration object used to create a [[ReadBinaryFileHandler]]
* *
* @param timeout a request timeout * @param timeout a request timeout
* @param fileManager a file system manager actor * @param fileManager a file system manager actor

View File

@ -20,8 +20,7 @@ import org.enso.languageserver.util.file.PathUtils
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for [[WriteFileCommand]].
* A request handler for [[WriteFileCommand]].
* *
* @param requestTimeout a request timeout * @param requestTimeout a request timeout
* @param fileManager a file system manager actor * @param fileManager a file system manager actor
@ -39,18 +38,17 @@ class WriteBinaryFileHandler(
override def receive: Receive = requestStage override def receive: Receive = requestStage
private def requestStage: Receive = { private def requestStage: Receive = { case msg: InboundMessage =>
case msg: InboundMessage => val payload =
val payload = msg.payload(new WriteFileCommand).asInstanceOf[WriteFileCommand]
msg.payload(new WriteFileCommand).asInstanceOf[WriteFileCommand] val path = PathUtils.convertBinaryPath(payload.path())
val path = PathUtils.convertBinaryPath(payload.path()) val bytes = payload.contentsAsByteBuffer()
val bytes = payload.contentsAsByteBuffer() val contents = Array.fill[Byte](bytes.remaining())(0)
val contents = Array.fill[Byte](bytes.remaining())(0) bytes.get(contents)
bytes.get(contents) fileManager ! FileManagerProtocol.WriteBinaryFile(path, contents)
fileManager ! FileManagerProtocol.WriteBinaryFile(path, contents) val cancellable = context.system.scheduler
val cancellable = context.system.scheduler .scheduleOnce(requestTimeout, self, RequestTimeout)
.scheduleOnce(requestTimeout, self, RequestTimeout) context.become(responseStage(msg.messageId(), cancellable))
context.become(responseStage(msg.messageId(), cancellable))
} }
private def responseStage( private def responseStage(
@ -92,8 +90,7 @@ class WriteBinaryFileHandler(
object WriteBinaryFileHandler { object WriteBinaryFileHandler {
/** /** Creates a configuration object used to create a [[WriteBinaryFileHandler]]
* Creates a configuration object used to create a [[WriteBinaryFileHandler]]
* *
* @param timeout a request timeout * @param timeout a request timeout
* @param fileManager a file system manager actor * @param fileManager a file system manager actor

View File

@ -6,8 +6,7 @@ import org.enso.languageserver.io.InputOutputApi.FeedStandardInput
import org.enso.languageserver.io.InputOutputProtocol import org.enso.languageserver.io.InputOutputProtocol
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A request handler for `io/feedStandardInput` commands.
* A request handler for `io/feedStandardInput` commands.
* *
* @param stdInController the stdin redirection controller * @param stdInController the stdin redirection controller
*/ */
@ -30,8 +29,7 @@ class FeedStandardInputHandler(stdInController: ActorRef)
object FeedStandardInputHandler { object FeedStandardInputHandler {
/** /** Creates a configuration object used to create a
* Creates a configuration object used to create a
* [[FeedStandardInputHandler]]. * [[FeedStandardInputHandler]].
* *
* @param stdInController the stdin redirection controller * @param stdInController the stdin redirection controller

View File

@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.RedirectStandardError
import org.enso.languageserver.io.InputOutputProtocol import org.enso.languageserver.io.InputOutputProtocol
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A request handler for `io/redirectStandardError` commands.
* A request handler for `io/redirectStandardError` commands.
* *
* @param stdErrController an output redirection controller * @param stdErrController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection
@ -29,8 +28,7 @@ class RedirectStdErrHandler(stdErrController: ActorRef, clientId: ClientId)
object RedirectStdErrHandler { object RedirectStdErrHandler {
/** /** Creates a configuration object used to create a [[RedirectStdErrHandler]].
* Creates a configuration object used to create a [[RedirectStdErrHandler]].
* *
* @param stdErrController an output redirection controller * @param stdErrController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection

View File

@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.RedirectStandardOutput
import org.enso.languageserver.io.InputOutputProtocol import org.enso.languageserver.io.InputOutputProtocol
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A request handler for `io/redirectStandardOutput` commands.
* A request handler for `io/redirectStandardOutput` commands.
* *
* @param stdOutController an output redirection controller * @param stdOutController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection
@ -29,8 +28,7 @@ class RedirectStdOutHandler(stdOutController: ActorRef, clientId: ClientId)
object RedirectStdOutHandler { object RedirectStdOutHandler {
/** /** Creates a configuration object used to create a [[RedirectStdOutHandler]].
* Creates a configuration object used to create a [[RedirectStdOutHandler]].
* *
* @param stdOutController an output redirection controller * @param stdOutController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection

View File

@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.SuppressStandardError
import org.enso.languageserver.io.InputOutputProtocol import org.enso.languageserver.io.InputOutputProtocol
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A request handler for `io/suppressStandardError` commands.
* A request handler for `io/suppressStandardError` commands.
* *
* @param stdErrController an output redirection controller * @param stdErrController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection
@ -29,8 +28,7 @@ class SuppressStdErrHandler(stdErrController: ActorRef, clientId: ClientId)
object SuppressStdErrHandler { object SuppressStdErrHandler {
/** /** Creates a configuration object used to create a [[SuppressStdErrHandler]].
*Creates a configuration object used to create a [[SuppressStdErrHandler]].
* *
* @param stdErrController an output redirection controller * @param stdErrController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection

View File

@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.SuppressStandardOutput
import org.enso.languageserver.io.InputOutputProtocol import org.enso.languageserver.io.InputOutputProtocol
import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.util.UnhandledLogging
/** /** A request handler for `io/suppressStandardOutput` commands.
* A request handler for `io/suppressStandardOutput` commands.
* *
* @param stdOutController an output redirection controller * @param stdOutController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection
@ -28,8 +27,7 @@ class SuppressStdOutHandler(stdOutController: ActorRef, clientId: ClientId)
object SuppressStdOutHandler { object SuppressStdOutHandler {
/** /** Creates a configuration object used to create a [[SuppressStdOutHandler]].
* Creates a configuration object used to create a [[SuppressStdOutHandler]].
* *
* @param stdOutController an output redirection controller * @param stdOutController an output redirection controller
* @param clientId a client requesting redirection * @param clientId a client requesting redirection

View File

@ -8,8 +8,7 @@ import org.enso.languageserver.requesthandler.RequestTimeout
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `heartbeat/ping` commands.
* A request handler for `heartbeat/ping` commands.
* *
* @param subsystems a list of monitored subsystems * @param subsystems a list of monitored subsystems
* @param timeout a request timeout * @param timeout a request timeout
@ -63,8 +62,7 @@ class PingHandler(
object PingHandler { object PingHandler {
/** /** Creates a configuration object used to create a [[PingHandler]]
* Creates a configuration object used to create a [[PingHandler]]
* *
* @param subsystems a list of monitored subsystems * @param subsystems a list of monitored subsystems
* @param timeout a request timeout * @param timeout a request timeout

View File

@ -13,8 +13,7 @@ import org.enso.polyglot.runtime.Runtime.Api
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `refactoring/renameProject` commands.
* A request handler for `refactoring/renameProject` commands.
* *
* @param timeout a request timeout * @param timeout a request timeout
* @param runtimeConnector a reference to the runtime connector * @param runtimeConnector a reference to the runtime connector
@ -66,8 +65,7 @@ class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef)
object RenameProjectHandler { object RenameProjectHandler {
/** /** Creates configuration object used to create a [[RenameProjectHandler]].
* Creates configuration object used to create a [[RenameProjectHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param runtimeConnector reference to the runtime connector * @param runtimeConnector reference to the runtime connector

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `search/completion` command.
* A request handler for `search/completion` command.
* *
* @param timeout request timeout * @param timeout request timeout
* @param suggestionsHandler a reference to the suggestions handler * @param suggestionsHandler a reference to the suggestions handler
@ -80,8 +79,7 @@ class CompletionHandler(
object CompletionHandler { object CompletionHandler {
/** /** Creates configuration object used to create a [[CompletionHandler]].
* Creates configuration object used to create a [[CompletionHandler]].
* *
* @param timeout request timeout * @param timeout request timeout
* @param suggestionsHandler a reference to the suggestions handler * @param suggestionsHandler a reference to the suggestions handler

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `search/getSuggestionsDatabase` command.
* A request handler for `search/getSuggestionsDatabase` command.
* *
* @param timeout request timeout * @param timeout request timeout
* @param suggestionsHandler a reference to the suggestions handler * @param suggestionsHandler a reference to the suggestions handler
@ -70,8 +69,7 @@ class GetSuggestionsDatabaseHandler(
object GetSuggestionsDatabaseHandler { object GetSuggestionsDatabaseHandler {
/** /** Creates configuration object used to create a
* Creates configuration object used to create a
* [[GetSuggestionsDatabaseHandler]]. * [[GetSuggestionsDatabaseHandler]].
* *
* @param timeout request timeout * @param timeout request timeout

View File

@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `search/getSuggestionsDatabaseVersion` command.
* A request handler for `search/getSuggestionsDatabaseVersion` command.
* *
* @param timeout request timeout * @param timeout request timeout
* @param suggestionsHandler a reference to the suggestions handler * @param suggestionsHandler a reference to the suggestions handler
@ -70,8 +69,7 @@ class GetSuggestionsDatabaseVersionHandler(
object GetSuggestionsDatabaseVersionHandler { object GetSuggestionsDatabaseVersionHandler {
/** /** Creates configuration object used to create a
* Creates configuration object used to create a
* [[GetSuggestionsDatabaseVersionHandler]]. * [[GetSuggestionsDatabaseVersionHandler]].
* *
* @param timeout request timeout * @param timeout request timeout

View File

@ -17,8 +17,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `search/invalidateSuggestionsDatabase` command.
* A request handler for `search/invalidateSuggestionsDatabase` command.
* *
* @param timeout request timeout * @param timeout request timeout
* @param suggestionsHandler a reference to the suggestions handler * @param suggestionsHandler a reference to the suggestions handler
@ -75,8 +74,7 @@ class InvalidateSuggestionsDatabaseHandler(
object InvalidateSuggestionsDatabaseHandler { object InvalidateSuggestionsDatabaseHandler {
/** /** Creates configuration object used to create a
* Creates configuration object used to create a
* [[InvalidateSuggestionsDatabaseHandler]]. * [[InvalidateSuggestionsDatabaseHandler]].
* *
* @param timeout request timeout * @param timeout request timeout

View File

@ -11,8 +11,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `session/initProtocolConnection` commands.
* A request handler for `session/initProtocolConnection` commands.
* *
* @param fileManager a file manager reference * @param fileManager a file manager reference
* @param timeout a request timeout * @param timeout a request timeout
@ -60,8 +59,7 @@ class InitProtocolConnectionHandler(
object InitProtocolConnectionHandler { object InitProtocolConnectionHandler {
/** /** Creates a configuration object used to create a [[InitProtocolConnectionHandler]]
* Creates a configuration object used to create a [[InitProtocolConnectionHandler]]
* *
* @param fileManager a file manager reference * @param fileManager a file manager reference
* @param timeout a request timeout * @param timeout a request timeout

View File

@ -12,8 +12,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `text/applyEdit` commands.
* A request handler for `text/applyEdit` commands.
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param timeout a request timeout * @param timeout a request timeout
@ -81,8 +80,7 @@ class ApplyEditHandler(
object ApplyEditHandler { object ApplyEditHandler {
/** /** Creates a configuration object used to create a [[ApplyEditHandler]]
* Creates a configuration object used to create a [[ApplyEditHandler]]
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param requestTimeout a request timeout * @param requestTimeout a request timeout

View File

@ -12,8 +12,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `text/closeFile` commands.
* A request handler for `text/closeFile` commands.
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param timeout a request timeout * @param timeout a request timeout
@ -63,8 +62,7 @@ class CloseFileHandler(
object CloseFileHandler { object CloseFileHandler {
/** /** Creates a configuration object used to create a [[CloseFileHandler]]
* Creates a configuration object used to create a [[CloseFileHandler]]
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param requestTimeout a request timeout * @param requestTimeout a request timeout

View File

@ -16,8 +16,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `text/openFile` commands.
* A request handler for `text/openFile` commands.
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param timeout a request timeout * @param timeout a request timeout
@ -75,8 +74,7 @@ class OpenFileHandler(
object OpenFileHandler { object OpenFileHandler {
/** /** Creates a configuration object used to create a [[OpenFileHandler]]
* Creates a configuration object used to create a [[OpenFileHandler]]
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param requestTimeout a request timeout * @param requestTimeout a request timeout

View File

@ -18,8 +18,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `text/save` commands.
* A request handler for `text/save` commands.
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param timeout a request timeout * @param timeout a request timeout
@ -94,8 +93,7 @@ class SaveFileHandler(
object SaveFileHandler { object SaveFileHandler {
/** /** Creates a configuration object used to create a [[SaveFileHandler]].
* Creates a configuration object used to create a [[SaveFileHandler]].
* *
* @param bufferRegistry a router that dispatches text editing requests * @param bufferRegistry a router that dispatches text editing requests
* @param requestTimeout a request timeout * @param requestTimeout a request timeout

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/attachVisualisation` commands.
* A request handler for `executionContext/attachVisualisation` commands.
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
@ -71,8 +70,7 @@ class AttachVisualisationHandler(
object AttachVisualisationHandler { object AttachVisualisationHandler {
/** /** Creates configuration object used to create a [[AttachVisualisationHandler]].
* Creates configuration object used to create a [[AttachVisualisationHandler]].
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/detachVisualisation` commands.
* A request handler for `executionContext/detachVisualisation` commands.
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
@ -71,8 +70,7 @@ class DetachVisualisationHandler(
object DetachVisualisationHandler { object DetachVisualisationHandler {
/** /** Creates configuration object used to create a [[DetachVisualisationHandler]].
* Creates configuration object used to create a [[DetachVisualisationHandler]].
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout

View File

@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
import scala.concurrent.duration.FiniteDuration import scala.concurrent.duration.FiniteDuration
/** /** A request handler for `executionContext/modifyVisualisation` commands.
* A request handler for `executionContext/modifyVisualisation` commands.
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout
@ -70,8 +69,7 @@ class ModifyVisualisationHandler(
object ModifyVisualisationHandler { object ModifyVisualisationHandler {
/** /** Creates configuration object used to create a [[ModifyVisualisationHandler]].
* Creates configuration object used to create a [[ModifyVisualisationHandler]].
* *
* @param clientId an unique identifier of the client * @param clientId an unique identifier of the client
* @param timeout request timeout * @param timeout request timeout

View File

@ -24,8 +24,7 @@ import org.enso.searcher.SuggestionsRepo
import scala.concurrent.Future import scala.concurrent.Future
import scala.concurrent.duration._ import scala.concurrent.duration._
/** /** EventListener listens event stream for the notifications from the runtime
* EventListener listens event stream for the notifications from the runtime
* and send updates to the client. The listener is created per context, and * and send updates to the client. The listener is created per context, and
* only handles the notifications with the given `contextId`. * only handles the notifications with the given `contextId`.
* *
@ -122,9 +121,8 @@ final class ContextEventsListener(
val methodPointerToSuggestion = val methodPointerToSuggestion =
methodPointers methodPointers
.zip(suggestionIds) .zip(suggestionIds)
.collect { .collect { case (ptr, Some(suggestionId)) =>
case (ptr, Some(suggestionId)) => ptr -> suggestionId
ptr -> suggestionId
} }
.toMap .toMap
val valueUpdates = expressionUpdates.map { update => val valueUpdates = expressionUpdates.map { update =>
@ -155,8 +153,7 @@ final class ContextEventsListener(
case RunExpressionUpdates if expressionUpdates.isEmpty => case RunExpressionUpdates if expressionUpdates.isEmpty =>
} }
/** /** Convert the runtime failure message to the context registry protocol
* Convert the runtime failure message to the context registry protocol
* representation. * representation.
* *
* @param error the error message * @param error the error message
@ -170,8 +167,7 @@ final class ContextEventsListener(
error.file.flatMap(config.findRelativePath) error.file.flatMap(config.findRelativePath)
) )
/** /** Convert the runtime diagnostic message to the context registry protocol
* Convert the runtime diagnostic message to the context registry protocol
* representation. * representation.
* *
* @param diagnostic the diagnostic message * @param diagnostic the diagnostic message
@ -188,8 +184,7 @@ final class ContextEventsListener(
diagnostic.stack.map(toStackTraceElement) diagnostic.stack.map(toStackTraceElement)
) )
/** /** Convert the runtime diagnostic type to the context registry protocol
* Convert the runtime diagnostic type to the context registry protocol
* representation. * representation.
* *
* @param kind the diagnostic type * @param kind the diagnostic type
@ -203,8 +198,7 @@ final class ContextEventsListener(
case Api.DiagnosticType.Warning() => ExecutionDiagnosticKind.Warning case Api.DiagnosticType.Warning() => ExecutionDiagnosticKind.Warning
} }
/** /** Convert the runtime stack trace element to the context registry protocol
* Convert the runtime stack trace element to the context registry protocol
* representation. * representation.
* *
* @param element the runtime stack trace element * @param element the runtime stack trace element
@ -225,8 +219,7 @@ object ContextEventsListener {
/** The action to process the expression updates. */ /** The action to process the expression updates. */
case object RunExpressionUpdates case object RunExpressionUpdates
/** /** Creates a configuration object used to create a [[ContextEventsListener]].
* Creates a configuration object used to create a [[ContextEventsListener]].
* *
* @param config the language server configuration * @param config the language server configuration
* @param repo the suggestions repo * @param repo the suggestions repo

Some files were not shown because too many files have changed in this diff Show More