mirror of
https://github.com/enso-org/enso.git
synced 2024-11-21 16:36:59 +03:00
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:
parent
0740905306
commit
746521f8b2
2
.github/settings.yml
vendored
2
.github/settings.yml
vendored
@ -251,6 +251,6 @@ branches:
|
||||
- "Rust Test Native (windows-latest)"
|
||||
- "Rust Test WASM"
|
||||
- "license/cla"
|
||||
- "Vulnerability Scan"
|
||||
# - "Vulnerability Scan" # CodeQL is temporarily disabled due to incompatibility
|
||||
enforce_admins: null
|
||||
restrictions: null
|
||||
|
18
.github/workflows/codeql-analysis.yml
vendored
18
.github/workflows/codeql-analysis.yml
vendored
@ -1,13 +1,19 @@
|
||||
name: "CodeQL"
|
||||
|
||||
# CodeQL is temporarily disabled because it seems that it is unable to discover
|
||||
# code compiled with SBT.
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "release/*"
|
||||
branches-ignore:
|
||||
- "**"
|
||||
# branches:
|
||||
# - main
|
||||
# - "release/*"
|
||||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
branches-ignore:
|
||||
- "**"
|
||||
# branches:
|
||||
# - "*"
|
||||
|
||||
env:
|
||||
# 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
|
||||
javaVersion: 11
|
||||
# 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
|
||||
rustToolchain: nightly-2019-11-04
|
||||
|
||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -11,7 +11,7 @@ env:
|
||||
# Please ensure that this is in sync with javaVersion in build.sbt
|
||||
javaVersion: 11
|
||||
# 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
|
||||
rustToolchain: nightly-2019-11-04
|
||||
|
||||
|
2
.github/workflows/scala.yml
vendored
2
.github/workflows/scala.yml
vendored
@ -12,7 +12,7 @@ env:
|
||||
# Please ensure that this is in sync with javaVersion in build.sbt
|
||||
javaVersion: 11
|
||||
# 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
|
||||
rustToolchain: nightly-2019-11-04
|
||||
excludedPaths: |
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -96,6 +96,7 @@ bench-report.xml
|
||||
|
||||
.editorconfig
|
||||
.bloop/
|
||||
.bsp/
|
||||
|
||||
#################
|
||||
## Build Cache ##
|
||||
|
@ -3,7 +3,7 @@
|
||||
// All Scala files should be reformatted through this formatter before being
|
||||
// committed to the repositories.
|
||||
|
||||
version = "2.6.2"
|
||||
version = "2.7.4"
|
||||
|
||||
// Wrapping and Alignment
|
||||
align = most
|
||||
|
635
build.sbt
635
build.sbt
@ -30,7 +30,9 @@ scalaVersion in ThisBuild := scalacVersion
|
||||
|
||||
lazy val gatherLicenses =
|
||||
taskKey[Unit]("Gathers licensing information for relevant dependencies")
|
||||
gatherLicenses := GatherLicenses.run.value
|
||||
gatherLicenses := {
|
||||
GatherLicenses.run.value
|
||||
}
|
||||
lazy val verifyLicensePackages =
|
||||
taskKey[Unit](
|
||||
"Verifies if the license package has been generated, " +
|
||||
@ -38,27 +40,27 @@ lazy val verifyLicensePackages =
|
||||
)
|
||||
verifyLicensePackages := GatherLicenses.verifyReports.value
|
||||
GatherLicenses.distributions := Seq(
|
||||
Distribution(
|
||||
"launcher",
|
||||
file("distribution/launcher/THIRD-PARTY"),
|
||||
Distribution.sbtProjects(launcher)
|
||||
),
|
||||
Distribution(
|
||||
"engine",
|
||||
file("distribution/engine/THIRD-PARTY"),
|
||||
Distribution.sbtProjects(
|
||||
runtime,
|
||||
`engine-runner`,
|
||||
`project-manager`,
|
||||
`language-server`
|
||||
)
|
||||
),
|
||||
Distribution(
|
||||
"std-lib-Base",
|
||||
file("distribution/std-lib/Base/THIRD-PARTY"),
|
||||
Distribution.sbtProjects(`std-bits`)
|
||||
Distribution(
|
||||
"launcher",
|
||||
file("distribution/launcher/THIRD-PARTY"),
|
||||
Distribution.sbtProjects(launcher)
|
||||
),
|
||||
Distribution(
|
||||
"engine",
|
||||
file("distribution/engine/THIRD-PARTY"),
|
||||
Distribution.sbtProjects(
|
||||
runtime,
|
||||
`engine-runner`,
|
||||
`project-manager`,
|
||||
`language-server`
|
||||
)
|
||||
),
|
||||
Distribution(
|
||||
"std-lib-Base",
|
||||
file("distribution/std-lib/Base/THIRD-PARTY"),
|
||||
Distribution.sbtProjects(`std-bits`)
|
||||
)
|
||||
)
|
||||
GatherLicenses.licenseConfigurations := Set("compile")
|
||||
GatherLicenses.configurationRoot := file("tools/legal-review")
|
||||
|
||||
@ -68,7 +70,7 @@ lazy val openLegalReviewReport =
|
||||
"report in review mode in the browser."
|
||||
)
|
||||
openLegalReviewReport := {
|
||||
gatherLicenses.value
|
||||
val _ = gatherLicenses.value
|
||||
GatherLicenses.runReportServer()
|
||||
}
|
||||
|
||||
@ -82,49 +84,49 @@ Global / onChangedBuildSource := ReloadOnSourceChanges
|
||||
// ============================================================================
|
||||
|
||||
javacOptions in ThisBuild ++= Seq(
|
||||
"-encoding", // Provide explicit encoding (the next line)
|
||||
"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.
|
||||
)
|
||||
"-encoding", // Provide explicit encoding (the next line)
|
||||
"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.
|
||||
)
|
||||
|
||||
scalacOptions in ThisBuild ++= Seq(
|
||||
"-deprecation", // Emit warning and location for usages of deprecated APIs.
|
||||
"-encoding", // Provide explicit encoding (the next line)
|
||||
"utf-8", // Specify character encoding used by Scala source files.
|
||||
"-explaintypes", // Explain type errors in more detail.
|
||||
"-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:experimental.macros", // Allow macro definition (besides implementation and application)
|
||||
"-language:higherKinds", // Allow higher-kinded types
|
||||
"-language:implicitConversions", // Allow definition of implicit functions called views
|
||||
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
|
||||
"-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:constant", // Evaluation of a constant arithmetic expression results in an error.
|
||||
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
|
||||
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
|
||||
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
|
||||
"-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:nullary-unit", // Warn when nullary methods return Unit.
|
||||
"-Xlint:option-implicit", // Option.apply used implicit view.
|
||||
"-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:private-shadow", // A private field (or class parameter) shadows a superclass field.
|
||||
"-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.
|
||||
"-Xmacro-settings:-logging@org.enso", // Disable the debug logging globally.
|
||||
"-Ywarn-dead-code", // Warn when dead code is identified.
|
||||
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
|
||||
"-Ywarn-numeric-widen", // Warn when numerics are widened.
|
||||
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
|
||||
"-Ywarn-unused:implicits", // Warn if an implicit parameter 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:privates", // Warn if a private member 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)
|
||||
)
|
||||
"-deprecation", // Emit warning and location for usages of deprecated APIs.
|
||||
"-encoding", // Provide explicit encoding (the next line)
|
||||
"utf-8", // Specify character encoding used by Scala source files.
|
||||
"-explaintypes", // Explain type errors in more detail.
|
||||
"-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:experimental.macros", // Allow macro definition (besides implementation and application)
|
||||
"-language:higherKinds", // Allow higher-kinded types
|
||||
"-language:implicitConversions", // Allow definition of implicit functions called views
|
||||
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
|
||||
"-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:constant", // Evaluation of a constant arithmetic expression results in an error.
|
||||
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
|
||||
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
|
||||
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
|
||||
"-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:nullary-unit", // Warn when nullary methods return Unit.
|
||||
"-Xlint:option-implicit", // Option.apply used implicit view.
|
||||
"-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:private-shadow", // A private field (or class parameter) shadows a superclass field.
|
||||
"-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.
|
||||
"-Xmacro-settings:-logging@org.enso", // Disable the debug logging globally.
|
||||
"-Ywarn-dead-code", // Warn when dead code is identified.
|
||||
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
|
||||
"-Ywarn-numeric-widen", // Warn when numerics are widened.
|
||||
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
|
||||
"-Ywarn-unused:implicits", // Warn if an implicit parameter 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:privates", // Warn if a private member 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)
|
||||
)
|
||||
|
||||
val jsSettings = Seq(
|
||||
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
|
||||
@ -391,10 +393,10 @@ lazy val flexer = crossProject(JVMPlatform, JSPlatform)
|
||||
version := "0.1",
|
||||
resolvers += Resolver.sonatypeRepo("releases"),
|
||||
libraryDependencies ++= scalaCompiler ++ Seq(
|
||||
"com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305"),
|
||||
"org.typelevel" %%% "cats-core" % catsVersion,
|
||||
"org.typelevel" %%% "kittens" % kittensVersion
|
||||
)
|
||||
"com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305"),
|
||||
"org.typelevel" %%% "cats-core" % catsVersion,
|
||||
"org.typelevel" %%% "kittens" % kittensVersion
|
||||
)
|
||||
)
|
||||
.jsSettings(jsSettings)
|
||||
|
||||
@ -406,13 +408,13 @@ lazy val `syntax-definition` = crossProject(JVMPlatform, JSPlatform)
|
||||
.settings(
|
||||
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"),
|
||||
libraryDependencies ++= monocle ++ scalaCompiler ++ Seq(
|
||||
"org.typelevel" %%% "cats-core" % catsVersion,
|
||||
"org.typelevel" %%% "kittens" % kittensVersion,
|
||||
"com.lihaoyi" %%% "scalatags" % scalatagsVersion,
|
||||
"io.circe" %%% "circe-core" % circeVersion,
|
||||
"io.circe" %%% "circe-generic" % circeVersion,
|
||||
"io.circe" %%% "circe-parser" % circeVersion
|
||||
)
|
||||
"org.typelevel" %%% "cats-core" % catsVersion,
|
||||
"org.typelevel" %%% "kittens" % kittensVersion,
|
||||
"com.lihaoyi" %%% "scalatags" % scalatagsVersion,
|
||||
"io.circe" %%% "circe-core" % circeVersion,
|
||||
"io.circe" %%% "circe-generic" % circeVersion,
|
||||
"io.circe" %%% "circe-parser" % circeVersion
|
||||
)
|
||||
)
|
||||
.jsSettings(jsSettings)
|
||||
|
||||
@ -432,21 +434,21 @@ lazy val syntax = crossProject(JVMPlatform, JSPlatform)
|
||||
version := "0.1",
|
||||
logBuffered := false,
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
|
||||
"com.lihaoyi" %%% "pprint" % pprintVersion,
|
||||
"io.circe" %%% "circe-core" % circeVersion,
|
||||
"io.circe" %%% "circe-generic" % circeVersion,
|
||||
"io.circe" %%% "circe-parser" % circeVersion
|
||||
),
|
||||
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
|
||||
"com.lihaoyi" %%% "pprint" % pprintVersion,
|
||||
"io.circe" %%% "circe-core" % circeVersion,
|
||||
"io.circe" %%% "circe-generic" % circeVersion,
|
||||
"io.circe" %%% "circe-parser" % circeVersion
|
||||
),
|
||||
(Compile / compile) := (Compile / compile)
|
||||
.dependsOn(RecompileParser.run(`syntax-definition`))
|
||||
.value,
|
||||
.dependsOn(RecompileParser.run(`syntax-definition`))
|
||||
.value,
|
||||
(Test / compile) := (Test / compile)
|
||||
.dependsOn(RecompileParser.run(`syntax-definition`))
|
||||
.value,
|
||||
.dependsOn(RecompileParser.run(`syntax-definition`))
|
||||
.value,
|
||||
(Benchmark / compile) := (Benchmark / compile)
|
||||
.dependsOn(RecompileParser.run(`syntax-definition`))
|
||||
.value
|
||||
.dependsOn(RecompileParser.run(`syntax-definition`))
|
||||
.value
|
||||
)
|
||||
.jvmSettings(
|
||||
inConfig(Benchmark)(Defaults.testSettings),
|
||||
@ -455,9 +457,9 @@ lazy val syntax = crossProject(JVMPlatform, JSPlatform)
|
||||
libraryDependencies +=
|
||||
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
|
||||
testFrameworks := List(
|
||||
new TestFramework("org.scalatest.tools.Framework"),
|
||||
new TestFramework("org.scalameter.ScalaMeterFramework")
|
||||
),
|
||||
new TestFramework("org.scalatest.tools.Framework"),
|
||||
new TestFramework("org.scalameter.ScalaMeterFramework")
|
||||
),
|
||||
bench := (test in Benchmark).tag(Exclusive).value
|
||||
)
|
||||
.jsSettings(
|
||||
@ -479,10 +481,10 @@ lazy val `text-buffer` = project
|
||||
.configs(Test)
|
||||
.settings(
|
||||
libraryDependencies ++= Seq(
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
|
||||
)
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
|
||||
)
|
||||
)
|
||||
|
||||
lazy val graph = (project in file("lib/scala/graph/"))
|
||||
@ -491,18 +493,18 @@ lazy val graph = (project in file("lib/scala/graph/"))
|
||||
.settings(
|
||||
version := "0.1",
|
||||
resolvers ++= Seq(
|
||||
Resolver.sonatypeRepo("releases"),
|
||||
Resolver.sonatypeRepo("snapshots")
|
||||
),
|
||||
Resolver.sonatypeRepo("releases"),
|
||||
Resolver.sonatypeRepo("snapshots")
|
||||
),
|
||||
scalacOptions += "-Ymacro-annotations",
|
||||
libraryDependencies ++= scalaCompiler ++ Seq(
|
||||
"com.chuusai" %% "shapeless" % shapelessVersion,
|
||||
"io.estatico" %% "newtype" % newtypeVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
|
||||
"org.apache.commons" % "commons-lang3" % commonsLangVersion
|
||||
),
|
||||
"com.chuusai" %% "shapeless" % shapelessVersion,
|
||||
"io.estatico" %% "newtype" % newtypeVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
|
||||
"org.apache.commons" % "commons-lang3" % commonsLangVersion
|
||||
),
|
||||
addCompilerPlugin(
|
||||
"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"),
|
||||
version := "0.1",
|
||||
libraryDependencies ++= circe ++ Seq(
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"nl.gn0s1s" %% "bump" % bumpVersion,
|
||||
"io.circe" %% "circe-yaml" % circeYamlVersion, // separate from other circe deps because its independent project with its own versioning
|
||||
"commons-io" % "commons-io" % commonsIoVersion
|
||||
)
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"nl.gn0s1s" %% "bump" % bumpVersion,
|
||||
"io.circe" %% "circe-yaml" % circeYamlVersion, // separate from other circe deps because its independent project with its own versioning
|
||||
"commons-io" % "commons-io" % commonsIoVersion
|
||||
)
|
||||
)
|
||||
|
||||
lazy val `akka-native` = project
|
||||
@ -530,8 +532,8 @@ lazy val `akka-native` = project
|
||||
.settings(
|
||||
version := "0.1",
|
||||
libraryDependencies ++= Seq(
|
||||
akkaActor
|
||||
),
|
||||
akkaActor
|
||||
),
|
||||
// Note [Native Image Workaround for GraalVM 20.2]
|
||||
libraryDependencies += "org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
|
||||
)
|
||||
@ -542,15 +544,15 @@ lazy val `logging-service` = project
|
||||
.settings(
|
||||
version := "0.1",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.slf4j" % "slf4j-api" % slf4jVersion,
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
akkaStream,
|
||||
akkaHttp,
|
||||
"io.circe" %%% "circe-core" % circeVersion,
|
||||
"io.circe" %%% "circe-parser" % circeVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
|
||||
)
|
||||
"org.slf4j" % "slf4j-api" % slf4jVersion,
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
akkaStream,
|
||||
akkaHttp,
|
||||
"io.circe" %%% "circe-core" % circeVersion,
|
||||
"io.circe" %%% "circe-parser" % circeVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
|
||||
)
|
||||
)
|
||||
.settings(
|
||||
if (Platform.isWindows)
|
||||
@ -566,9 +568,9 @@ lazy val cli = project
|
||||
.settings(
|
||||
version := "0.1",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.typelevel" %% "cats-core" % catsVersion
|
||||
),
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.typelevel" %% "cats-core" % catsVersion
|
||||
),
|
||||
parallelExecution in Test := false
|
||||
)
|
||||
|
||||
@ -578,16 +580,16 @@ lazy val `version-output` = (project in file("lib/scala/version-output"))
|
||||
)
|
||||
.settings(
|
||||
Compile / sourceGenerators += Def.task {
|
||||
val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala"
|
||||
BuildInfo
|
||||
.writeBuildInfoFile(
|
||||
file,
|
||||
state.value.log,
|
||||
ensoVersion,
|
||||
scalacVersion,
|
||||
graalVersion
|
||||
)
|
||||
}.taskValue
|
||||
val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala"
|
||||
BuildInfo
|
||||
.writeBuildInfoFile(
|
||||
file,
|
||||
state.value.log,
|
||||
ensoVersion,
|
||||
scalacVersion,
|
||||
graalVersion
|
||||
)
|
||||
}.taskValue
|
||||
)
|
||||
|
||||
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 ++= circe,
|
||||
libraryDependencies ++= Seq(
|
||||
"com.typesafe" % "config" % typesafeConfigVersion,
|
||||
"com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
|
||||
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
"dev.zio" %% "zio" % zioVersion,
|
||||
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion,
|
||||
"commons-cli" % "commons-cli" % commonsCliVersion,
|
||||
"commons-io" % "commons-io" % commonsIoVersion,
|
||||
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
|
||||
"com.miguno.akka" %% "akka-mock-scheduler" % akkaMockSchedulerVersion % Test,
|
||||
"org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test
|
||||
),
|
||||
"com.typesafe" % "config" % typesafeConfigVersion,
|
||||
"com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
|
||||
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
"dev.zio" %% "zio" % zioVersion,
|
||||
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion,
|
||||
"commons-cli" % "commons-cli" % commonsCliVersion,
|
||||
"commons-io" % "commons-io" % commonsIoVersion,
|
||||
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
|
||||
"com.miguno.akka" %% "akka-mock-scheduler" % akkaMockSchedulerVersion % Test,
|
||||
"org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test
|
||||
),
|
||||
addCompilerPlugin(
|
||||
"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
|
||||
},
|
||||
assemblyOption in assembly := (assemblyOption in assembly).value
|
||||
.copy(
|
||||
prependShellScript = Some(
|
||||
defaultUniversalScript(
|
||||
shebang = false,
|
||||
javaOpts = Seq("-Dtruffle.class.path.append=runtime.jar")
|
||||
)
|
||||
.copy(
|
||||
prependShellScript = Some(
|
||||
defaultUniversalScript(
|
||||
shebang = false,
|
||||
javaOpts = Seq("-Dtruffle.class.path.append=runtime.jar")
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
assembly := assembly
|
||||
.dependsOn(runtime / assembly)
|
||||
.value
|
||||
.dependsOn(runtime / assembly)
|
||||
.value
|
||||
)
|
||||
.dependsOn(`version-output`)
|
||||
.dependsOn(pkg)
|
||||
@ -688,10 +690,10 @@ lazy val `json-rpc-server` = project
|
||||
libraryDependencies ++= akka,
|
||||
libraryDependencies ++= circe,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.circe" %% "circe-literal" % circeVersion,
|
||||
akkaTestkit % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test
|
||||
)
|
||||
"io.circe" %% "circe-literal" % circeVersion,
|
||||
akkaTestkit % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test
|
||||
)
|
||||
)
|
||||
|
||||
lazy val `json-rpc-server-test` = project
|
||||
@ -700,10 +702,10 @@ lazy val `json-rpc-server-test` = project
|
||||
libraryDependencies ++= akka,
|
||||
libraryDependencies ++= circe,
|
||||
libraryDependencies ++= Seq(
|
||||
"io.circe" %% "circe-literal" % circeVersion,
|
||||
akkaTestkit,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion
|
||||
)
|
||||
"io.circe" %% "circe-literal" % circeVersion,
|
||||
akkaTestkit,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion
|
||||
)
|
||||
)
|
||||
.dependsOn(`json-rpc-server`)
|
||||
|
||||
@ -711,9 +713,9 @@ lazy val testkit = project
|
||||
.in(file("lib/scala/testkit"))
|
||||
.settings(
|
||||
libraryDependencies ++= Seq(
|
||||
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion
|
||||
)
|
||||
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion
|
||||
)
|
||||
)
|
||||
|
||||
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,
|
||||
scalacOptions += "-Ymacro-annotations",
|
||||
libraryDependencies ++= jmh ++ Seq(
|
||||
"com.chuusai" %% "shapeless" % shapelessVersion,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion
|
||||
),
|
||||
"com.chuusai" %% "shapeless" % shapelessVersion,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion
|
||||
),
|
||||
addCompilerPlugin(
|
||||
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
|
||||
),
|
||||
@ -749,11 +751,11 @@ lazy val searcher = project
|
||||
.configs(Test)
|
||||
.settings(
|
||||
libraryDependencies ++= jmh ++ Seq(
|
||||
"com.typesafe.slick" %% "slick" % slickVersion,
|
||||
"org.xerial" % "sqlite-jdbc" % sqliteVersion,
|
||||
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test
|
||||
)
|
||||
"com.typesafe.slick" %% "slick" % slickVersion,
|
||||
"org.xerial" % "sqlite-jdbc" % sqliteVersion,
|
||||
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test
|
||||
)
|
||||
)
|
||||
.configs(Benchmark)
|
||||
.settings(
|
||||
@ -796,11 +798,11 @@ lazy val `polyglot-api` = project
|
||||
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
|
||||
},
|
||||
libraryDependencies ++= Seq(
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
|
||||
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
|
||||
),
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
|
||||
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
|
||||
),
|
||||
libraryDependencies ++= jackson,
|
||||
addCompilerPlugin(
|
||||
"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"))
|
||||
.settings(
|
||||
libraryDependencies ++= akka ++ circe ++ Seq(
|
||||
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
|
||||
"io.circe" %% "circe-literal" % circeVersion,
|
||||
"org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version,
|
||||
"dev.zio" %% "zio" % zioVersion,
|
||||
"io.methvin" % "directory-watcher" % directoryWatcherVersion,
|
||||
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
|
||||
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
|
||||
"commons-io" % "commons-io" % commonsIoVersion,
|
||||
akkaTestkit % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided"
|
||||
),
|
||||
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
|
||||
"io.circe" %% "circe-literal" % circeVersion,
|
||||
"org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version,
|
||||
"dev.zio" %% "zio" % zioVersion,
|
||||
"io.methvin" % "directory-watcher" % directoryWatcherVersion,
|
||||
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
|
||||
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
|
||||
"commons-io" % "commons-io" % commonsIoVersion,
|
||||
akkaTestkit % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided"
|
||||
),
|
||||
testOptions in Test += Tests
|
||||
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
|
||||
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
|
||||
GenerateFlatbuffers.flatcVersion := flatbuffersVersion,
|
||||
sourceGenerators in Compile += GenerateFlatbuffers.task
|
||||
)
|
||||
@ -844,8 +846,8 @@ lazy val `language-server` = (project in file("engine/language-server"))
|
||||
bench := (test in Benchmark).value,
|
||||
libraryDependencies += "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
|
||||
testFrameworks ++= List(
|
||||
new TestFramework("org.scalameter.ScalaMeterFramework")
|
||||
)
|
||||
new TestFramework("org.scalameter.ScalaMeterFramework")
|
||||
)
|
||||
)
|
||||
.dependsOn(`polyglot-api`)
|
||||
.dependsOn(`json-rpc-server`)
|
||||
@ -866,20 +868,20 @@ lazy val parser = (project in file("lib/scala/parser"))
|
||||
fork := true,
|
||||
Cargo.rustVersion := rustVersion,
|
||||
Compile / compile / compileInputs := (Compile / compile / compileInputs)
|
||||
.dependsOn(Cargo("build --project parser"))
|
||||
.value,
|
||||
.dependsOn(Cargo("build --project parser"))
|
||||
.value,
|
||||
javaOptions += {
|
||||
val root = baseDirectory.value.getParentFile.getParentFile.getParentFile
|
||||
s"-Djava.library.path=$root/target/rust/debug"
|
||||
},
|
||||
libraryDependencies ++= Seq(
|
||||
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
|
||||
"org.scalatest" %%% "scalatest" % scalatestVersion % Test
|
||||
),
|
||||
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
|
||||
"org.scalatest" %%% "scalatest" % scalatestVersion % Test
|
||||
),
|
||||
testFrameworks := List(
|
||||
new TestFramework("org.scalatest.tools.Framework"),
|
||||
new TestFramework("org.scalameter.ScalaMeterFramework")
|
||||
)
|
||||
new TestFramework("org.scalatest.tools.Framework"),
|
||||
new TestFramework("org.scalameter.ScalaMeterFramework")
|
||||
)
|
||||
)
|
||||
.dependsOn(ast)
|
||||
|
||||
@ -895,48 +897,48 @@ lazy val runtime = (project in file("engine/runtime"))
|
||||
scalacOptions += "-Ymacro-annotations",
|
||||
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"),
|
||||
libraryDependencies ++= circe ++ jmh ++ jaxb ++ Seq(
|
||||
"com.chuusai" %% "shapeless" % shapelessVersion,
|
||||
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
|
||||
"org.apache.tika" % "tika-core" % tikaVersion,
|
||||
"org.graalvm.sdk" % "graal-sdk" % graalVersion % "provided",
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-dsl-processor" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-tck" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-tck-common" % graalVersion % "provided",
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.graalvm.truffle" % "truffle-api" % graalVersion % Benchmark,
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"eu.timepit" %% "refined" % refinedVersion
|
||||
),
|
||||
"com.chuusai" %% "shapeless" % shapelessVersion,
|
||||
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
|
||||
"org.apache.tika" % "tika-core" % tikaVersion,
|
||||
"org.graalvm.sdk" % "graal-sdk" % graalVersion % "provided",
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-dsl-processor" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-tck" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-tck-common" % graalVersion % "provided",
|
||||
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
|
||||
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
"org.graalvm.truffle" % "truffle-api" % graalVersion % Benchmark,
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"eu.timepit" %% "refined" % refinedVersion
|
||||
),
|
||||
// Note [Unmanaged Classpath]
|
||||
Compile / unmanagedClasspath += (`core-definition` / Compile / packageBin).value,
|
||||
Test / unmanagedClasspath += (`core-definition` / Compile / packageBin).value,
|
||||
Compile / compile / compileInputs := (Compile / compile / compileInputs)
|
||||
.dependsOn(CopyTruffleJAR.preCompileTask)
|
||||
.value,
|
||||
.dependsOn(CopyTruffleJAR.preCompileTask)
|
||||
.value,
|
||||
Compile / compile := FixInstrumentsGeneration.patchedCompile
|
||||
.dependsOn(FixInstrumentsGeneration.preCompileTask)
|
||||
.dependsOn(`core-definition` / Compile / packageBin)
|
||||
.value,
|
||||
.dependsOn(FixInstrumentsGeneration.preCompileTask)
|
||||
.dependsOn(`core-definition` / Compile / packageBin)
|
||||
.value,
|
||||
// Note [Classpath Separation]
|
||||
Test / javaOptions ++= Seq(
|
||||
"-Dgraalvm.locatorDisabled=true",
|
||||
s"--upgrade-module-path=${file("engine/runtime/build-cache/truffle-api.jar").absolutePath}"
|
||||
),
|
||||
"-Dgraalvm.locatorDisabled=true",
|
||||
s"--upgrade-module-path=${file("engine/runtime/build-cache/truffle-api.jar").absolutePath}"
|
||||
),
|
||||
bootstrap := CopyTruffleJAR.bootstrapJARs.value,
|
||||
Global / onLoad := EnvironmentCheck.addVersionCheck(
|
||||
graalVersion,
|
||||
javaVersion
|
||||
)((Global / onLoad).value)
|
||||
graalVersion,
|
||||
javaVersion
|
||||
)((Global / onLoad).value)
|
||||
)
|
||||
.settings(
|
||||
(Compile / javacOptions) ++= Seq(
|
||||
"-s",
|
||||
(Compile / sourceManaged).value.getAbsolutePath
|
||||
),
|
||||
"-s",
|
||||
(Compile / sourceManaged).value.getAbsolutePath
|
||||
),
|
||||
addCompilerPlugin(
|
||||
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
|
||||
),
|
||||
@ -947,27 +949,26 @@ lazy val runtime = (project in file("engine/runtime"))
|
||||
)
|
||||
.settings(
|
||||
(Compile / compile) := (Compile / compile)
|
||||
.dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs })
|
||||
.value
|
||||
.dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs })
|
||||
.value
|
||||
)
|
||||
.settings(
|
||||
(Runtime / compile) := (Runtime / compile)
|
||||
.dependsOn(`std-bits` / Compile / packageBin)
|
||||
.value
|
||||
.dependsOn(`std-bits` / Compile / packageBin)
|
||||
.value
|
||||
)
|
||||
.settings(
|
||||
logBuffered := false,
|
||||
bench := (test in Benchmark).tag(Exclusive).value,
|
||||
benchOnly := Def.inputTaskDyn {
|
||||
import complete.Parsers.spaceDelimited
|
||||
val name = spaceDelimited("<name>").parsed match {
|
||||
case List(name) => name
|
||||
case _ => throw new IllegalArgumentException("Expected one argument.")
|
||||
}
|
||||
Def.task {
|
||||
(testOnly in Benchmark).toTask(" -- -z " + name).value
|
||||
}
|
||||
}.evaluated,
|
||||
import complete.Parsers.spaceDelimited
|
||||
val name = spaceDelimited("<name>").parsed match {
|
||||
case List(name) => name
|
||||
case _ => throw new IllegalArgumentException("Expected one argument.")
|
||||
}
|
||||
Def.task {
|
||||
(testOnly in Benchmark).toTask(" -- -z " + name).value
|
||||
}
|
||||
}.evaluated,
|
||||
parallelExecution in Benchmark := false
|
||||
)
|
||||
.settings(
|
||||
@ -1038,40 +1039,40 @@ lazy val `engine-runner` = project
|
||||
MergeStrategy.first
|
||||
},
|
||||
assemblyOption in assembly := (assemblyOption in assembly).value
|
||||
.copy(
|
||||
prependShellScript = Some(
|
||||
defaultUniversalScript(
|
||||
shebang = false,
|
||||
javaOpts = truffleRunOptions ++
|
||||
Seq("-Dtruffle.class.path.append=runtime.jar")
|
||||
)
|
||||
.copy(
|
||||
prependShellScript = Some(
|
||||
defaultUniversalScript(
|
||||
shebang = false,
|
||||
javaOpts = truffleRunOptions ++
|
||||
Seq("-Dtruffle.class.path.append=runtime.jar")
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
commands += WithDebugCommand.withDebug,
|
||||
inConfig(Compile)(truffleRunOptionsSettings),
|
||||
libraryDependencies ++= Seq(
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
|
||||
"commons-cli" % "commons-cli" % commonsCliVersion,
|
||||
"com.monovore" %% "decline" % declineVersion,
|
||||
"org.jline" % "jline" % jlineVersion,
|
||||
"org.typelevel" %% "cats-core" % catsVersion
|
||||
),
|
||||
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
|
||||
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided",
|
||||
"commons-cli" % "commons-cli" % commonsCliVersion,
|
||||
"com.monovore" %% "decline" % declineVersion,
|
||||
"org.jline" % "jline" % jlineVersion,
|
||||
"org.typelevel" %% "cats-core" % catsVersion
|
||||
),
|
||||
connectInput in run := true
|
||||
)
|
||||
.settings(
|
||||
buildNativeImage := NativeImage
|
||||
.buildNativeImage(
|
||||
"enso",
|
||||
staticOnLinux = false,
|
||||
Seq("-H:IncludeResources=.*Main.enso$")
|
||||
)
|
||||
.value
|
||||
.buildNativeImage(
|
||||
"enso",
|
||||
staticOnLinux = false,
|
||||
Seq("-H:IncludeResources=.*Main.enso$")
|
||||
)
|
||||
.value
|
||||
)
|
||||
.settings(
|
||||
assembly := assembly
|
||||
.dependsOn(runtime / assembly)
|
||||
.value
|
||||
.dependsOn(runtime / assembly)
|
||||
.value
|
||||
)
|
||||
.dependsOn(`version-output`)
|
||||
.dependsOn(pkg)
|
||||
@ -1085,48 +1086,48 @@ lazy val launcher = project
|
||||
.settings(
|
||||
resolvers += Resolver.bintrayRepo("gn0s1s", "releases"),
|
||||
libraryDependencies ++= Seq(
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"nl.gn0s1s" %% "bump" % bumpVersion,
|
||||
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
akkaHttp,
|
||||
akkaSLF4J
|
||||
)
|
||||
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
|
||||
"org.typelevel" %% "cats-core" % catsVersion,
|
||||
"nl.gn0s1s" %% "bump" % bumpVersion,
|
||||
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
|
||||
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
|
||||
akkaHttp,
|
||||
akkaSLF4J
|
||||
)
|
||||
)
|
||||
.settings(
|
||||
buildNativeImage := NativeImage
|
||||
.buildNativeImage(
|
||||
"enso",
|
||||
staticOnLinux = true,
|
||||
Seq(
|
||||
"-J-Xmx4G",
|
||||
"--enable-all-security-services", // Note [HTTPS in the Launcher]
|
||||
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
|
||||
"-H:IncludeResources=.*Main.enso$",
|
||||
"--initialize-at-run-time=" +
|
||||
"akka.protobuf.DescriptorProtos," +
|
||||
"com.typesafe.config.impl.ConfigImpl$EnvVariablesHolder," +
|
||||
"com.typesafe.config.impl.ConfigImpl$SystemPropertiesHolder," +
|
||||
"org.enso.loggingservice.WSLoggerManager$" // Note [WSLoggerManager Shutdown Hook]
|
||||
)
|
||||
.buildNativeImage(
|
||||
"enso",
|
||||
staticOnLinux = true,
|
||||
Seq(
|
||||
"-J-Xmx4G",
|
||||
"--enable-all-security-services", // Note [HTTPS in the Launcher]
|
||||
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
|
||||
"-H:IncludeResources=.*Main.enso$",
|
||||
"--initialize-at-run-time=" +
|
||||
"akka.protobuf.DescriptorProtos," +
|
||||
"com.typesafe.config.impl.ConfigImpl$EnvVariablesHolder," +
|
||||
"com.typesafe.config.impl.ConfigImpl$SystemPropertiesHolder," +
|
||||
"org.enso.loggingservice.WSLoggerManager$" // Note [WSLoggerManager Shutdown Hook]
|
||||
)
|
||||
.value,
|
||||
)
|
||||
.value,
|
||||
test in assembly := {},
|
||||
assemblyOutputPath in assembly := file("launcher.jar")
|
||||
)
|
||||
.settings(
|
||||
(Test / test) := (Test / test)
|
||||
.dependsOn(
|
||||
NativeImage.incrementalNativeImageBuild(
|
||||
buildNativeImage,
|
||||
"enso"
|
||||
)
|
||||
.dependsOn(
|
||||
NativeImage.incrementalNativeImageBuild(
|
||||
buildNativeImage,
|
||||
"enso"
|
||||
)
|
||||
.dependsOn(
|
||||
LauncherShimsForTest.prepare(rustcVersion = rustVersion)
|
||||
)
|
||||
.value,
|
||||
)
|
||||
.dependsOn(
|
||||
LauncherShimsForTest.prepare(rustcVersion = rustVersion)
|
||||
)
|
||||
.value,
|
||||
parallelExecution in Test := false
|
||||
)
|
||||
.dependsOn(cli)
|
||||
@ -1144,19 +1145,19 @@ lazy val `std-bits` = project
|
||||
Compile / packageBin / artifactPath :=
|
||||
`std-lib-polyglot-root` / "std-bits.jar",
|
||||
libraryDependencies ++= Seq(
|
||||
"com.ibm.icu" % "icu4j" % icuVersion
|
||||
),
|
||||
"com.ibm.icu" % "icu4j" % icuVersion
|
||||
),
|
||||
Compile / packageBin := Def.task {
|
||||
val result = (Compile / packageBin).value
|
||||
StdBits
|
||||
.copyDependencies(
|
||||
`std-lib-polyglot-root`,
|
||||
"std-bits.jar",
|
||||
ignoreScalaLibrary = true
|
||||
)
|
||||
.value
|
||||
result
|
||||
}.value
|
||||
val result = (Compile / packageBin).value
|
||||
StdBits
|
||||
.copyDependencies(
|
||||
`std-lib-polyglot-root`,
|
||||
"std-bits.jar",
|
||||
ignoreScalaLibrary = true
|
||||
)
|
||||
.value
|
||||
result
|
||||
}.value
|
||||
)
|
||||
|
||||
/* Note [HTTPS in the Launcher]
|
||||
|
@ -1,16 +1,16 @@
|
||||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} %-5level [%-15thread] %-36logger{36} %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} %-5level [%-15thread] %-36logger{36} %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.enso" level="TRACE"/>
|
||||
<logger name="org.enso" level="TRACE"/>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
@ -18,8 +18,7 @@ import org.enso.languageserver.runtime.RuntimeKiller.{
|
||||
import scala.concurrent.duration._
|
||||
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
|
||||
*/
|
||||
@ -124,16 +123,15 @@ class LanguageServerComponent(config: LanguageServerConfig)
|
||||
_ <- start()
|
||||
} yield ComponentRestarted
|
||||
|
||||
private val logError: PartialFunction[Throwable, Unit] = {
|
||||
case th => logger.error("An error occurred during stopping server", th)
|
||||
private val logError: PartialFunction[Throwable, Unit] = { case th =>
|
||||
logger.error("An error occurred during stopping server", th)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object LanguageServerComponent {
|
||||
|
||||
/**
|
||||
* A running server context.
|
||||
/** A running server context.
|
||||
*
|
||||
* @param mainModule a main module containing all components of the server
|
||||
* @param jsonBinding a http binding for rpc protocol
|
||||
|
@ -4,8 +4,7 @@ import java.util.UUID
|
||||
|
||||
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 rpcPort a rpc port that the server listen to
|
||||
|
@ -8,27 +8,23 @@ import org.enso.languageserver.boot.LifecycleComponent.{
|
||||
|
||||
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 {
|
||||
|
||||
/**
|
||||
* Starts asynchronously a server.
|
||||
/** Starts asynchronously a server.
|
||||
*
|
||||
* @return a notice that the server started successfully
|
||||
*/
|
||||
def start(): Future[ComponentStarted.type]
|
||||
|
||||
/**
|
||||
* Stops asynchronously a server.
|
||||
/** Stops asynchronously a server.
|
||||
*
|
||||
* @return a notice that the server stopped successfully
|
||||
*/
|
||||
def stop(): Future[ComponentStopped.type]
|
||||
|
||||
/**
|
||||
* Restarts asynchronously a server.
|
||||
/** Restarts asynchronously a server.
|
||||
*
|
||||
* @return a notice that the server restarted successfully
|
||||
*/
|
||||
@ -38,18 +34,15 @@ trait LifecycleComponent {
|
||||
|
||||
object LifecycleComponent {
|
||||
|
||||
/**
|
||||
* Signals that component was started.
|
||||
/** Signals that component was started.
|
||||
*/
|
||||
case object ComponentStarted
|
||||
|
||||
/**
|
||||
* Signals that component was stopped.
|
||||
/** Signals that component was stopped.
|
||||
*/
|
||||
case object ComponentStopped
|
||||
|
||||
/**
|
||||
* Signals that component was restarted.
|
||||
/** Signals that component was restarted.
|
||||
*/
|
||||
case object ComponentRestarted
|
||||
|
||||
|
@ -41,8 +41,7 @@ import scala.concurrent.Future
|
||||
import scala.concurrent.duration._
|
||||
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
|
||||
*/
|
||||
|
@ -3,8 +3,7 @@ package org.enso.languageserver.capability
|
||||
import org.enso.languageserver.data.CapabilityRegistration
|
||||
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]]
|
||||
* for message specifications.
|
||||
*/
|
||||
|
@ -6,8 +6,7 @@ import org.enso.languageserver.session.JsonSession
|
||||
|
||||
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 registration the capability to grant.
|
||||
@ -17,31 +16,26 @@ object CapabilityProtocol {
|
||||
registration: CapabilityRegistration
|
||||
)
|
||||
|
||||
/**
|
||||
* Signals capability acquisition status.
|
||||
/** Signals capability acquisition status.
|
||||
*/
|
||||
sealed trait AcquireCapabilityResponse
|
||||
|
||||
/**
|
||||
* Confirms client that capability has been acquired.
|
||||
/** Confirms client that capability has been acquired.
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* Signals about capability acquisition error.
|
||||
/** Signals about capability acquisition error.
|
||||
*
|
||||
* @param error file system failure
|
||||
*/
|
||||
case class CapabilityAcquisitionFileSystemFailure(error: FileSystemFailure)
|
||||
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 capability the capability being released.
|
||||
@ -51,36 +45,30 @@ object CapabilityProtocol {
|
||||
capability: CapabilityRegistration
|
||||
)
|
||||
|
||||
/**
|
||||
* Signals capability release status.
|
||||
/** Signals capability release status.
|
||||
*/
|
||||
sealed trait ReleaseCapabilityResponse
|
||||
|
||||
/**
|
||||
* Confirms client that capability has been released.
|
||||
/** Confirms client that capability has been released.
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* Signals that requested capability is not acquired.
|
||||
/** Signals that requested capability is not acquired.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param capability the capability being released.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param registration the capability being granted.
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.data.{
|
||||
import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong}
|
||||
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.
|
||||
*
|
||||
* @param bufferRegistry the recipient of buffer capability requests
|
||||
@ -71,8 +70,7 @@ class 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 receivesTreeUpdatesHandler the recipient of `receivesTreeUpdates`
|
||||
|
@ -5,15 +5,13 @@ import io.circe._
|
||||
import org.enso.languageserver.filemanager.Path
|
||||
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.
|
||||
*/
|
||||
sealed abstract class Capability(val method: String)
|
||||
|
||||
//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.
|
||||
*/
|
||||
case class CanEdit(path: Path) extends Capability(CanEdit.methodName)
|
||||
@ -22,8 +20,7 @@ object 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.
|
||||
*/
|
||||
@ -34,8 +31,7 @@ object 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
|
||||
*/
|
||||
@ -46,8 +42,7 @@ object 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
|
||||
*/
|
||||
@ -79,8 +74,7 @@ object 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.
|
||||
*/
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.filemanager.{
|
||||
import scala.concurrent.duration._
|
||||
import scala.util.Try
|
||||
|
||||
/**
|
||||
* Configuration of the path watcher.
|
||||
/** Configuration of the path watcher.
|
||||
*
|
||||
* @param timeout path watcher operations timeout
|
||||
* @param restartTimeout timeout before watcher is restarted on error
|
||||
@ -29,8 +28,7 @@ case class PathWatcherConfig(
|
||||
|
||||
object PathWatcherConfig {
|
||||
|
||||
/**
|
||||
* Default path watcher config.
|
||||
/** Default path watcher config.
|
||||
*/
|
||||
def apply(): PathWatcherConfig =
|
||||
PathWatcherConfig(
|
||||
@ -40,8 +38,7 @@ object PathWatcherConfig {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Configuration of the file manager.
|
||||
/** Configuration of the file manager.
|
||||
*
|
||||
* @param timeout IO operation timeout
|
||||
* @param parallelism number of processes working with the file system
|
||||
@ -50,8 +47,7 @@ case class FileManagerConfig(timeout: FiniteDuration, parallelism: Int)
|
||||
|
||||
object FileManagerConfig {
|
||||
|
||||
/**
|
||||
* Default file manager config.
|
||||
/** Default file manager config.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
@ -71,8 +66,7 @@ case class ExecutionContextConfig(requestTimeout: FiniteDuration)
|
||||
|
||||
object ExecutionContextConfig {
|
||||
|
||||
/**
|
||||
* Default execution context config.
|
||||
/** Default execution context config.
|
||||
*/
|
||||
def apply(): 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
|
||||
*/
|
||||
@ -103,8 +96,7 @@ object DirectoriesConfig {
|
||||
val DataDirectory: String = ".enso"
|
||||
val SuggestionsDatabaseFile: String = "suggestions.db"
|
||||
|
||||
/**
|
||||
* Create default data directory config
|
||||
/** Create default data directory config
|
||||
*
|
||||
* @param root the root directory path
|
||||
* @return default data directory config
|
||||
@ -113,8 +105,7 @@ object DirectoriesConfig {
|
||||
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
|
||||
* the content root
|
||||
@ -137,13 +128,12 @@ case class Config(
|
||||
.toRight(ContentRootNotFound)
|
||||
|
||||
def findRelativePath(path: File): Option[Path] =
|
||||
contentRoots.view.flatMap {
|
||||
case (id, root) =>
|
||||
if (path.toPath.startsWith(root.toPath)) {
|
||||
Some(Path(id, root.toPath.relativize(path.toPath)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
contentRoots.view.flatMap { case (id, root) =>
|
||||
if (path.toPath.startsWith(root.toPath)) {
|
||||
Some(Path(id, root.toPath.relativize(path.toPath)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}.headOption
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,17 @@
|
||||
package org.enso.languageserver.data
|
||||
|
||||
/**
|
||||
* A content-based versioning calculator.
|
||||
/** A content-based versioning calculator.
|
||||
*/
|
||||
trait ContentBasedVersioning {
|
||||
|
||||
/**
|
||||
* Evaluates content-based version of document.
|
||||
/** Evaluates content-based version of document.
|
||||
*
|
||||
* @param content a textual content
|
||||
* @return a string representation of a digest
|
||||
*/
|
||||
def evalVersion(content: String): String
|
||||
|
||||
/**
|
||||
* Evaluates content-based version of document.
|
||||
/** Evaluates content-based version of document.
|
||||
*
|
||||
* @param content a textual content
|
||||
* @return a digest
|
||||
|
@ -3,8 +3,7 @@ package org.enso.languageserver.data
|
||||
import org.bouncycastle.jcajce.provider.digest.SHA3
|
||||
import org.bouncycastle.util.encoders.Hex
|
||||
|
||||
/**
|
||||
* SHA3-224 digest calculator.
|
||||
/** SHA3-224 digest calculator.
|
||||
*/
|
||||
object Sha3_224VersionCalculator extends ContentBasedVersioning {
|
||||
|
||||
|
@ -4,8 +4,7 @@ import java.util.UUID
|
||||
|
||||
package object data {
|
||||
|
||||
/**
|
||||
* A type representing the internal id of a client.
|
||||
/** A type representing the internal id of a client.
|
||||
*/
|
||||
type ClientId = UUID
|
||||
|
||||
|
@ -8,21 +8,18 @@ import zio.blocking.blocking
|
||||
import scala.concurrent.{Future, Promise}
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* Abstract entity that executes effects `F`.
|
||||
/** Abstract entity that executes effects `F`.
|
||||
*/
|
||||
trait Exec[-F[_, _]] {
|
||||
|
||||
/**
|
||||
* Execute Zio effect.
|
||||
/** Execute Zio effect.
|
||||
*
|
||||
* @param op effect to execute
|
||||
* @return a future containing either a failure or a result
|
||||
*/
|
||||
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 op effect to execute
|
||||
@ -33,23 +30,20 @@ trait Exec[-F[_, _]] {
|
||||
op: F[E, A]
|
||||
): Future[Either[E, A]]
|
||||
|
||||
/**
|
||||
* Execute long running task in background.
|
||||
/** Execute long running task in background.
|
||||
*
|
||||
* @param op effect to execute
|
||||
*/
|
||||
def exec_[E, A](op: F[E, A]): Unit
|
||||
}
|
||||
|
||||
/**
|
||||
* Executor of Zio effects.
|
||||
/** Executor of Zio effects.
|
||||
*
|
||||
* @param runtime zio runtime
|
||||
*/
|
||||
case class ZioExec(runtime: Runtime[ZEnv]) extends Exec[ZioExec.IO] {
|
||||
|
||||
/**
|
||||
* Execute Zio effect.
|
||||
/** Execute Zio effect.
|
||||
*
|
||||
* @param op effect to execute
|
||||
* @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
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute Zio effect with timeout.
|
||||
/** Execute Zio effect with timeout.
|
||||
*
|
||||
* @param timeout execution timeout
|
||||
* @param op effect to execute
|
||||
@ -91,8 +84,7 @@ case class ZioExec(runtime: Runtime[ZEnv]) extends Exec[ZioExec.IO] {
|
||||
promise.future
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute long running task in background.
|
||||
/** Execute long running task in background.
|
||||
*
|
||||
* @param op effect to execute
|
||||
*/
|
||||
|
@ -2,20 +2,17 @@ package org.enso.languageserver.event
|
||||
|
||||
import org.enso.languageserver.filemanager.Path
|
||||
|
||||
/**
|
||||
* Base trait for all buffer events.
|
||||
/** Base trait for all buffer events.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.enso.languageserver.event
|
||||
|
||||
/**
|
||||
* Base trait for all server events.
|
||||
/** Base trait for all server events.
|
||||
*/
|
||||
trait Event
|
||||
|
@ -4,13 +4,11 @@ import java.util.UUID
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* 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 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)
|
||||
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 owner the id of the owner of the context
|
||||
|
@ -2,35 +2,30 @@ package org.enso.languageserver.event
|
||||
|
||||
import org.enso.languageserver.session.{BinarySession, JsonSession}
|
||||
|
||||
/**
|
||||
* Base trait for all session events.
|
||||
/** Base trait for all session events.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param session an object representing a client session
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param session an object representing a client session
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.filemanager
|
||||
|
||||
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 name of the directory
|
||||
@ -19,8 +18,7 @@ case class DirectoryTree(
|
||||
|
||||
object DirectoryTree {
|
||||
|
||||
/**
|
||||
* Create [[DirectoryTree]] from [[FileSystemApi.DirectoryEntry]]
|
||||
/** Create [[DirectoryTree]] from [[FileSystemApi.DirectoryEntry]]
|
||||
* converting absolute pathes to ones relative to project root.
|
||||
*
|
||||
* @param root path to the project root
|
||||
|
@ -3,8 +3,7 @@ package org.enso.languageserver.filemanager
|
||||
import java.io.File
|
||||
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 lastAccessTime last access time
|
||||
@ -25,8 +24,7 @@ case class FileAttributes(
|
||||
|
||||
object FileAttributes {
|
||||
|
||||
/**
|
||||
* Create attributes from filesystem attributes [[FileSystemApi.Attributes]].
|
||||
/** Create attributes from filesystem attributes [[FileSystemApi.Attributes]].
|
||||
*
|
||||
* @param root a root path
|
||||
* @param path a path to the file system object
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.filemanager
|
||||
|
||||
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
|
||||
*/
|
||||
|
@ -4,8 +4,7 @@ import java.io.File
|
||||
|
||||
import enumeratum._
|
||||
|
||||
/**
|
||||
* A representation of filesystem event.
|
||||
/** A representation of filesystem event.
|
||||
*
|
||||
* @param path path to the file system object
|
||||
* @param kind type of file system event
|
||||
@ -14,8 +13,7 @@ case class FileEvent(path: Path, kind: FileEventKind)
|
||||
|
||||
object FileEvent {
|
||||
|
||||
/**
|
||||
* Conversion from file system event.
|
||||
/** Conversion from file system event.
|
||||
*
|
||||
* @param root a project root
|
||||
* @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
|
||||
|
||||
object FileEventKind extends Enum[FileEventKind] with CirceEnum[FileEventKind] {
|
||||
|
||||
/**
|
||||
* Event type indicating file creation.
|
||||
/** Event type indicating file creation.
|
||||
*/
|
||||
case object Added extends FileEventKind
|
||||
|
||||
/**
|
||||
* Event type indicating file deletion.
|
||||
/** Event type indicating file deletion.
|
||||
*/
|
||||
case object Removed extends FileEventKind
|
||||
|
||||
/**
|
||||
* Event type indicating file modification.
|
||||
/** Event type indicating file modification.
|
||||
*/
|
||||
case object Modified extends FileEventKind
|
||||
|
||||
override val values = findValues
|
||||
|
||||
/**
|
||||
* Create [[FileEventKind]] from [[WatcherAdapter.EventType]].
|
||||
/** Create [[FileEventKind]] from [[WatcherAdapter.EventType]].
|
||||
*
|
||||
* @param eventType file system event type
|
||||
* @return file event kind
|
||||
|
@ -9,8 +9,7 @@ import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong}
|
||||
import org.enso.languageserver.util.UnhandledLogging
|
||||
import zio._
|
||||
|
||||
/**
|
||||
* Handles the [[FileManagerProtocol]] messages, executes the [[FileSystem]]
|
||||
/** Handles the [[FileManagerProtocol]] messages, executes the [[FileSystem]]
|
||||
* effects and forms the responses.
|
||||
*
|
||||
* @param config configuration
|
||||
@ -96,7 +95,7 @@ class FileManager(
|
||||
()
|
||||
|
||||
case FileManagerProtocol.CreateFile(
|
||||
FileSystemObject.Directory(name, path)
|
||||
FileSystemObject.Directory(name, path)
|
||||
) =>
|
||||
val result =
|
||||
for {
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.filemanager
|
||||
|
||||
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]]
|
||||
* for message specifications.
|
||||
*/
|
||||
|
@ -5,73 +5,63 @@ import java.util.UUID
|
||||
|
||||
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 content the textual contents
|
||||
*/
|
||||
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 contents the binary contents
|
||||
*/
|
||||
case class BinaryFileContent(path: File, contents: Array[Byte])
|
||||
|
||||
/**
|
||||
* Gets all content roots.
|
||||
/** Gets all content roots.
|
||||
*/
|
||||
case object GetContentRoots
|
||||
|
||||
/**
|
||||
* Response containing all content roots.
|
||||
/** Response containing all content roots.
|
||||
*
|
||||
* @param contentRoots content roots
|
||||
*/
|
||||
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 content a textual content
|
||||
*/
|
||||
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 contents binary contents
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@ -79,8 +69,7 @@ object FileManagerProtocol {
|
||||
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
|
||||
*/
|
||||
@ -88,87 +77,75 @@ object FileManagerProtocol {
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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 to a path to the destination
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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 to a path to the destination
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@ -176,29 +153,25 @@ object FileManagerProtocol {
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -11,8 +11,7 @@ import zio.blocking.effectBlocking
|
||||
|
||||
import scala.collection.mutable
|
||||
|
||||
/**
|
||||
* File manipulation facility.
|
||||
/** File manipulation facility.
|
||||
*
|
||||
* @tparam F represents target monad
|
||||
*/
|
||||
@ -20,8 +19,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
|
||||
import FileSystemApi._
|
||||
|
||||
/**
|
||||
* Writes textual content to a file.
|
||||
/** Writes textual content to a file.
|
||||
*
|
||||
* @param file path to 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"))
|
||||
.mapError(errorHandling)
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def writeBinary(
|
||||
file: File,
|
||||
contents: Array[Byte]
|
||||
@ -42,8 +40,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
effectBlocking(FileUtils.writeByteArrayToFile(file, contents))
|
||||
.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* Reads the contents of a textual file.
|
||||
/** Reads the contents of a textual file.
|
||||
*
|
||||
* @param file path to the file
|
||||
* @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"))
|
||||
.mapError(errorHandling)
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def readBinary(
|
||||
file: File
|
||||
): BlockingIO[FileSystemFailure, Array[Byte]] =
|
||||
effectBlocking(FileUtils.readFileToByteArray(file))
|
||||
.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* Deletes the specified file or directory recursively.
|
||||
/** Deletes the specified file or directory recursively.
|
||||
*
|
||||
* @param file path to the file or directory
|
||||
* @return either [[FileSystemFailure]] or Unit
|
||||
@ -74,8 +70,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
}
|
||||
}.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* Creates an empty file with parent directory.
|
||||
/** Creates an empty file with parent directory.
|
||||
*
|
||||
* @param file path to the file
|
||||
* @return
|
||||
@ -90,8 +85,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
effectBlocking(file.createNewFile(): Unit)
|
||||
.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* Creates a directory, including any necessary but nonexistent parent
|
||||
/** Creates a directory, including any necessary but nonexistent parent
|
||||
* directories.
|
||||
*
|
||||
* @param file path to the file
|
||||
@ -103,8 +97,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
effectBlocking(FileUtils.forceMkdir(file))
|
||||
.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* Copy a file or directory recursively.
|
||||
/** Copy a file or directory recursively.
|
||||
*
|
||||
* @param from a path to the source
|
||||
* @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)
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a file or directory recursively
|
||||
/** Move a file or directory recursively
|
||||
*
|
||||
* @param from a path to the source
|
||||
* @param to a path to the destination
|
||||
@ -146,8 +138,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
}
|
||||
}.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* Checks if the specified file exists.
|
||||
/** Checks if the specified file exists.
|
||||
*
|
||||
* @param file path to the file or directory
|
||||
* @return either [[FileSystemFailure]] or file existence flag
|
||||
@ -156,8 +147,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
effectBlocking(Files.exists(file.toPath))
|
||||
.mapError(errorHandling)
|
||||
|
||||
/**
|
||||
* List contents of a given path.
|
||||
/** List contents of a given path.
|
||||
*
|
||||
* @param path to the file system object
|
||||
* @return either [[FileSystemFailure]] or list of entries
|
||||
@ -181,8 +171,7 @@ class FileSystem extends FileSystemApi[BlockingIO] {
|
||||
IO.fail(FileNotFound)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns tree of a given path.
|
||||
/** Returns tree of a given path.
|
||||
*
|
||||
* @param path to the file system object
|
||||
* @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
|
||||
* @return either [[FileSystemFailure]] or file attributes
|
||||
@ -247,8 +235,7 @@ object FileSystem {
|
||||
|
||||
import FileSystemApi._
|
||||
|
||||
/**
|
||||
* Represent a depth limit when recursively traversing a directory.
|
||||
/** Represent a depth limit when recursively traversing a directory.
|
||||
*/
|
||||
sealed private trait Depth {
|
||||
|
||||
@ -281,8 +268,7 @@ object FileSystem {
|
||||
UnlimitedDepth
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents subdirectory in the tree algorithm.
|
||||
/** Represents subdirectory in the tree algorithm.
|
||||
*
|
||||
* @param entry subdir entry
|
||||
* @param level subdir depth level
|
||||
@ -294,8 +280,7 @@ object FileSystem {
|
||||
visited: Vector[SymbolicLinkEntry]
|
||||
)
|
||||
|
||||
/**
|
||||
* Read an entry without following the symlinks.
|
||||
/** Read an entry without following the symlinks.
|
||||
*/
|
||||
private def readEntry(path: Path): Entry = {
|
||||
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 = {
|
||||
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
|
||||
* @return list of entries
|
||||
@ -344,8 +327,7 @@ object FileSystem {
|
||||
.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.
|
||||
*
|
||||
* @param directory current directory
|
||||
|
@ -9,8 +9,7 @@ import org.enso.languageserver.effect.BlockingIO
|
||||
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
|
||||
/**
|
||||
* File manipulation API.
|
||||
/** File manipulation API.
|
||||
*
|
||||
* @tparam F represents target monad
|
||||
*/
|
||||
@ -18,8 +17,7 @@ trait FileSystemApi[F[_, _]] {
|
||||
|
||||
import FileSystemApi._
|
||||
|
||||
/**
|
||||
* Writes textual content to a file.
|
||||
/** Writes textual content to a file.
|
||||
*
|
||||
* @param file path to the file
|
||||
* @param content a textual content of the file
|
||||
@ -30,8 +28,7 @@ trait FileSystemApi[F[_, _]] {
|
||||
content: String
|
||||
): F[FileSystemFailure, Unit]
|
||||
|
||||
/**
|
||||
* Writes binary content to a file.
|
||||
/** Writes binary content to a file.
|
||||
*
|
||||
* @param file path to the file
|
||||
* @param contents a binary content of the file
|
||||
@ -42,16 +39,14 @@ trait FileSystemApi[F[_, _]] {
|
||||
contents: Array[Byte]
|
||||
): BlockingIO[FileSystemFailure, Unit]
|
||||
|
||||
/**
|
||||
* Reads the contents of a textual file.
|
||||
/** Reads the contents of a textual file.
|
||||
*
|
||||
* @param file path to the file
|
||||
* @return either [[FileSystemFailure]] or the content of a file as a 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
|
||||
* @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]]
|
||||
|
||||
/**
|
||||
* Deletes the specified file or directory recursively.
|
||||
/** Deletes the specified file or directory recursively.
|
||||
*
|
||||
* @param file path to the file or directory
|
||||
* @return either [[FileSystemFailure]] or 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
|
||||
* @return
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param file path to the file
|
||||
@ -84,8 +76,7 @@ trait FileSystemApi[F[_, _]] {
|
||||
*/
|
||||
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 to a path to the destination
|
||||
@ -96,8 +87,7 @@ trait FileSystemApi[F[_, _]] {
|
||||
to: File
|
||||
): F[FileSystemFailure, Unit]
|
||||
|
||||
/**
|
||||
* Move a file or directory recursively
|
||||
/** Move a file or directory recursively
|
||||
*
|
||||
* @param from a path to the source
|
||||
* @param to a path to the destination
|
||||
@ -108,24 +98,21 @@ trait FileSystemApi[F[_, _]] {
|
||||
to: File
|
||||
): F[FileSystemFailure, Unit]
|
||||
|
||||
/**
|
||||
* Checks if the specified file exists.
|
||||
/** Checks if the specified file exists.
|
||||
*
|
||||
* @param file path to the file or directory
|
||||
* @return either [[FileSystemFailure]] or file existence flag
|
||||
*/
|
||||
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
|
||||
* @return either [[FileSystemFailure]] or list of entries
|
||||
*/
|
||||
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 depth maximum depth of a directory tree
|
||||
@ -136,8 +123,7 @@ trait FileSystemApi[F[_, _]] {
|
||||
depth: Option[Int]
|
||||
): F[FileSystemFailure, DirectoryEntry]
|
||||
|
||||
/**
|
||||
* Returns attributes of a given path.
|
||||
/** Returns attributes of a given path.
|
||||
*
|
||||
* @param path to the file system object
|
||||
* @return either [[FileSystemFailure]] or file attributes
|
||||
@ -147,8 +133,7 @@ trait FileSystemApi[F[_, _]] {
|
||||
|
||||
object FileSystemApi {
|
||||
|
||||
/**
|
||||
* An object representing abstract file system entry.
|
||||
/** An object representing abstract file system entry.
|
||||
*/
|
||||
sealed trait Entry {
|
||||
def path: Path
|
||||
@ -156,8 +141,7 @@ object FileSystemApi {
|
||||
|
||||
object Entry {
|
||||
|
||||
/**
|
||||
* Creates [[Entry]] from file system attributes.
|
||||
/** Creates [[Entry]] from file system attributes.
|
||||
*
|
||||
* @param path a path to the file system object
|
||||
* @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 children a paths to the children entries
|
||||
@ -188,35 +171,30 @@ object FileSystemApi {
|
||||
DirectoryEntry(path, ArrayBuffer())
|
||||
}
|
||||
|
||||
/**
|
||||
* An entry representing a directory with contents truncated.
|
||||
/** An entry representing a directory with contents truncated.
|
||||
*
|
||||
* @param path to the directory
|
||||
*/
|
||||
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 target of the symlink.
|
||||
*/
|
||||
case class SymbolicLinkEntry(path: Path, target: Path) extends Entry
|
||||
|
||||
/**
|
||||
* An entry representing a file.
|
||||
/** An entry representing a file.
|
||||
*
|
||||
* @param path to the file
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* Basic attributes of an [[Entry]].
|
||||
/** Basic attributes of an [[Entry]].
|
||||
*
|
||||
* @param creationTime creation time
|
||||
* @param lastAccessTime last access time
|
||||
@ -234,8 +212,7 @@ object FileSystemApi {
|
||||
|
||||
object Attributes {
|
||||
|
||||
/**
|
||||
* Creates attributes using the `FileTime` time.
|
||||
/** Creates attributes using the `FileTime` time.
|
||||
*
|
||||
* @param creationTime creation time
|
||||
* @param lastAccessTime last access time
|
||||
@ -259,8 +236,7 @@ object FileSystemApi {
|
||||
byteSize = byteSize
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates [[Attributes]] from file system attributes
|
||||
/** Creates [[Attributes]] from file system attributes
|
||||
*
|
||||
* @param path to the file system object
|
||||
* @param attributes of a file system object
|
||||
|
@ -1,42 +1,34 @@
|
||||
package org.enso.languageserver.filemanager
|
||||
|
||||
/**
|
||||
* Represents file system failures.
|
||||
/** Represents file system failures.
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
/**
|
||||
* Signals that the file cannot be found.
|
||||
/** Signals that the file cannot be found.
|
||||
*/
|
||||
case object FileNotFound extends FileSystemFailure
|
||||
|
||||
/**
|
||||
* Signals that the file already exists.
|
||||
/** Signals that the file already exists.
|
||||
*/
|
||||
case object FileExists extends FileSystemFailure
|
||||
|
||||
/**
|
||||
* Signal that the operation timed out.
|
||||
/** Signal that the operation timed out.
|
||||
*/
|
||||
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
|
||||
|
||||
/**
|
||||
* Signals file system specific errors.
|
||||
/** Signals file system specific errors.
|
||||
*
|
||||
* @param reason a reason of failure
|
||||
*/
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.protocol.json.ErrorApi
|
||||
|
||||
object FileSystemFailureMapper {
|
||||
|
||||
/**
|
||||
* Maps [[FileSystemFailure]] into JSON RPC error.
|
||||
/** Maps [[FileSystemFailure]] into JSON RPC error.
|
||||
*
|
||||
* @param fileSystemFailure file system specific failure
|
||||
* @return JSON RPC error
|
||||
|
@ -4,23 +4,20 @@ import io.circe.generic.auto._
|
||||
import io.circe.syntax._
|
||||
import io.circe.{Decoder, Encoder, Json}
|
||||
|
||||
/**
|
||||
* A representation of filesystem object.
|
||||
/** A representation of filesystem object.
|
||||
*/
|
||||
sealed trait FileSystemObject
|
||||
|
||||
object FileSystemObject {
|
||||
|
||||
/**
|
||||
* Represents a directory.
|
||||
/** Represents a directory.
|
||||
*
|
||||
* @param name a name of the directory
|
||||
* @param path a path to the directory
|
||||
*/
|
||||
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 path a path to the symlink
|
||||
@ -30,16 +27,14 @@ object FileSystemObject {
|
||||
case class SymlinkLoop(name: String, path: Path, target: Path)
|
||||
extends FileSystemObject
|
||||
|
||||
/**
|
||||
* Represents a file.
|
||||
/** Represents a file.
|
||||
*
|
||||
* @param name a name of the file
|
||||
* @param path a path to the file
|
||||
*/
|
||||
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
|
||||
|
||||
|
@ -5,8 +5,7 @@ import java.nio
|
||||
import java.nio.file.Paths
|
||||
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 segments path segments
|
||||
@ -14,8 +13,8 @@ import java.util.UUID
|
||||
case class Path(rootId: UUID, segments: Vector[String]) {
|
||||
|
||||
def toFile(rootPath: File): File =
|
||||
segments.foldLeft(rootPath) {
|
||||
case (parent, child) => new File(parent, child)
|
||||
segments.foldLeft(rootPath) { case (parent, child) =>
|
||||
new File(parent, child)
|
||||
}
|
||||
|
||||
def toFile(rootPath: File, fileName: String): File = {
|
||||
@ -38,8 +37,7 @@ object Path {
|
||||
b.result().filter(_.nonEmpty)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get path relative to the root.
|
||||
/** Get path relative to the root.
|
||||
*
|
||||
* @param root a root path
|
||||
* @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 =
|
||||
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 base a path relative to the root
|
||||
|
@ -23,8 +23,7 @@ import zio._
|
||||
|
||||
import scala.concurrent.Await
|
||||
|
||||
/**
|
||||
* Starts [[WatcherAdapter]], handles errors, converts and sends
|
||||
/** Starts [[WatcherAdapter]], handles errors, converts and sends
|
||||
* events to the client.
|
||||
*
|
||||
* @param config configuration
|
||||
@ -55,33 +54,32 @@ final class PathWatcher(
|
||||
|
||||
override def receive: Receive = uninitializedStage
|
||||
|
||||
private def uninitializedStage: Receive = {
|
||||
case WatchPath(path, clients) =>
|
||||
val pathToWatchResult = config
|
||||
.findContentRoot(path.rootId)
|
||||
.map(path.toFile(_))
|
||||
val result: BlockingIO[FileSystemFailure, Unit] =
|
||||
for {
|
||||
pathToWatch <- IO.fromEither(pathToWatchResult)
|
||||
_ <- validatePath(pathToWatch)
|
||||
watcher <- IO.fromEither(buildWatcher(pathToWatch))
|
||||
_ <- IO.fromEither(startWatcher(watcher))
|
||||
} yield ()
|
||||
private def uninitializedStage: Receive = { case WatchPath(path, clients) =>
|
||||
val pathToWatchResult = config
|
||||
.findContentRoot(path.rootId)
|
||||
.map(path.toFile(_))
|
||||
val result: BlockingIO[FileSystemFailure, Unit] =
|
||||
for {
|
||||
pathToWatch <- IO.fromEither(pathToWatchResult)
|
||||
_ <- validatePath(pathToWatch)
|
||||
watcher <- IO.fromEither(buildWatcher(pathToWatch))
|
||||
_ <- IO.fromEither(startWatcher(watcher))
|
||||
} yield ()
|
||||
|
||||
exec
|
||||
.exec(result)
|
||||
.map {
|
||||
case Right(()) => CapabilityAcquired
|
||||
case Left(err) => CapabilityAcquisitionFileSystemFailure(err)
|
||||
}
|
||||
.pipeTo(sender())
|
||||
|
||||
pathToWatchResult match {
|
||||
case Right(root) =>
|
||||
context.become(initializedStage(root, path, clients))
|
||||
case Left(_) =>
|
||||
context.stop(self)
|
||||
exec
|
||||
.exec(result)
|
||||
.map {
|
||||
case Right(()) => CapabilityAcquired
|
||||
case Left(err) => CapabilityAcquisitionFileSystemFailure(err)
|
||||
}
|
||||
.pipeTo(sender())
|
||||
|
||||
pathToWatchResult match {
|
||||
case Right(root) =>
|
||||
context.become(initializedStage(root, path, clients))
|
||||
case Left(_) =>
|
||||
context.stop(self)
|
||||
}
|
||||
}
|
||||
|
||||
private def initializedStage(
|
||||
@ -178,8 +176,7 @@ final class PathWatcher(
|
||||
|
||||
object PathWatcher {
|
||||
|
||||
/**
|
||||
* Counter for unsuccessful file watcher restarts.
|
||||
/** Counter for unsuccessful file watcher restarts.
|
||||
*
|
||||
* @param maxRestarts maximum restart attempts
|
||||
*/
|
||||
@ -187,33 +184,28 @@ object PathWatcher {
|
||||
|
||||
private var restartCount: Int = 0
|
||||
|
||||
/**
|
||||
* Return current restart count.
|
||||
/** Return current restart count.
|
||||
*/
|
||||
def count: Int =
|
||||
restartCount
|
||||
|
||||
/**
|
||||
* Increment restart count.
|
||||
/** Increment restart count.
|
||||
*/
|
||||
def inc(): Unit =
|
||||
restartCount += 1
|
||||
|
||||
/**
|
||||
* Reset restart count.
|
||||
/** Reset restart count.
|
||||
*/
|
||||
def reset(): Unit =
|
||||
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 =
|
||||
restartCount < maxRestarts
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a configuration object used to create a [[PathWatcher]].
|
||||
/** Creates a configuration object used to create a [[PathWatcher]].
|
||||
*
|
||||
* @param config configuration
|
||||
* @param fs file system
|
||||
|
@ -4,8 +4,7 @@ import akka.actor.ActorRef
|
||||
|
||||
object PathWatcherProtocol {
|
||||
|
||||
/**
|
||||
* Requests event manager to watch the path.
|
||||
/** Requests event manager to watch the path.
|
||||
*
|
||||
* @param path path to watch
|
||||
*/
|
||||
@ -17,13 +16,11 @@ object PathWatcherProtocol {
|
||||
WatchPath(path, Set(client))
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests event manager to stop watching.
|
||||
/** Requests event manager to stop watching.
|
||||
*/
|
||||
case class UnwatchPath(client: ActorRef)
|
||||
|
||||
/**
|
||||
* Returns a file event result.
|
||||
/** Returns a file event result.
|
||||
*
|
||||
* @param result file event
|
||||
*/
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.data.{
|
||||
import org.enso.languageserver.effect._
|
||||
import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
/**
|
||||
* Handles `receivesTreeUpdates` capabilities acquisition and release.
|
||||
/** Handles `receivesTreeUpdates` capabilities acquisition and release.
|
||||
*
|
||||
* == Implementation ==
|
||||
*
|
||||
@ -64,8 +63,8 @@ final class ReceivesTreeUpdatesHandler(
|
||||
|
||||
private def withStore(store: Store): Receive = {
|
||||
case AcquireCapability(
|
||||
client,
|
||||
CapabilityRegistration(ReceivesTreeUpdates(path))
|
||||
client,
|
||||
CapabilityRegistration(ReceivesTreeUpdates(path))
|
||||
) =>
|
||||
store.getWatcher(path) match {
|
||||
case Some(watcher) =>
|
||||
@ -83,8 +82,8 @@ final class ReceivesTreeUpdatesHandler(
|
||||
}
|
||||
|
||||
case ReleaseCapability(
|
||||
client,
|
||||
CapabilityRegistration(ReceivesTreeUpdates(path))
|
||||
client,
|
||||
CapabilityRegistration(ReceivesTreeUpdates(path))
|
||||
) =>
|
||||
store.getWatcher(path) match {
|
||||
case Some(watcher) =>
|
||||
@ -100,15 +99,13 @@ final class ReceivesTreeUpdatesHandler(
|
||||
|
||||
object ReceivesTreeUpdatesHandler {
|
||||
|
||||
/**
|
||||
* Internal state of a [[ReceivesTreeUpdatesHandler]].
|
||||
/** Internal state of a [[ReceivesTreeUpdatesHandler]].
|
||||
*
|
||||
* @param watchers mappings of a path watcher with a path
|
||||
*/
|
||||
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
|
||||
* @return optional watcher associated with this path
|
||||
@ -116,8 +113,7 @@ object ReceivesTreeUpdatesHandler {
|
||||
def getWatcher(path: Path): Option[ActorRef] =
|
||||
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 path watched path
|
||||
@ -126,8 +122,7 @@ object ReceivesTreeUpdatesHandler {
|
||||
def addWatcher(watcher: ActorRef, path: Path): Store =
|
||||
copy(watchers = watchers + (path -> watcher))
|
||||
|
||||
/**
|
||||
* Remove watcher from the store.
|
||||
/** Remove watcher from the store.
|
||||
*
|
||||
* @param watcher path watcher
|
||||
* @return updated store
|
||||
@ -142,8 +137,7 @@ object ReceivesTreeUpdatesHandler {
|
||||
new Store(Map())
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a configuration object used to create a
|
||||
/** Creates a configuration object used to create a
|
||||
* [[ReceivesTreeUpdatesHandler]].
|
||||
*
|
||||
* @param config configuration
|
||||
|
@ -5,8 +5,7 @@ import java.nio.file.Path
|
||||
import io.methvin.watcher._
|
||||
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 eventCallback callback that fires on the file system events
|
||||
@ -26,20 +25,17 @@ final class WatcherAdapter(
|
||||
.listener(this)
|
||||
.build()
|
||||
|
||||
/**
|
||||
* Start watcher.
|
||||
/** Start watcher.
|
||||
*/
|
||||
def start(): IO[Throwable, Unit] =
|
||||
IO(watcher.watch())
|
||||
|
||||
/**
|
||||
* Stop watcher.
|
||||
/** Stop watcher.
|
||||
*/
|
||||
def stop(): IO[Throwable, Unit] =
|
||||
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 = {
|
||||
WatcherEvent
|
||||
@ -54,15 +50,13 @@ final class WatcherAdapter(
|
||||
|
||||
object WatcherAdapter {
|
||||
|
||||
/**
|
||||
* Type of a file event.
|
||||
/** Type of a file event.
|
||||
*/
|
||||
sealed trait EventType
|
||||
|
||||
private object EventType {
|
||||
|
||||
/**
|
||||
* Creates [[EventType]] from file system event type.
|
||||
/** Creates [[EventType]] from file system event type.
|
||||
*
|
||||
* @param eventType file system 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
|
||||
|
||||
/**
|
||||
* Event type indicating file modification.
|
||||
/** Event type indicating file modification.
|
||||
*/
|
||||
case object EventTypeModify extends EventType
|
||||
|
||||
/**
|
||||
* Event type indicating file deletion.
|
||||
/** Event type indicating file deletion.
|
||||
*/
|
||||
case object EventTypeDelete extends EventType
|
||||
|
||||
/**
|
||||
* Object representing file system event.
|
||||
/** Object representing file system event.
|
||||
*
|
||||
* @param path path to the file system object
|
||||
* @param eventType event type
|
||||
@ -101,8 +91,7 @@ object WatcherAdapter {
|
||||
|
||||
object WatcherEvent {
|
||||
|
||||
/**
|
||||
* Conversion form file system event to [[WatcherEvent]]
|
||||
/** Conversion form file system event to [[WatcherEvent]]
|
||||
*
|
||||
* @param event file system event
|
||||
* @return watcher event
|
||||
@ -113,8 +102,7 @@ object WatcherAdapter {
|
||||
.map(WatcherEvent(event.path(), _))
|
||||
}
|
||||
|
||||
/**
|
||||
* Object representing en error.
|
||||
/** Object representing en error.
|
||||
*
|
||||
* @param exception an error
|
||||
*/
|
||||
|
@ -2,44 +2,37 @@ package org.enso.languageserver.http.server
|
||||
|
||||
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]].
|
||||
*/
|
||||
object BinaryWebSocketControlProtocol {
|
||||
|
||||
/**
|
||||
* Base trait for web socket events.
|
||||
/** Base trait for web socket events.
|
||||
*/
|
||||
sealed trait WsEvent
|
||||
|
||||
/**
|
||||
* Base trait for web socket commands.
|
||||
/** Base trait for web socket commands.
|
||||
*/
|
||||
sealed trait WsCommand
|
||||
|
||||
/**
|
||||
* Signals that a connection has been closed.
|
||||
/** Signals that a connection has been closed.
|
||||
*/
|
||||
case object ConnectionClosed extends WsEvent
|
||||
|
||||
/**
|
||||
* Signals connection failure.
|
||||
/** Signals connection failure.
|
||||
*
|
||||
* @param throwable a throwable
|
||||
*/
|
||||
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
|
||||
*/
|
||||
case class OutboundStreamEstablished(outboundChannel: ActorRef)
|
||||
extends WsEvent
|
||||
|
||||
/**
|
||||
* Command that closes a connection.
|
||||
/** Command that closes a connection.
|
||||
*/
|
||||
case object CloseConnection extends WsCommand
|
||||
|
||||
|
@ -28,8 +28,7 @@ import org.enso.languageserver.util.binary.{
|
||||
import scala.concurrent.duration._
|
||||
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 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.
|
||||
*
|
||||
* @param interface the interface to bind to.
|
||||
@ -150,8 +148,7 @@ class BinaryWebSocketServer[A, B](
|
||||
|
||||
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
|
||||
* if the downstream connection is lagging behind.
|
||||
@ -167,8 +164,7 @@ object BinaryWebSocketServer {
|
||||
|
||||
case object Config {
|
||||
|
||||
/**
|
||||
* Creates a default instance of [[Config]].
|
||||
/** Creates a default instance of [[Config]].
|
||||
*
|
||||
* @return a default config.
|
||||
*/
|
||||
|
@ -3,13 +3,11 @@ package org.enso.languageserver.http.server
|
||||
import akka.actor.ActorRef
|
||||
import akka.http.scaladsl.model.RemoteAddress
|
||||
|
||||
/**
|
||||
* A factory of connection controllers.
|
||||
/** A factory of connection controllers.
|
||||
*/
|
||||
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
|
||||
* @return actor ref of created connection controller
|
||||
|
@ -1,8 +1,7 @@
|
||||
package org.enso.languageserver.io
|
||||
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]]
|
||||
*/
|
||||
|
@ -4,23 +4,20 @@ import org.enso.languageserver.data.ClientId
|
||||
|
||||
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
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param clientId the client that the suppression is performed for
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param output the new data
|
||||
@ -28,8 +25,7 @@ object InputOutputProtocol {
|
||||
*/
|
||||
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 isLineTerminated signals if the input is terminated with a line
|
||||
@ -37,8 +33,7 @@ object InputOutputProtocol {
|
||||
*/
|
||||
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
|
||||
|
||||
|
@ -23,8 +23,7 @@ import org.enso.languageserver.io.ObservablePipedInputStream.{
|
||||
import org.enso.languageserver.session.SessionRouter.DeliverToJsonController
|
||||
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`.
|
||||
*
|
||||
* @param stdIn a stream from which programs read its input data
|
||||
@ -70,16 +69,15 @@ class InputRedirectionController(
|
||||
|
||||
case ReadBlocked =>
|
||||
log.debug("Blocked read detected")
|
||||
liveContexts foreach {
|
||||
case ContextData(_, owner) =>
|
||||
sessionRouter ! DeliverToJsonController(
|
||||
owner,
|
||||
WaitingForStandardInput
|
||||
)
|
||||
liveContexts foreach { case ContextData(_, owner) =>
|
||||
sessionRouter ! DeliverToJsonController(
|
||||
owner,
|
||||
WaitingForStandardInput
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def update(event: InputStreamEvent): Unit = { self ! event }
|
||||
|
||||
override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
|
||||
@ -97,8 +95,7 @@ object InputRedirectionController {
|
||||
|
||||
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]].
|
||||
*
|
||||
* @param stdIn a stream from which programs read its input data
|
||||
|
@ -4,8 +4,7 @@ import java.io.OutputStream
|
||||
|
||||
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
|
||||
* subscribe and unsubscribe for output bytes. It's thread-safe.
|
||||
*/
|
||||
@ -15,19 +14,19 @@ class ObservableOutputStream extends OutputStream {
|
||||
|
||||
private var observers = Set.empty[OutputObserver]
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def write(byte: Int): Unit = lock.synchronized {
|
||||
notify(Array[Byte](byte.toByte))
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def write(bytes: Array[Byte]): Unit = lock.synchronized {
|
||||
if (bytes.length > 0) {
|
||||
notify(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def write(bytes: Array[Byte], off: Int, len: Int): Unit =
|
||||
lock.synchronized {
|
||||
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
|
||||
*/
|
||||
@ -46,8 +44,7 @@ class ObservableOutputStream extends OutputStream {
|
||||
observers += observer
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches an output observer.
|
||||
/** Detaches an output observer.
|
||||
*
|
||||
* @param observer the observer that was subscribed for output bytes
|
||||
*/
|
||||
@ -63,14 +60,12 @@ class ObservableOutputStream extends OutputStream {
|
||||
|
||||
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.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -10,8 +10,7 @@ import org.enso.languageserver.io.ObservablePipedInputStream.{
|
||||
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.
|
||||
* It notifies observers when read operation waits for output stream. The
|
||||
* 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
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def read(): Int = lock.synchronized {
|
||||
waitForBuffer()
|
||||
val byte = buffer.head
|
||||
@ -40,10 +39,10 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
|
||||
byte.toInt
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
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 =
|
||||
lock.synchronized {
|
||||
waitForBuffer()
|
||||
@ -61,12 +60,12 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
|
||||
lock.wait()
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def available(): Int = lock.synchronized {
|
||||
buffer.length
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def update(output: Array[Byte]): Unit = lock.synchronized {
|
||||
buffer = ByteString.createBuilder
|
||||
.append(buffer)
|
||||
@ -75,8 +74,7 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
|
||||
lock.notifyAll()
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches an input observer.
|
||||
/** Attaches an input observer.
|
||||
*
|
||||
* @param observer the observer that subscribe for input events
|
||||
*/
|
||||
@ -84,8 +82,7 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
|
||||
observers += observer
|
||||
}
|
||||
|
||||
/**
|
||||
* Detaches an input observer.
|
||||
/** Detaches an input observer.
|
||||
*
|
||||
* @param observer the observer that was subscribed for input events
|
||||
*/
|
||||
@ -102,25 +99,21 @@ class ObservablePipedInputStream(sink: ObservableOutputStream)
|
||||
|
||||
object ObservablePipedInputStream {
|
||||
|
||||
/**
|
||||
* Base trait of input stream events.
|
||||
/** Base trait of input stream events.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -1,19 +1,16 @@
|
||||
package org.enso.languageserver.io
|
||||
|
||||
/**
|
||||
* A base trait for output kind.
|
||||
/** A base trait for output kind.
|
||||
*/
|
||||
sealed trait 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
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
case object StandardError extends OutputKind
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.io.OutputRedirectionController.CharOutputAppended
|
||||
import org.enso.languageserver.session.SessionRouter.DeliverToJsonController
|
||||
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.
|
||||
*
|
||||
* @param outputStream stdout or stderr
|
||||
@ -57,7 +56,7 @@ class OutputRedirectionController(
|
||||
context.become(running(subscribers - session.clientId))
|
||||
}
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def update(output: Array[Byte]): Unit =
|
||||
self ! CharOutputAppended(new String(output))
|
||||
|
||||
@ -76,8 +75,7 @@ object OutputRedirectionController {
|
||||
|
||||
private case class CharOutputAppended(output: String)
|
||||
|
||||
/**
|
||||
* Creates a configuration object used to create a
|
||||
/** Creates a configuration object used to create a
|
||||
* [[OutputRedirectionController]].
|
||||
*
|
||||
* @param outputStream stdout or stderr
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.monitoring
|
||||
|
||||
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]]
|
||||
* for message specifications.
|
||||
*/
|
||||
|
@ -2,13 +2,11 @@ package org.enso.languageserver.monitoring
|
||||
|
||||
object MonitoringProtocol {
|
||||
|
||||
/**
|
||||
* A ping command.
|
||||
/** A ping command.
|
||||
*/
|
||||
case object Ping
|
||||
|
||||
/**
|
||||
* A pong reply.
|
||||
/** A pong reply.
|
||||
*/
|
||||
case object Pong
|
||||
|
||||
|
@ -47,8 +47,7 @@ import org.enso.languageserver.util.binary.DecodingFailure.{
|
||||
import scala.annotation.unused
|
||||
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
|
||||
* all incoming requests and dispatching commands.
|
||||
*
|
||||
|
@ -4,16 +4,15 @@ import akka.actor.{ActorRef, ActorSystem, Props}
|
||||
import akka.http.scaladsl.model.RemoteAddress
|
||||
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
|
||||
*/
|
||||
class BinaryConnectionControllerFactory(fileManager: ActorRef)(
|
||||
implicit system: ActorSystem
|
||||
class BinaryConnectionControllerFactory(fileManager: ActorRef)(implicit
|
||||
system: ActorSystem
|
||||
) extends ConnectionControllerFactory {
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def createController(clientIp: RemoteAddress.IP): ActorRef = {
|
||||
system.actorOf(Props(new BinaryConnectionController(clientIp, fileManager)))
|
||||
}
|
||||
|
@ -10,12 +10,11 @@ import org.enso.languageserver.util.binary.DecodingFailure.{
|
||||
}
|
||||
import org.enso.languageserver.util.binary.{BinaryDecoder, DecodingFailure}
|
||||
|
||||
/**
|
||||
* A decoder for an [[InboundMessage]].
|
||||
/** A decoder for an [[InboundMessage]].
|
||||
*/
|
||||
object InboundMessageDecoder extends BinaryDecoder[InboundMessage] {
|
||||
|
||||
/** @inheritdoc **/
|
||||
/** @inheritdoc */
|
||||
override def decode(
|
||||
bytes: ByteBuffer
|
||||
): Either[DecodingFailure, InboundMessage] =
|
||||
|
@ -7,8 +7,7 @@ import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||
|
||||
object EnsoUuidFactory {
|
||||
|
||||
/**
|
||||
* Creates EnsoUUID inside a [[FlatBufferBuilder]].
|
||||
/** Creates EnsoUUID inside a [[FlatBufferBuilder]].
|
||||
*
|
||||
* @param uuid a uuid to serialize
|
||||
* @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 builder a class that helps build a FlatBuffer representation of
|
||||
|
@ -9,24 +9,21 @@ import org.enso.languageserver.protocol.binary.{EnsoUUID, Error}
|
||||
|
||||
object ErrorFactory {
|
||||
|
||||
/**
|
||||
* Creates a ReceivedCorruptedDataError inside a [[FlatBufferBuilder]].
|
||||
/** Creates a ReceivedCorruptedDataError inside a [[FlatBufferBuilder]].
|
||||
*
|
||||
* @return an FlatBuffer representation of the created error
|
||||
*/
|
||||
def createReceivedCorruptedDataError(): ByteBuffer =
|
||||
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
|
||||
*/
|
||||
def createReceivedEmptyPayloadError(): ByteBuffer =
|
||||
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
|
||||
*/
|
||||
@ -35,8 +32,7 @@ object ErrorFactory {
|
||||
): ByteBuffer =
|
||||
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
|
||||
* @return an FlatBuffer representation of the created error
|
||||
@ -47,8 +43,7 @@ object ErrorFactory {
|
||||
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 message an error textual message
|
||||
|
@ -10,8 +10,7 @@ import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||
|
||||
object FileContentsReplyFactory {
|
||||
|
||||
/**
|
||||
* Creates a [[FileContentsReply]] inside a [[FlatBufferBuilder]].
|
||||
/** Creates a [[FileContentsReply]] inside a [[FlatBufferBuilder]].
|
||||
*
|
||||
* @param contents the binary contents of a file
|
||||
* @param correlationId correlation id used to correlate a response with a
|
||||
|
@ -8,8 +8,7 @@ import org.enso.languageserver.protocol.binary.EnsoUUID
|
||||
|
||||
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 maybeCorrelationId an optional correlation id used to correlate
|
||||
|
@ -9,8 +9,7 @@ import org.enso.languageserver.protocol.binary.{EnsoUUID, Success}
|
||||
|
||||
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
|
||||
* complex objects
|
||||
@ -22,8 +21,7 @@ object SuccessReplyFactory {
|
||||
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
|
||||
* request
|
||||
|
@ -12,8 +12,7 @@ import org.enso.languageserver.runtime.ContextRegistryProtocol.{
|
||||
|
||||
object VisualisationUpdateFactory {
|
||||
|
||||
/**
|
||||
* Creates a [[VisualisationUpdate]] inside a [[FlatBufferBuilder]].
|
||||
/** Creates a [[VisualisationUpdate]] inside a [[FlatBufferBuilder]].
|
||||
*
|
||||
* @param update a visualisation update
|
||||
* @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
|
||||
* created object
|
||||
*/
|
||||
def create(update: VisualisationUpdate)(
|
||||
implicit builder: FlatBufferBuilder
|
||||
def create(update: VisualisationUpdate)(implicit
|
||||
builder: FlatBufferBuilder
|
||||
): Int = {
|
||||
val ctx = createVisualisationCtx(update.visualisationContext)
|
||||
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 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
|
||||
* created object
|
||||
*/
|
||||
def createVisualisationCtx(ctx: VisualisationContext)(
|
||||
implicit builder: FlatBufferBuilder
|
||||
def createVisualisationCtx(ctx: VisualisationContext)(implicit
|
||||
builder: FlatBufferBuilder
|
||||
): Int = {
|
||||
BinaryVisualisationContext.startVisualisationContext(builder)
|
||||
BinaryVisualisationContext.addContextId(
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.protocol.json
|
||||
|
||||
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]]
|
||||
*/
|
||||
|
@ -61,8 +61,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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.
|
||||
*
|
||||
* @param connectionId the internal connection id.
|
||||
@ -309,8 +308,7 @@ class 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 bufferRegistry a router that dispatches text editing requests
|
||||
|
@ -5,8 +5,7 @@ import java.util.UUID
|
||||
import akka.actor.{ActorRef, ActorSystem}
|
||||
import org.enso.jsonrpc.ClientControllerFactory
|
||||
|
||||
/**
|
||||
* Language server client controller factory.
|
||||
/** Language server client controller factory.
|
||||
*
|
||||
* @param bufferRegistry the buffer registry actor ref
|
||||
* @param capabilityRouter the capability router actor ref
|
||||
@ -25,8 +24,7 @@ class JsonConnectionControllerFactory(
|
||||
)(implicit system: ActorSystem)
|
||||
extends ClientControllerFactory {
|
||||
|
||||
/**
|
||||
* Creates a client controller actor.
|
||||
/** Creates a client controller actor.
|
||||
*
|
||||
* @param clientId the internal client id.
|
||||
* @return
|
||||
|
@ -20,8 +20,7 @@ import org.enso.languageserver.text.TextApi._
|
||||
|
||||
object JsonRpc {
|
||||
|
||||
/**
|
||||
* A description of supported JSON RPC messages.
|
||||
/** A description of supported JSON RPC messages.
|
||||
*/
|
||||
val protocol: Protocol = Protocol.empty
|
||||
.registerRequest(Ping)
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.refactoring
|
||||
|
||||
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 newName the new project name
|
||||
|
@ -2,8 +2,7 @@ package org.enso.languageserver.refactoring
|
||||
|
||||
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]]
|
||||
* for message specifications.
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.enso.languageserver.requesthandler
|
||||
|
||||
/**
|
||||
* Signals that operation has timed out.
|
||||
/** Signals that operation has timed out.
|
||||
*/
|
||||
case object RequestTimeout
|
||||
|
@ -18,8 +18,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -80,8 +79,7 @@ class 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 requestTimeout a request timeout
|
||||
|
@ -20,8 +20,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -75,8 +74,7 @@ class 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 requestTimeout a request timeout
|
||||
|
@ -19,8 +19,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `executionContext/create` commands.
|
||||
/** A request handler for `executionContext/create` commands.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
@ -75,8 +74,7 @@ class CreateHandler(
|
||||
|
||||
object CreateHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[CreateHandler]].
|
||||
/** Creates configuration object used to create a [[CreateHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `executionContext/destroy` commands.
|
||||
/** A request handler for `executionContext/destroy` commands.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
@ -36,9 +35,9 @@ class DestroyHandler(
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case Request(
|
||||
ExecutionContextDestroy,
|
||||
id,
|
||||
params: ExecutionContextDestroy.Params
|
||||
ExecutionContextDestroy,
|
||||
id,
|
||||
params: ExecutionContextDestroy.Params
|
||||
) =>
|
||||
contextRegistry ! DestroyContextRequest(session, params.contextId)
|
||||
val cancellable =
|
||||
@ -70,8 +69,7 @@ class DestroyHandler(
|
||||
|
||||
object DestroyHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[DestroyHandler]].
|
||||
/** Creates configuration object used to create a [[DestroyHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `executionContext/push` commands.
|
||||
/** A request handler for `executionContext/push` commands.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
@ -66,8 +65,7 @@ class PopHandler(
|
||||
|
||||
object PopHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[PopHandler]].
|
||||
/** Creates configuration object used to create a [[PopHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `executionContext/push` commands.
|
||||
/** A request handler for `executionContext/push` commands.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
@ -36,9 +35,9 @@ class PushHandler(
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case Request(
|
||||
ExecutionContextPush,
|
||||
id,
|
||||
params: ExecutionContextPush.Params
|
||||
ExecutionContextPush,
|
||||
id,
|
||||
params: ExecutionContextPush.Params
|
||||
) =>
|
||||
contextRegistry ! PushContextRequest(
|
||||
session,
|
||||
@ -74,8 +73,7 @@ class PushHandler(
|
||||
|
||||
object PushHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[PushHandler]].
|
||||
/** Creates configuration object used to create a [[PushHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `executionContext/recompute` commands.
|
||||
/** A request handler for `executionContext/recompute` commands.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
@ -36,9 +35,9 @@ class RecomputeHandler(
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case Request(
|
||||
ExecutionContextRecompute,
|
||||
id,
|
||||
params: ExecutionContextRecompute.Params
|
||||
ExecutionContextRecompute,
|
||||
id,
|
||||
params: ExecutionContextRecompute.Params
|
||||
) =>
|
||||
contextRegistry ! RecomputeContextRequest(
|
||||
session,
|
||||
@ -74,8 +73,7 @@ class RecomputeHandler(
|
||||
|
||||
object RecomputeHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[RecomputeHandler]].
|
||||
/** Creates configuration object used to create a [[RecomputeHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param contextRegistry a reference to the context registry.
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 fileManager a file system manager actor
|
||||
@ -69,8 +68,7 @@ class InfoFileHandler(requestTimeout: FiniteDuration, fileManager: ActorRef)
|
||||
|
||||
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 fileManager a file system manager actor
|
||||
|
@ -20,8 +20,7 @@ import org.enso.languageserver.util.file.PathUtils
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for [[ReadFileCommand]].
|
||||
/** A request handler for [[ReadFileCommand]].
|
||||
*
|
||||
* @param requestTimeout a request timeout
|
||||
* @param fileManager a file system manager actor
|
||||
@ -39,15 +38,14 @@ class ReadBinaryFileHandler(
|
||||
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case msg: InboundMessage =>
|
||||
val payload =
|
||||
msg.payload(new ReadFileCommand).asInstanceOf[ReadFileCommand]
|
||||
val path = PathUtils.convertBinaryPath(payload.path())
|
||||
fileManager ! FileManagerProtocol.ReadBinaryFile(path)
|
||||
val cancellable = context.system.scheduler
|
||||
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
||||
context.become(responseStage(msg.messageId(), cancellable))
|
||||
private def requestStage: Receive = { case msg: InboundMessage =>
|
||||
val payload =
|
||||
msg.payload(new ReadFileCommand).asInstanceOf[ReadFileCommand]
|
||||
val path = PathUtils.convertBinaryPath(payload.path())
|
||||
fileManager ! FileManagerProtocol.ReadBinaryFile(path)
|
||||
val cancellable = context.system.scheduler
|
||||
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
||||
context.become(responseStage(msg.messageId(), cancellable))
|
||||
}
|
||||
|
||||
private def responseStage(
|
||||
@ -90,8 +88,7 @@ class 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 fileManager a file system manager actor
|
||||
|
@ -20,8 +20,7 @@ import org.enso.languageserver.util.file.PathUtils
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for [[WriteFileCommand]].
|
||||
/** A request handler for [[WriteFileCommand]].
|
||||
*
|
||||
* @param requestTimeout a request timeout
|
||||
* @param fileManager a file system manager actor
|
||||
@ -39,18 +38,17 @@ class WriteBinaryFileHandler(
|
||||
|
||||
override def receive: Receive = requestStage
|
||||
|
||||
private def requestStage: Receive = {
|
||||
case msg: InboundMessage =>
|
||||
val payload =
|
||||
msg.payload(new WriteFileCommand).asInstanceOf[WriteFileCommand]
|
||||
val path = PathUtils.convertBinaryPath(payload.path())
|
||||
val bytes = payload.contentsAsByteBuffer()
|
||||
val contents = Array.fill[Byte](bytes.remaining())(0)
|
||||
bytes.get(contents)
|
||||
fileManager ! FileManagerProtocol.WriteBinaryFile(path, contents)
|
||||
val cancellable = context.system.scheduler
|
||||
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
||||
context.become(responseStage(msg.messageId(), cancellable))
|
||||
private def requestStage: Receive = { case msg: InboundMessage =>
|
||||
val payload =
|
||||
msg.payload(new WriteFileCommand).asInstanceOf[WriteFileCommand]
|
||||
val path = PathUtils.convertBinaryPath(payload.path())
|
||||
val bytes = payload.contentsAsByteBuffer()
|
||||
val contents = Array.fill[Byte](bytes.remaining())(0)
|
||||
bytes.get(contents)
|
||||
fileManager ! FileManagerProtocol.WriteBinaryFile(path, contents)
|
||||
val cancellable = context.system.scheduler
|
||||
.scheduleOnce(requestTimeout, self, RequestTimeout)
|
||||
context.become(responseStage(msg.messageId(), cancellable))
|
||||
}
|
||||
|
||||
private def responseStage(
|
||||
@ -92,8 +90,7 @@ class 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 fileManager a file system manager actor
|
||||
|
@ -6,8 +6,7 @@ import org.enso.languageserver.io.InputOutputApi.FeedStandardInput
|
||||
import org.enso.languageserver.io.InputOutputProtocol
|
||||
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
|
||||
*/
|
||||
@ -30,8 +29,7 @@ class FeedStandardInputHandler(stdInController: ActorRef)
|
||||
|
||||
object FeedStandardInputHandler {
|
||||
|
||||
/**
|
||||
* Creates a configuration object used to create a
|
||||
/** Creates a configuration object used to create a
|
||||
* [[FeedStandardInputHandler]].
|
||||
*
|
||||
* @param stdInController the stdin redirection controller
|
||||
|
@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.RedirectStandardError
|
||||
import org.enso.languageserver.io.InputOutputProtocol
|
||||
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 clientId a client requesting redirection
|
||||
@ -29,8 +28,7 @@ class RedirectStdErrHandler(stdErrController: ActorRef, clientId: ClientId)
|
||||
|
||||
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 clientId a client requesting redirection
|
||||
|
@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.RedirectStandardOutput
|
||||
import org.enso.languageserver.io.InputOutputProtocol
|
||||
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 clientId a client requesting redirection
|
||||
@ -29,8 +28,7 @@ class RedirectStdOutHandler(stdOutController: ActorRef, clientId: ClientId)
|
||||
|
||||
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 clientId a client requesting redirection
|
||||
|
@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.SuppressStandardError
|
||||
import org.enso.languageserver.io.InputOutputProtocol
|
||||
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 clientId a client requesting redirection
|
||||
@ -29,8 +28,7 @@ class SuppressStdErrHandler(stdErrController: ActorRef, clientId: ClientId)
|
||||
|
||||
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 clientId a client requesting redirection
|
||||
|
@ -7,8 +7,7 @@ import org.enso.languageserver.io.InputOutputApi.SuppressStandardOutput
|
||||
import org.enso.languageserver.io.InputOutputProtocol
|
||||
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 clientId a client requesting redirection
|
||||
@ -28,8 +27,7 @@ class SuppressStdOutHandler(stdOutController: ActorRef, clientId: ClientId)
|
||||
|
||||
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 clientId a client requesting redirection
|
||||
|
@ -8,8 +8,7 @@ import org.enso.languageserver.requesthandler.RequestTimeout
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -63,8 +62,7 @@ class 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 timeout a request timeout
|
||||
|
@ -13,8 +13,7 @@ import org.enso.polyglot.runtime.Runtime.Api
|
||||
|
||||
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 runtimeConnector a reference to the runtime connector
|
||||
@ -66,8 +65,7 @@ class RenameProjectHandler(timeout: FiniteDuration, runtimeConnector: ActorRef)
|
||||
|
||||
object RenameProjectHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[RenameProjectHandler]].
|
||||
/** Creates configuration object used to create a [[RenameProjectHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param runtimeConnector reference to the runtime connector
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `search/completion` command.
|
||||
/** A request handler for `search/completion` command.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param suggestionsHandler a reference to the suggestions handler
|
||||
@ -80,8 +79,7 @@ class CompletionHandler(
|
||||
|
||||
object CompletionHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a [[CompletionHandler]].
|
||||
/** Creates configuration object used to create a [[CompletionHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param suggestionsHandler a reference to the suggestions handler
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `search/getSuggestionsDatabase` command.
|
||||
/** A request handler for `search/getSuggestionsDatabase` command.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param suggestionsHandler a reference to the suggestions handler
|
||||
@ -70,8 +69,7 @@ class GetSuggestionsDatabaseHandler(
|
||||
|
||||
object GetSuggestionsDatabaseHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a
|
||||
/** Creates configuration object used to create a
|
||||
* [[GetSuggestionsDatabaseHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
|
@ -13,8 +13,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `search/getSuggestionsDatabaseVersion` command.
|
||||
/** A request handler for `search/getSuggestionsDatabaseVersion` command.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param suggestionsHandler a reference to the suggestions handler
|
||||
@ -70,8 +69,7 @@ class GetSuggestionsDatabaseVersionHandler(
|
||||
|
||||
object GetSuggestionsDatabaseVersionHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a
|
||||
/** Creates configuration object used to create a
|
||||
* [[GetSuggestionsDatabaseVersionHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
|
@ -17,8 +17,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
import scala.concurrent.duration.FiniteDuration
|
||||
|
||||
/**
|
||||
* A request handler for `search/invalidateSuggestionsDatabase` command.
|
||||
/** A request handler for `search/invalidateSuggestionsDatabase` command.
|
||||
*
|
||||
* @param timeout request timeout
|
||||
* @param suggestionsHandler a reference to the suggestions handler
|
||||
@ -75,8 +74,7 @@ class InvalidateSuggestionsDatabaseHandler(
|
||||
|
||||
object InvalidateSuggestionsDatabaseHandler {
|
||||
|
||||
/**
|
||||
* Creates configuration object used to create a
|
||||
/** Creates configuration object used to create a
|
||||
* [[InvalidateSuggestionsDatabaseHandler]].
|
||||
*
|
||||
* @param timeout request timeout
|
||||
|
@ -11,8 +11,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -60,8 +59,7 @@ class 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 timeout a request timeout
|
||||
|
@ -12,8 +12,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -81,8 +80,7 @@ class 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 requestTimeout a request timeout
|
||||
|
@ -12,8 +12,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -63,8 +62,7 @@ class 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 requestTimeout a request timeout
|
||||
|
@ -16,8 +16,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -75,8 +74,7 @@ class 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 requestTimeout a request timeout
|
||||
|
@ -18,8 +18,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout a request timeout
|
||||
@ -94,8 +93,7 @@ class 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 requestTimeout a request timeout
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout request timeout
|
||||
@ -71,8 +70,7 @@ class 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 timeout request timeout
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout request timeout
|
||||
@ -71,8 +70,7 @@ class 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 timeout request timeout
|
||||
|
@ -14,8 +14,7 @@ import org.enso.languageserver.util.UnhandledLogging
|
||||
|
||||
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 timeout request timeout
|
||||
@ -70,8 +69,7 @@ class 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 timeout request timeout
|
||||
|
@ -24,8 +24,7 @@ import org.enso.searcher.SuggestionsRepo
|
||||
import scala.concurrent.Future
|
||||
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
|
||||
* only handles the notifications with the given `contextId`.
|
||||
*
|
||||
@ -122,9 +121,8 @@ final class ContextEventsListener(
|
||||
val methodPointerToSuggestion =
|
||||
methodPointers
|
||||
.zip(suggestionIds)
|
||||
.collect {
|
||||
case (ptr, Some(suggestionId)) =>
|
||||
ptr -> suggestionId
|
||||
.collect { case (ptr, Some(suggestionId)) =>
|
||||
ptr -> suggestionId
|
||||
}
|
||||
.toMap
|
||||
val valueUpdates = expressionUpdates.map { update =>
|
||||
@ -155,8 +153,7 @@ final class ContextEventsListener(
|
||||
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.
|
||||
*
|
||||
* @param error the error message
|
||||
@ -170,8 +167,7 @@ final class ContextEventsListener(
|
||||
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.
|
||||
*
|
||||
* @param diagnostic the diagnostic message
|
||||
@ -188,8 +184,7 @@ final class ContextEventsListener(
|
||||
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.
|
||||
*
|
||||
* @param kind the diagnostic type
|
||||
@ -203,8 +198,7 @@ final class ContextEventsListener(
|
||||
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.
|
||||
*
|
||||
* @param element the runtime stack trace element
|
||||
@ -225,8 +219,7 @@ object ContextEventsListener {
|
||||
/** The action to process the expression updates. */
|
||||
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 repo the suggestions repo
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user