diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 668103b8..41241bbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,9 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4.1.1 - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v23 - uses: cachix/cachix-action@v12 with: @@ -40,7 +40,7 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Cache sbt - uses: actions/cache@v3.3.1 + uses: actions/cache@v3.3.2 with: path: | ~/.sbt diff --git a/.github/workflows/dependency-graph.yml b/.github/workflows/dependency-graph.yml index 6cd06289..aa55dcd1 100644 --- a/.github/workflows/dependency-graph.yml +++ b/.github/workflows/dependency-graph.yml @@ -10,5 +10,5 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4.1.1 - uses: scalacenter/sbt-dependency-submission@v2 diff --git a/build.sbt b/build.sbt index daaa7ab2..9a2b82f2 100644 --- a/build.sbt +++ b/build.sbt @@ -14,7 +14,7 @@ inThisBuild( ) ) -import scala.sys.process._ +import scala.sys.process.* def crossPlugin( x: sbt.librarymanagement.ModuleID @@ -27,15 +27,15 @@ val compilerPlugins = Nil else List( - crossPlugin("org.typelevel" % "kind-projector" % "0.13.2") + crossPlugin("org.typelevel" % "kind-projector" % "0.13.3") )) ThisBuild / versionScheme := Some("early-semver") Global / onChangedBuildSource := ReloadOnSourceChanges -ThisBuild / scalaVersion := "2.13.11" -ThisBuild / crossScalaVersions := Seq("2.13.11") +ThisBuild / scalaVersion := "2.13.13" +ThisBuild / crossScalaVersions := Seq("2.13.13") // For coursier's "latest.integration" ThisBuild / dynverSeparator := "-" @@ -44,10 +44,10 @@ val commonSettings = Seq( organization := "com.kubukoz.playground", libraryDependencies ++= Seq( "org.typelevel" %% "cats-core" % "2.10.0", - "org.typelevel" %% "cats-mtl" % "1.3.1", - "com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test, - "com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test, - "com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test, + "org.typelevel" %% "cats-mtl" % "1.4.0", + "com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test, + "com.disneystreaming" %% "weaver-discipline" % "0.8.4" % Test, + "com.disneystreaming" %% "weaver-scalacheck" % "0.8.4" % Test, "com.softwaremill.diffx" %% "diffx-core" % "0.9.0" % Test, "com.softwaremill.diffx" %% "diffx-cats" % "0.9.0" % Test, ), @@ -95,10 +95,10 @@ lazy val source = module("source") lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "cats-parse" % "0.3.10", + "org.typelevel" %% "cats-parse" % "1.0.0", "io.circe" %% "circe-generic" % "0.14.6" % Test, "io.circe" %% "circe-parser" % "0.14.6" % Test, - "co.fs2" %% "fs2-io" % "3.9.2" % Test, + "co.fs2" %% "fs2-io" % "3.10.2" % Test, ) ) .dependsOn( @@ -124,14 +124,14 @@ lazy val formatter = module("formatter") lazy val core = module("core") .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "cats-effect" % "3.5.2", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.1", + "org.typelevel" %% "cats-effect" % "3.5.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test, - "com.disneystreaming.alloy" % "alloy-core" % "0.2.8" % Test, - "software.amazon.smithy" % "smithy-aws-traits" % "1.39.1" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.6" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.47.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) @@ -152,12 +152,12 @@ lazy val languageSupport = module("language-support") lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( - "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1", + "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.22.0", "io.circe" %% "circe-core" % "0.14.6", - "org.http4s" %% "http4s-ember-client" % "0.23.23", - "org.http4s" %% "http4s-ember-server" % "0.23.23" % Test, - "io.get-coursier" %% "coursier" % "2.1.7", - "org.typelevel" %% "cats-tagless-core" % "0.15.0", + "org.http4s" %% "http4s-ember-client" % "0.23.26", + "org.http4s" %% "http4s-ember-server" % "0.23.26" % Test, + "io.get-coursier" %% "coursier" % "2.1.9", + "org.typelevel" %% "cats-tagless-core" % "0.16.0", ), buildInfoPackage := "playground.lsp.buildinfo", buildInfoKeys ++= Seq(version, scalaBinaryVersion), diff --git a/modules/ast/src/main/scala/playground/smithyql/AST.scala b/modules/ast/src/main/scala/playground/smithyql/AST.scala index 3adc2baf..2b44037c 100644 --- a/modules/ast/src/main/scala/playground/smithyql/AST.scala +++ b/modules/ast/src/main/scala/playground/smithyql/AST.scala @@ -5,9 +5,9 @@ import cats.Functor import cats.Id import cats.Show import cats.data.NonEmptyList -import cats.implicits._ import cats.kernel.Eq import cats.kernel.Order +import cats.syntax.all.* import cats.~> /** The main type for AST nodes of SmithyQL. The type parameter `F[_]` is a type constructor that diff --git a/modules/ast/src/main/scala/playground/smithyql/DSL.scala b/modules/ast/src/main/scala/playground/smithyql/DSL.scala index 25808edc..85e62adb 100644 --- a/modules/ast/src/main/scala/playground/smithyql/DSL.scala +++ b/modules/ast/src/main/scala/playground/smithyql/DSL.scala @@ -1,7 +1,7 @@ package playground.smithyql import cats.Id -import cats.implicits._ +import cats.syntax.all.* object DSL { diff --git a/modules/ast/src/test/scala/playground/Assertions.scala b/modules/ast/src/test/scala/playground/Assertions.scala index 23207841..ea0f7ddd 100644 --- a/modules/ast/src/test/scala/playground/Assertions.scala +++ b/modules/ast/src/test/scala/playground/Assertions.scala @@ -1,10 +1,10 @@ package playground import cats.Id -import cats.implicits._ +import cats.syntax.all.* import com.softwaremill.diffx.Diff import com.softwaremill.diffx.ShowConfig -import playground.smithyql._ +import playground.smithyql.* import weaver.Expectations import weaver.SourceLocation diff --git a/modules/core/src/main/scala/playground/CompilationError.scala b/modules/core/src/main/scala/playground/CompilationError.scala index 1aeded31..b8b44acf 100644 --- a/modules/core/src/main/scala/playground/CompilationError.scala +++ b/modules/core/src/main/scala/playground/CompilationError.scala @@ -3,10 +3,11 @@ package playground import cats.Id import cats.data.IorNel import cats.data.NonEmptyList -import cats.implicits._ import cats.kernel.Eq -import playground.CompilationErrorDetails._ -import playground.smithyql._ +import cats.kernel.Order.catsKernelOrderingForOrder +import cats.syntax.all.* +import playground.CompilationErrorDetails.* +import playground.smithyql.* import playground.smithyql.format.Formatter import smithy.api.TimestampFormat import smithy4s.ShapeId diff --git a/modules/core/src/main/scala/playground/DynamicServiceProxy.scala b/modules/core/src/main/scala/playground/DynamicServiceProxy.scala index b5e15479..1f677484 100644 --- a/modules/core/src/main/scala/playground/DynamicServiceProxy.scala +++ b/modules/core/src/main/scala/playground/DynamicServiceProxy.scala @@ -1,11 +1,11 @@ package playground import cats.MonadThrow -import cats.implicits._ +import cats.syntax.all.* import smithy4s.Document import smithy4s.Endpoint import smithy4s.Service -import smithy4s.kinds._ +import smithy4s.kinds.* import smithy4s.schema.Schema class DynamicServiceProxy[Alg[_[_, _, _, _, _]], Op[_, _, _, _, _]]( diff --git a/modules/core/src/main/scala/playground/FileCompiler.scala b/modules/core/src/main/scala/playground/FileCompiler.scala index 105b45c9..d79a7529 100644 --- a/modules/core/src/main/scala/playground/FileCompiler.scala +++ b/modules/core/src/main/scala/playground/FileCompiler.scala @@ -1,10 +1,9 @@ package playground import cats.Parallel -import cats.effect.implicits._ -import cats.implicits._ +import cats.syntax.all.* import cats.~> -import playground._ +import playground.* import playground.smithyql.SourceFile import playground.smithyql.WithSource diff --git a/modules/core/src/main/scala/playground/FileRunner.scala b/modules/core/src/main/scala/playground/FileRunner.scala index 35738bb7..a118273b 100644 --- a/modules/core/src/main/scala/playground/FileRunner.scala +++ b/modules/core/src/main/scala/playground/FileRunner.scala @@ -1,9 +1,8 @@ package playground import cats.data.NonEmptyList -import cats.effect.implicits._ -import cats.implicits._ -import playground._ +import cats.syntax.all.* +import playground.* import playground.smithyql.SourceFile import playground.smithyql.SourceRange import playground.smithyql.WithSource diff --git a/modules/core/src/main/scala/playground/IorUtils.scala b/modules/core/src/main/scala/playground/IorUtils.scala index 351b379f..3d677dc2 100644 --- a/modules/core/src/main/scala/playground/IorUtils.scala +++ b/modules/core/src/main/scala/playground/IorUtils.scala @@ -4,8 +4,8 @@ import cats.data.Ior import cats.data.Ior.Both import cats.data.Ior.Left import cats.data.Ior.Right -import cats.implicits._ import cats.kernel.Semigroup +import cats.syntax.all.* object IorUtils { diff --git a/modules/core/src/main/scala/playground/MultiServiceResolver.scala b/modules/core/src/main/scala/playground/MultiServiceResolver.scala index f81a664b..15c5fc7c 100644 --- a/modules/core/src/main/scala/playground/MultiServiceResolver.scala +++ b/modules/core/src/main/scala/playground/MultiServiceResolver.scala @@ -1,7 +1,7 @@ package playground import cats.data.EitherNel -import cats.implicits._ +import cats.syntax.all.* import playground.smithyql.OperationName import playground.smithyql.QualifiedIdentifier import playground.smithyql.QueryOperationName diff --git a/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala b/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala index 37a346ce..8afd771e 100644 --- a/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala +++ b/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala @@ -2,7 +2,7 @@ package playground import cats.Contravariant import cats.Id -import cats.implicits._ +import cats.syntax.all.* import playground.smithyql.Binding import playground.smithyql.BooleanLiteral import playground.smithyql.Identifier @@ -35,7 +35,7 @@ import smithy4s.schema.EnumTag import smithy4s.schema.EnumValue import smithy4s.schema.Field import smithy4s.schema.Primitive -import smithy4s.schema.Primitive._ +import smithy4s.schema.Primitive.* import smithy4s.schema.Schema import smithy4s.schema.SchemaVisitor diff --git a/modules/core/src/main/scala/playground/OperationCompiler.scala b/modules/core/src/main/scala/playground/OperationCompiler.scala index 631d34a8..38079273 100644 --- a/modules/core/src/main/scala/playground/OperationCompiler.scala +++ b/modules/core/src/main/scala/playground/OperationCompiler.scala @@ -5,9 +5,9 @@ import cats.data.Ior import cats.data.IorNel import cats.data.Kleisli import cats.data.NonEmptyList -import cats.implicits._ +import cats.syntax.all.* import cats.~> -import playground._ +import playground.* import playground.smithyql.Prelude import playground.smithyql.QualifiedIdentifier import playground.smithyql.Query @@ -16,9 +16,9 @@ import smithy.api import smithy4s.Endpoint import smithy4s.Service import smithy4s.dynamic.DynamicSchemaIndex -import smithyql.syntax._ -import types._ -import util.chaining._ +import smithyql.syntax.* +import types.* +import util.chaining.* trait CompiledInput { type _Op[_, _, _, _, _] diff --git a/modules/core/src/main/scala/playground/OperationRunner.scala b/modules/core/src/main/scala/playground/OperationRunner.scala index ed018e0c..32e0beb3 100644 --- a/modules/core/src/main/scala/playground/OperationRunner.scala +++ b/modules/core/src/main/scala/playground/OperationRunner.scala @@ -13,13 +13,13 @@ import cats.data.NonEmptyList import cats.effect.Async import cats.effect.MonadCancelThrow import cats.effect.Resource -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.std -import cats.implicits._ +import cats.syntax.all.* import fs2.compression.Compression import org.http4s.Uri import org.http4s.client.Client -import playground._ +import playground.* import playground.plugins.PlaygroundPlugin import playground.plugins.SimpleHttpBuilder import playground.smithyql.InputNode @@ -36,9 +36,9 @@ import smithy4s.aws.AwsClient import smithy4s.aws.AwsEnvironment import smithy4s.dynamic.DynamicSchemaIndex import smithy4s.http4s.SimpleRestJsonBuilder -import smithy4s.kinds._ +import smithy4s.kinds.* import smithy4s.schema.Schema -import smithyql.syntax._ +import smithyql.syntax.* trait OperationRunner[F[_]] { diff --git a/modules/core/src/main/scala/playground/PlaygroundConfig.scala b/modules/core/src/main/scala/playground/PlaygroundConfig.scala index f37dfb23..c224497d 100644 --- a/modules/core/src/main/scala/playground/PlaygroundConfig.scala +++ b/modules/core/src/main/scala/playground/PlaygroundConfig.scala @@ -1,7 +1,7 @@ package playground -import cats.implicits._ import cats.kernel.Eq +import cats.syntax.all.* import com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker @@ -73,7 +73,7 @@ object PlaygroundConfig { } - import com.github.plokhotnyuk.jsoniter_scala.core._ + import com.github.plokhotnyuk.jsoniter_scala.core.* val decode: Array[Byte] => Either[Throwable, PlaygroundConfig] = bytes => diff --git a/modules/core/src/main/scala/playground/PreludeCompiler.scala b/modules/core/src/main/scala/playground/PreludeCompiler.scala index b98e6e61..6bfbc511 100644 --- a/modules/core/src/main/scala/playground/PreludeCompiler.scala +++ b/modules/core/src/main/scala/playground/PreludeCompiler.scala @@ -3,11 +3,10 @@ package playground import cats.Applicative import cats.Parallel import cats.data.NonEmptyList -import cats.effect.implicits._ -import cats.implicits._ import cats.mtl.Chronicle -import cats.mtl.implicits._ -import playground._ +import cats.mtl.implicits.* +import cats.syntax.all.* +import playground.* import playground.smithyql.Prelude import playground.smithyql.WithSource diff --git a/modules/core/src/main/scala/playground/QueryCompiler.scala b/modules/core/src/main/scala/playground/QueryCompiler.scala index bdbaa400..ec5e2b1f 100644 --- a/modules/core/src/main/scala/playground/QueryCompiler.scala +++ b/modules/core/src/main/scala/playground/QueryCompiler.scala @@ -3,9 +3,9 @@ package playground import cats.Apply import cats.data.IorNec import cats.data.NonEmptyChain -import cats.implicits._ -import playground.CompilationErrorDetails._ -import playground.smithyql._ +import cats.syntax.all.* +import playground.CompilationErrorDetails.* +import playground.smithyql.* import QueryCompiler.WAST diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index e8f90cc6..7edbdf58 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -4,10 +4,10 @@ import cats.Id import cats.data.Ior import cats.data.NonEmptyChain import cats.data.NonEmptyList -import cats.implicits._ -import playground.CompilationErrorDetails._ -import playground.smithyql._ -import playground.smithyutil._ +import cats.syntax.all.* +import playground.CompilationErrorDetails.* +import playground.smithyql.* +import playground.smithyutil.* import smithy.api import smithy.api.TimestampFormat import smithy4s.Bijection @@ -45,8 +45,8 @@ import smithy4s.schema.Primitive.PUUID import smithy4s.schema.Schema import smithy4s.schema.SchemaVisitor import smithy4s.~> -import types._ -import util.chaining._ +import types.* +import util.chaining.* import java.util.Base64 import java.util.UUID diff --git a/modules/core/src/main/scala/playground/ServiceIndex.scala b/modules/core/src/main/scala/playground/ServiceIndex.scala index 7074e0af..f3f54713 100644 --- a/modules/core/src/main/scala/playground/ServiceIndex.scala +++ b/modules/core/src/main/scala/playground/ServiceIndex.scala @@ -1,12 +1,12 @@ package playground import cats.Id -import cats.implicits._ +import cats.syntax.all.* import playground.smithyql.OperationName import playground.smithyql.QualifiedIdentifier import smithy.api import smithy4s.dynamic.DynamicSchemaIndex -import smithyql.syntax._ +import smithyql.syntax.* // Abstraction for service metadata. Can be used by multi-service compilers/runners/completion providers etc. trait ServiceIndex { diff --git a/modules/core/src/main/scala/playground/ServiceNameExtractor.scala b/modules/core/src/main/scala/playground/ServiceNameExtractor.scala index 43418105..d513e8ad 100644 --- a/modules/core/src/main/scala/playground/ServiceNameExtractor.scala +++ b/modules/core/src/main/scala/playground/ServiceNameExtractor.scala @@ -3,7 +3,7 @@ package playground import aws.api import playground.smithyql.QualifiedIdentifier import smithy4s.Service -import smithyql.syntax._ +import smithyql.syntax.* object ServiceNameExtractor { diff --git a/modules/core/src/main/scala/playground/smithyql/NodeContext.scala b/modules/core/src/main/scala/playground/smithyql/NodeContext.scala index d77f0274..47441ff0 100644 --- a/modules/core/src/main/scala/playground/smithyql/NodeContext.scala +++ b/modules/core/src/main/scala/playground/smithyql/NodeContext.scala @@ -2,7 +2,7 @@ package playground.smithyql import cats.data.Chain import cats.data.Chain.==: -import cats.implicits._ +import cats.syntax.all.* // The path to a position in the parsed source sealed trait NodeContext extends Product with Serializable with NodeContext.PathEntry.TraversalOps { @@ -10,7 +10,7 @@ sealed trait NodeContext extends Product with Serializable with NodeContext.Path def render: String = this match { case NodeContext.Impl(context) => - import NodeContext.PathEntry._ + import NodeContext.PathEntry.* context .map { diff --git a/modules/core/src/main/scala/playground/smithyql/RangeIndex.scala b/modules/core/src/main/scala/playground/smithyql/RangeIndex.scala index 7c750e77..b5401827 100644 --- a/modules/core/src/main/scala/playground/smithyql/RangeIndex.scala +++ b/modules/core/src/main/scala/playground/smithyql/RangeIndex.scala @@ -1,6 +1,6 @@ package playground.smithyql -import cats.implicits._ +import cats.syntax.all.* trait RangeIndex { diff --git a/modules/core/src/main/scala/playground/smithyql/syntax.scala b/modules/core/src/main/scala/playground/smithyql/syntax.scala index 24782e6f..86681df2 100644 --- a/modules/core/src/main/scala/playground/smithyql/syntax.scala +++ b/modules/core/src/main/scala/playground/smithyql/syntax.scala @@ -1,6 +1,6 @@ package playground.smithyql -import cats.implicits._ +import cats.syntax.all.* import playground.ServiceNameExtractor import smithy4s.Service import smithy4s.ShapeId diff --git a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala index e5817182..dd922977 100644 --- a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala +++ b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala @@ -1,14 +1,14 @@ package playground.smithyutil -import cats.implicits._ +import cats.syntax.all.* import smithy.api import smithy4s.Refinement import smithy4s.RefinementProvider import smithy4s.Surjection -import smithy4s.schema.CollectionTag._ -import smithy4s.schema.Primitive._ +import smithy4s.schema.CollectionTag.* +import smithy4s.schema.Primitive.* import smithy4s.schema.Schema -import smithy4s.schema.Schema._ +import smithy4s.schema.Schema.* import smithy4s.~> /** Reifies refinement hints into the schema. @@ -48,6 +48,13 @@ object AddDynamicRefinements extends (Schema ~> Schema) { schema.reifyHint(RefinementProvider.iterableLengthConstraint[IndexedSeq, A]) } + private def enumSchema[A]( + schema: Schema.EnumerationSchema[A] + ): Schema[A] = schema + .reifyHint(RefinementProvider.lengthConstraint(schema.total(_).stringValue.size)) + .reifyHint(RefinementProvider.rangeConstraint[A, Int](schema.total(_).intValue)) + .reifyHint(RefinementProvider.patternConstraint(schema.total(_).stringValue)) + def apply[A]( schema: Schema[A] ): Schema[A] = @@ -69,10 +76,10 @@ object AddDynamicRefinements extends (Schema ~> Schema) { case c: CollectionSchema[_, _] => collection(c) case m: MapSchema[_, _] => m.reifyHint[api.Length] - // explicitly handling each remaining case, in order to get a "mising match" warning if the schema model changes + case e: EnumerationSchema[_] => enumSchema(e) + // explicitly handling each remaining case, in order to get a "missing match" warning if the schema model changes case b: BijectionSchema[_, _] => b case r: RefinementSchema[_, _] => r - case e: EnumerationSchema[_] => e case s: StructSchema[_] => s case l: LazySchema[_] => l case u: UnionSchema[_] => u diff --git a/modules/core/src/main/scala/playground/std/StdlibRuntime.scala b/modules/core/src/main/scala/playground/std/StdlibRuntime.scala index c59b2470..6e1c59eb 100644 --- a/modules/core/src/main/scala/playground/std/StdlibRuntime.scala +++ b/modules/core/src/main/scala/playground/std/StdlibRuntime.scala @@ -2,7 +2,7 @@ package playground.std import cats.Functor import cats.effect.std.UUIDGen -import cats.implicits._ +import cats.syntax.all.* import smithy4s.Timestamp trait StdlibRuntime[F[_]] { diff --git a/modules/core/src/test/scala/playground/Diffs.scala b/modules/core/src/test/scala/playground/Diffs.scala index da60e236..bdde6815 100644 --- a/modules/core/src/test/scala/playground/Diffs.scala +++ b/modules/core/src/test/scala/playground/Diffs.scala @@ -8,9 +8,9 @@ import smithy4s.Blob import scala.annotation.nowarn object Diffs { - import com.softwaremill.diffx._ - import com.softwaremill.diffx.cats._ - import com.softwaremill.diffx.generic.auto._ + import com.softwaremill.diffx.* + import com.softwaremill.diffx.cats.* + import com.softwaremill.diffx.generic.auto.* implicit val diffNodeContext: Diff[NodeContext] = Diff.derivedDiff implicit val diffContextRange: Diff[ContextRange] = Diff.derivedDiff diff --git a/modules/core/src/test/scala/playground/IorUtilsTests.scala b/modules/core/src/test/scala/playground/IorUtilsTests.scala index 1d1cb067..37e28cc9 100644 --- a/modules/core/src/test/scala/playground/IorUtilsTests.scala +++ b/modules/core/src/test/scala/playground/IorUtilsTests.scala @@ -1,8 +1,8 @@ package playground import cats.data.Ior -import cats.implicits._ -import weaver._ +import cats.syntax.all.* +import weaver.* object IorUtilsTests extends FunSuite { diff --git a/modules/core/src/test/scala/playground/MultiServiceResolverTests.scala b/modules/core/src/test/scala/playground/MultiServiceResolverTests.scala index 016ae2ab..9a04749a 100644 --- a/modules/core/src/test/scala/playground/MultiServiceResolverTests.scala +++ b/modules/core/src/test/scala/playground/MultiServiceResolverTests.scala @@ -1,20 +1,20 @@ package playground import cats.Id -import cats.implicits._ -import com.softwaremill.diffx.cats._ -import playground.Diffs._ -import playground.smithyql.Diffs._ +import cats.syntax.all.* +import com.softwaremill.diffx.cats.* +import playground.Diffs.* +import playground.smithyql.Diffs.* import playground.smithyql.OperationName import playground.smithyql.Prelude import playground.smithyql.QualifiedIdentifier import playground.smithyql.QueryOperationName import playground.smithyql.SourceRange -import playground.smithyql.StringRangeUtils._ +import playground.smithyql.StringRangeUtils.* import playground.smithyql.parser.SourceParser -import weaver._ +import weaver.* -import Assertions._ +import Assertions.* import ServiceIndex.ServiceMetadata object MultiServiceResolverTests extends FunSuite { diff --git a/modules/core/src/test/scala/playground/NodeEncoderTests.scala b/modules/core/src/test/scala/playground/NodeEncoderTests.scala index aa14e71f..960049ac 100644 --- a/modules/core/src/test/scala/playground/NodeEncoderTests.scala +++ b/modules/core/src/test/scala/playground/NodeEncoderTests.scala @@ -8,7 +8,7 @@ import demo.smithy.Power import demo.smithy.SampleSparseList import playground.NodeEncoder import playground.smithyql.AST -import playground.smithyql.DSL._ +import playground.smithyql.DSL.* import playground.smithyql.Listed import playground.smithyql.NullLiteral import playground.smithyql.StringLiteral @@ -17,7 +17,7 @@ import smithy4s.Blob import smithy4s.Document import smithy4s.Timestamp import smithy4s.schema.Schema -import weaver._ +import weaver.* object NodeEncoderTests extends FunSuite { diff --git a/modules/core/src/test/scala/playground/PreludeCompilerTests.scala b/modules/core/src/test/scala/playground/PreludeCompilerTests.scala index 4b0a7896..afc03679 100644 --- a/modules/core/src/test/scala/playground/PreludeCompilerTests.scala +++ b/modules/core/src/test/scala/playground/PreludeCompilerTests.scala @@ -4,17 +4,17 @@ import cats.Id import cats.data.Ior import cats.data.IorNel import cats.data.NonEmptyList -import cats.implicits._ -import com.softwaremill.diffx.cats._ +import cats.syntax.all.* +import com.softwaremill.diffx.cats.* import playground.smithyql.OperationName import playground.smithyql.Prelude import playground.smithyql.QualifiedIdentifier -import playground.smithyql.StringRangeUtils._ +import playground.smithyql.StringRangeUtils.* import playground.smithyql.parser.SourceParser -import weaver._ +import weaver.* -import Assertions._ -import Diffs._ +import Assertions.* +import Diffs.* object PreludeCompilerTests extends FunSuite { diff --git a/modules/core/src/test/scala/playground/ServiceNameExtractorTests.scala b/modules/core/src/test/scala/playground/ServiceNameExtractorTests.scala index a34db28e..a1c8b125 100644 --- a/modules/core/src/test/scala/playground/ServiceNameExtractorTests.scala +++ b/modules/core/src/test/scala/playground/ServiceNameExtractorTests.scala @@ -5,7 +5,7 @@ import demo.fake_aws.MyThing import demo.smithy.DemoServiceGen import playground.smithyql.QualifiedIdentifier import smithy4s.ShapeId -import weaver._ +import weaver.* object ServiceNameExtractorTests extends FunSuite { test("extract name of service with an AWS hint") { diff --git a/modules/core/src/test/scala/playground/smithyql/AtPositionTests.scala b/modules/core/src/test/scala/playground/smithyql/AtPositionTests.scala index ef34be43..ae77eb49 100644 --- a/modules/core/src/test/scala/playground/smithyql/AtPositionTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/AtPositionTests.scala @@ -1,9 +1,9 @@ package playground.smithyql -import playground.Assertions._ -import playground.Diffs._ +import playground.Assertions.* +import playground.Diffs.* import playground.smithyql.parser.SourceParser -import weaver._ +import weaver.* object AtPositionTests extends FunSuite { diff --git a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala index 3a1d880a..32842f3a 100644 --- a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala @@ -6,11 +6,12 @@ import cats.data.Chain import cats.data.Ior import cats.data.NonEmptyChain import cats.data.NonEmptyList -import cats.implicits._ +import cats.syntax.all.* import com.softwaremill.diffx.Diff -import com.softwaremill.diffx.cats._ +import com.softwaremill.diffx.cats.* import demo.smithy.Bad import demo.smithy.DeprecatedServiceGen +import demo.smithy.EnumStruct import demo.smithy.FriendSet import demo.smithy.Good import demo.smithy.HasConstraintFields @@ -26,7 +27,7 @@ import demo.smithy.Power import demo.smithy.SampleSparseList import demo.smithy.StringWithLength import org.scalacheck.Arbitrary -import playground.Assertions._ +import playground.Assertions.* import playground.CompilationError import playground.CompilationErrorDetails import playground.CompilationFailed @@ -34,16 +35,16 @@ import playground.CompiledInput import playground.DeprecatedInfo import playground.DiagnosticSeverity import playground.DiagnosticTag -import playground.Diffs._ +import playground.Diffs.* import playground.DynamicModel import playground.OperationCompiler import playground.PreludeCompiler import playground.QueryCompiler import playground.QueryCompilerVisitor import playground.ServiceIndex -import playground.ServiceUtils._ +import playground.ServiceUtils.* import playground.smithyql.parser.SourceParser -import playground.smithyql.syntax._ +import playground.smithyql.syntax.* import playground.std.ClockGen import playground.std.RandomGen import playground.types.IorThrow @@ -57,18 +58,18 @@ import smithy4s.ShapeTag import smithy4s.Timestamp import smithy4s.dynamic.DynamicSchemaIndex import smithy4s.schema.Schema -import weaver._ +import weaver.* import weaver.scalacheck.Checkers import java.time import java.util.UUID -import Arbitraries._ -import StringRangeUtils._ +import Arbitraries.* +import StringRangeUtils.* object CompilationTests extends SimpleIOSuite with Checkers { - import DSL._ + import DSL.* private def compile[A: smithy4s.Schema]( in: QueryCompiler.WAST @@ -732,6 +733,57 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("enum - length validation (dynamic, OK)") { + assert.same( + Ior.right(Document.obj("enumWithLength" -> Document.fromString("AB"))), + compile( + WithSource.liftId(struct("enumWithLength" -> "AB").mapK(WithSource.liftId)) + )(dynamicSchemaFor[EnumStruct]), + ) + } + + pureTest("enum - length validation (dynamic, fail)") { + assert( + compile( + WithSource.liftId(struct("enumWithLength" -> "ABC").mapK(WithSource.liftId)) + )(dynamicSchemaFor[EnumStruct]).isLeft + ) + } + + pureTest("enum - range validation (dynamic, OK)") { + assert.same( + Ior.right(Document.obj("intEnumWithRange" -> Document.fromInt(2))), + compile( + WithSource.liftId(struct("intEnumWithRange" -> "QUEEN").mapK(WithSource.liftId)) + )(dynamicSchemaFor[EnumStruct]), + ) + } + + pureTest("enum - range validation (dynamic, fail)") { + assert( + compile( + WithSource.liftId(struct("intEnumWithRange" -> "KING").mapK(WithSource.liftId)) + )(dynamicSchemaFor[EnumStruct]).isLeft + ) + } + + pureTest("enum - pattern validation (dynamic, OK)") { + assert.same( + Ior.right(Document.obj("enumWithPattern" -> Document.fromString("AB"))), + compile( + WithSource.liftId(struct("enumWithPattern" -> "AB").mapK(WithSource.liftId)) + )(dynamicSchemaFor[EnumStruct]), + ) + } + + pureTest("enum - pattern validation (dynamic, fail)") { + assert( + compile( + WithSource.liftId(struct("enumWithPattern" -> "ABC").mapK(WithSource.liftId)) + )(dynamicSchemaFor[EnumStruct]).isLeft + ) + } + pureTest("enum - fallback to string value") { implicit val diffPower: Diff[Power] = Diff.derived @@ -765,7 +817,7 @@ object CompilationTests extends SimpleIOSuite with Checkers { CompilationError.error( CompilationErrorDetails.UnknownEnumValue( "POISON", - List("FIRE", "LIGHTNING", "WIND", "ICE"), + List("ICE", "FIRE", "LIGHTNING", "WIND"), ), SourceRange(Position(0), Position(0)), ) diff --git a/modules/core/src/test/smithy/demo.smithy b/modules/core/src/test/smithy/demo.smithy index 9697bed6..250ebdde 100644 --- a/modules/core/src/test/smithy/demo.smithy +++ b/modules/core/src/test/smithy/demo.smithy @@ -250,6 +250,31 @@ string MyString @length(min: 1) string StringWithLength +structure EnumStruct { + @length(max: 2) + enumWithLength: EnumABC + + @pattern("^.{0,2}$") + enumWithPattern: EnumABC + + @range(max: 2) + intEnumWithRange: FaceCard +} + +enum EnumABC { + A, + AB, + ABC +} + +intEnum FaceCard { + JACK = 1 + QUEEN = 2 + KING = 3 + ACE = 4 + JOKER = 5 +} + structure HasConstraintFields { @required minLength: StringWithLength diff --git a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala index 7ca8f8c7..de13b1af 100644 --- a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala +++ b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala @@ -3,8 +3,8 @@ package playground.e2e import buildinfo.BuildInfo import cats.effect.IO import cats.effect.kernel.Resource -import cats.effect.unsafe.implicits._ -import cats.implicits._ +import cats.effect.unsafe.implicits.* +import cats.syntax.all.* import fs2.io.file import org.eclipse.lsp4j.InitializeParams import org.eclipse.lsp4j.InitializeResult @@ -16,14 +16,14 @@ import org.eclipse.lsp4j.WorkspaceFolder import org.eclipse.lsp4j.launch.LSPLauncher import org.eclipse.lsp4j.services.LanguageServer import playground.lsp.PlaygroundLanguageClient -import weaver._ +import weaver.* import java.io.PrintWriter import java.lang.ProcessBuilder.Redirect import java.util.concurrent.CompletableFuture -import scala.concurrent.duration._ -import scala.jdk.CollectionConverters._ -import scala.util.chaining._ +import scala.concurrent.duration.* +import scala.jdk.CollectionConverters.* +import scala.util.chaining.* object E2ETests extends SimpleIOSuite { @@ -103,9 +103,12 @@ object E2ETests extends SimpleIOSuite { ): InitializeParams = new InitializeParams() .tap( _.setWorkspaceFolders( - workspaceFolders.map { path => - new WorkspaceFolder(path.toNioPath.toUri().toString()) - }.asJava + workspaceFolders + .zipWithIndex + .map { case (path, i) => + new WorkspaceFolder(path.toNioPath.toUri().toString(), s"test-workspace-$i") + } + .asJava ) ) diff --git a/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala b/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala index 3a71f518..0cf1ae1f 100644 --- a/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala +++ b/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala @@ -1,9 +1,10 @@ package playground.smithyql.format -import cats.implicits._ +import cats.kernel.Order.catsKernelOrderingForOrder +import cats.syntax.all.* import org.typelevel.paiges.Doc -import org.typelevel.paiges.instances._ -import playground.smithyql._ +import org.typelevel.paiges.instances.* +import playground.smithyql.* trait Formatter[-Alg[_[_]]] { diff --git a/modules/formatter/src/test/scala/playground/smithyql/format/FormattingTests.scala b/modules/formatter/src/test/scala/playground/smithyql/format/FormattingTests.scala index 7c819b78..dc3156e2 100644 --- a/modules/formatter/src/test/scala/playground/smithyql/format/FormattingTests.scala +++ b/modules/formatter/src/test/scala/playground/smithyql/format/FormattingTests.scala @@ -1,17 +1,17 @@ package playground.smithyql.format -import cats.implicits._ -import playground.Assertions._ -import playground.smithyql._ +import cats.syntax.all.* +import playground.Assertions.* +import playground.smithyql.* import playground.smithyql.format.Formatter import playground.smithyql.parser.Examples import playground.smithyql.parser.ParserSuite import playground.smithyql.parser.SourceParser -import util.chaining._ -import weaver._ +import util.chaining.* +import weaver.* import weaver.scalacheck.Checkers -import Diffs._ +import Diffs.* object FormattingTests extends SimpleIOSuite with Checkers { diff --git a/modules/language-support/src/main/scala/playground/language/CodeLensProvider.scala b/modules/language-support/src/main/scala/playground/language/CodeLensProvider.scala index a9b28c89..d7d62c0b 100644 --- a/modules/language-support/src/main/scala/playground/language/CodeLensProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/CodeLensProvider.scala @@ -1,13 +1,13 @@ package playground.language -import cats.implicits._ +import cats.syntax.all.* import playground.FileCompiler import playground.FileRunner import playground.smithyql.SourceFile import playground.smithyql.SourceRange import playground.smithyql.WithSource import playground.smithyql.parser.SourceParser -import playground.types._ +import playground.types.* trait CodeLensProvider[F[_]] { diff --git a/modules/language-support/src/main/scala/playground/language/CommandProvider.scala b/modules/language-support/src/main/scala/playground/language/CommandProvider.scala index 06411661..2a2fc9ba 100644 --- a/modules/language-support/src/main/scala/playground/language/CommandProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/CommandProvider.scala @@ -3,7 +3,7 @@ package playground.language import cats.Id import cats.MonadThrow import cats.data.NonEmptyList -import cats.implicits._ +import cats.syntax.all.* import playground.CompilationFailed import playground.CompiledInput import playground.FileCompiler diff --git a/modules/language-support/src/main/scala/playground/language/CommandResultReporter.scala b/modules/language-support/src/main/scala/playground/language/CommandResultReporter.scala index 16afb7c4..88097436 100644 --- a/modules/language-support/src/main/scala/playground/language/CommandResultReporter.scala +++ b/modules/language-support/src/main/scala/playground/language/CommandResultReporter.scala @@ -4,7 +4,7 @@ import cats.Id import cats.Monad import cats.data.NonEmptyList import cats.effect.kernel.Ref -import cats.implicits._ +import cats.syntax.all.* import playground.CompiledInput import playground.smithyql.InputNode import playground.smithyql.Query diff --git a/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala b/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala index f3fbb5cb..3fe42035 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala @@ -1,7 +1,8 @@ package playground.language import cats.Id -import cats.implicits._ +import cats.kernel.Order.catsKernelOrderingForOrder +import cats.syntax.all.* import playground.MultiServiceResolver import playground.ServiceIndex import playground.smithyql.NodeContext @@ -15,7 +16,7 @@ import playground.smithyql.RangeIndex import playground.smithyql.SourceFile import playground.smithyql.WithSource import playground.smithyql.parser.SourceParser -import playground.smithyql.syntax._ +import playground.smithyql.syntax.* import smithy.api.Examples import smithy4s.Hints import smithy4s.dynamic.DynamicSchemaIndex diff --git a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala index 643e4f6f..3f159024 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -1,7 +1,6 @@ package playground.language import cats.Id -import cats.implicits._ import cats.kernel.Eq import playground.NodeEncoder import playground.ServiceNameExtractor @@ -41,7 +40,7 @@ import smithy4s.schema.EnumValue import smithy4s.schema.Field import smithy4s.schema.Primitive import smithy4s.schema.Schema -import smithy4s.schema.Schema._ +import smithy4s.schema.Schema.* import smithy4s.schema.SchemaVisitor import java.util.UUID @@ -210,7 +209,7 @@ object CompletionItem { ): Boolean = schema.hints.has(smithy.api.Required) private val describePrimitive: Primitive[_] => String = { - import smithy4s.schema.Primitive._ + import smithy4s.schema.Primitive.* { case PString => "string" @@ -234,7 +233,7 @@ object CompletionItem { tag: CollectionTag[C], hints: Hints, ): String = { - import smithy4s.schema.CollectionTag._ + import smithy4s.schema.CollectionTag.* val base = tag match { @@ -626,7 +625,7 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { inBody = examples ++ fields // todo: filter out present fields - .sortBy(field => (field.isStrictlyRequired, field.label)) + .sortBy(field => (field.isRequired && !field.hasDefaultValue, field.label)) .map(CompletionItem.fromField) .toList, inValue = diff --git a/modules/language-support/src/main/scala/playground/language/DiagnosticProvider.scala b/modules/language-support/src/main/scala/playground/language/DiagnosticProvider.scala index 3793adaf..85ee13ae 100644 --- a/modules/language-support/src/main/scala/playground/language/DiagnosticProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/DiagnosticProvider.scala @@ -3,7 +3,7 @@ package playground.language import cats.data.Ior import cats.data.IorNel import cats.data.NonEmptyList -import cats.implicits._ +import cats.syntax.all.* import playground.CompilationError import playground.CompilationErrorDetails import playground.CompilationFailed @@ -17,7 +17,7 @@ import playground.smithyql.SourceRange import playground.smithyql.WithSource import playground.smithyql.parser.ParsingFailure import playground.smithyql.parser.SourceParser -import playground.types._ +import playground.types.* trait DiagnosticProvider[F[_]] { diff --git a/modules/language-support/src/main/scala/playground/language/DocumentSymbolProvider.scala b/modules/language-support/src/main/scala/playground/language/DocumentSymbolProvider.scala index f25d4e48..57d8c7b3 100644 --- a/modules/language-support/src/main/scala/playground/language/DocumentSymbolProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/DocumentSymbolProvider.scala @@ -1,6 +1,6 @@ package playground.language -import cats.implicits._ +import cats.syntax.all.* import playground.smithyql.InputNode import playground.smithyql.Listed import playground.smithyql.Prelude diff --git a/modules/language-support/src/main/scala/playground/language/FormattingProvider.scala b/modules/language-support/src/main/scala/playground/language/FormattingProvider.scala index 893267cd..154a20c3 100644 --- a/modules/language-support/src/main/scala/playground/language/FormattingProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/FormattingProvider.scala @@ -1,7 +1,7 @@ package playground.language import cats.FlatMap -import cats.implicits._ +import cats.syntax.all.* import playground.smithyql.SourceFile import playground.smithyql.SourceRange import playground.smithyql.format.Formatter diff --git a/modules/language-support/src/main/scala/playground/language/TextDocumentProvider.scala b/modules/language-support/src/main/scala/playground/language/TextDocumentProvider.scala index 4d103721..655061b1 100644 --- a/modules/language-support/src/main/scala/playground/language/TextDocumentProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/TextDocumentProvider.scala @@ -1,7 +1,7 @@ package playground.language import cats.Applicative -import cats.implicits._ +import cats.syntax.all.* trait TextDocumentProvider[F[_]] { diff --git a/modules/language-support/src/main/scala/playground/language/Uri.scala b/modules/language-support/src/main/scala/playground/language/Uri.scala index c7895bc8..1abbbe30 100644 --- a/modules/language-support/src/main/scala/playground/language/Uri.scala +++ b/modules/language-support/src/main/scala/playground/language/Uri.scala @@ -5,7 +5,10 @@ import fs2.io.file.Path import java.net.URI import java.nio.file.Paths -final case class Uri private ( +// not making constructor private because +// "access modifiers from `copy` method are copied from the case class constructor" +// cannot nicely be silenced in scala 2 +final case class Uri /* private */ ( value: String ) extends AnyVal { def toPath: Path = Path.fromNioPath(Paths.get(new URI(value))) diff --git a/modules/language-support/src/test/scala/playground/language/CodeLensProviderTests.scala b/modules/language-support/src/test/scala/playground/language/CodeLensProviderTests.scala index e60c3970..9d62b88b 100644 --- a/modules/language-support/src/test/scala/playground/language/CodeLensProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CodeLensProviderTests.scala @@ -1,8 +1,8 @@ package playground.language import cats.effect.IO -import cats.implicits._ -import playground.Assertions._ +import cats.syntax.all.* +import playground.Assertions.* import playground.CompilationError import playground.CompilationFailed import playground.FileCompiler @@ -11,11 +11,11 @@ import playground.OperationCompiler import playground.OperationRunner import playground.PreludeCompiler import playground.ServiceIndex -import playground.ServiceUtils._ -import playground.language.Diffs._ -import playground.smithyql.StringRangeUtils._ +import playground.ServiceUtils.* +import playground.language.Diffs.* +import playground.smithyql.StringRangeUtils.* import playground.std.RandomGen -import weaver._ +import weaver.* object CodeLensProviderTests extends FunSuite { diff --git a/modules/language-support/src/test/scala/playground/language/CompletionItemTests.scala b/modules/language-support/src/test/scala/playground/language/CompletionItemTests.scala index bd40a413..9a3c443f 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionItemTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionItemTests.scala @@ -2,16 +2,16 @@ package playground.language import demo.smithy.Hero import demo.smithy.Subscription -import playground.Assertions._ +import playground.Assertions.* import playground.smithyql.Position import playground.smithyql.QualifiedIdentifier -import playground.smithyql.syntax._ +import playground.smithyql.syntax.* import playground.std.ClockGen import playground.std.ClockOperation import smithy4s.schema.Schema -import weaver._ +import weaver.* -import Diffs._ +import Diffs.* object CompletionItemTests extends FunSuite { test("CompletionItem.fromField: required field") { diff --git a/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala b/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala index 53c4fdc7..2fc87e5e 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala @@ -2,18 +2,18 @@ package playground.language import demo.smithy.DemoServiceGen import demo.smithy.DeprecatedServiceGen -import playground.Assertions._ -import playground.ServiceUtils._ -import playground.language.Diffs._ +import playground.Assertions.* +import playground.ServiceUtils.* +import playground.language.Diffs.* import playground.smithyql.Position import playground.smithyql.QualifiedIdentifier -import playground.smithyql.StringRangeUtils._ -import playground.smithyql.syntax._ +import playground.smithyql.StringRangeUtils.* +import playground.smithyql.syntax.* import playground.std.ClockGen import playground.std.ClockOperation import playground.std.RandomGen import playground.std.RandomOperation -import weaver._ +import weaver.* object CompletionProviderTests extends SimpleIOSuite { diff --git a/modules/language-support/src/test/scala/playground/language/CompletionTests.scala b/modules/language-support/src/test/scala/playground/language/CompletionTests.scala index 2a4b5d84..aca98573 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionTests.scala @@ -1,6 +1,6 @@ package playground.language -import cats.implicits._ +import cats.syntax.all.* import demo.smithy.Good import demo.smithy.HasDeprecations import demo.smithy.HasNewtypes @@ -15,15 +15,15 @@ import demo.smithy.PowerMap import demo.smithy.PrivacyTier import demo.smithy.SampleSparseList import demo.smithy.SampleSparseMap -import playground.Assertions._ -import playground.language.Diffs._ +import playground.Assertions.* +import playground.language.Diffs.* import playground.smithyql.NodeContext -import playground.smithyql.NodeContext.PathEntry._ +import playground.smithyql.NodeContext.PathEntry.* import smithy.api.TimestampFormat import smithy4s.Hints import smithy4s.Timestamp import smithy4s.schema.Schema -import weaver._ +import weaver.* import java.util.UUID @@ -175,7 +175,7 @@ object CompletionTests extends FunSuite { val completions = getCompletions(Power.schema, NodeContext.EmptyPath) val inserts = completions.map(_.insertText) - val expectedInserts = List("FIRE", "LIGHTNING", "WIND", "ICE") + val expectedInserts = List("ICE", "FIRE", "LIGHTNING", "WIND") .map(s => s"\"$s\"") .map(InsertText.JustString(_)) @@ -187,7 +187,7 @@ object CompletionTests extends FunSuite { val completions = getCompletions(Power.schema, NodeContext.EmptyPath.inQuotes) val inserts = completions.map(_.insertText) - val expectedInserts = List("FIRE", "LIGHTNING", "WIND", "ICE") + val expectedInserts = List("ICE", "FIRE", "LIGHTNING", "WIND") .map(InsertText.JustString(_)) assert(completions.map(_.kind).forall(_ == CompletionItemKind.EnumMember)) && @@ -207,7 +207,7 @@ object CompletionTests extends FunSuite { val inserts = completions.map(_.insertText) - val expectedInserts = List("FIRE", "LIGHTNING", "WIND", "ICE") + val expectedInserts = List("ICE", "FIRE", "LIGHTNING", "WIND") .map(_ + " = ") .map(InsertText.JustString(_)) diff --git a/modules/language-support/src/test/scala/playground/language/DiagnosticProviderTests.scala b/modules/language-support/src/test/scala/playground/language/DiagnosticProviderTests.scala index d3e791f2..f8d6236c 100644 --- a/modules/language-support/src/test/scala/playground/language/DiagnosticProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/DiagnosticProviderTests.scala @@ -14,29 +14,29 @@ import demo.smithy.DemoServiceGen import noop.NoRunnerServiceGen import org.http4s.HttpApp import org.http4s.client.Client -import playground.Assertions._ +import playground.Assertions.* import playground.CompilationError import playground.CompilationErrorDetails import playground.CompilationFailed import playground.DiagnosticSeverity -import playground.Diffs._ +import playground.Diffs.* import playground.FileCompiler import playground.FileRunner import playground.OperationCompiler import playground.OperationRunner import playground.PreludeCompiler import playground.ServiceIndex -import playground.ServiceUtils._ +import playground.ServiceUtils.* import playground.smithyql.QualifiedIdentifier import playground.smithyql.SourceRange -import playground.smithyql.StringRangeUtils._ +import playground.smithyql.StringRangeUtils.* import playground.std.ClockGen import playground.std.RandomGen import playground.std.Stdlib import playground.std.StdlibRuntime import smithy4s.HasId import smithy4s.aws.AwsEnvironment -import weaver._ +import weaver.* object DiagnosticProviderTests extends SimpleIOSuite { diff --git a/modules/language-support/src/test/scala/playground/language/Diffs.scala b/modules/language-support/src/test/scala/playground/language/Diffs.scala index a06d1cec..bf5421fb 100644 --- a/modules/language-support/src/test/scala/playground/language/Diffs.scala +++ b/modules/language-support/src/test/scala/playground/language/Diffs.scala @@ -3,7 +3,7 @@ package playground.language import com.softwaremill.diffx.Diff object Diffs { - import com.softwaremill.diffx.generic.auto._ + import com.softwaremill.diffx.generic.auto.* implicit val diffCompletionItem: Diff[CompletionItem] = Diff.derivedDiff implicit lazy val diffDocumentSymbol: Diff[DocumentSymbol] = Diff.derivedDiff implicit lazy val diffCodeLens: Diff[CodeLens] = Diff.derivedDiff diff --git a/modules/language-support/src/test/scala/playground/language/DocumentSymbolProviderTests.scala b/modules/language-support/src/test/scala/playground/language/DocumentSymbolProviderTests.scala index 08868c1b..213f7209 100644 --- a/modules/language-support/src/test/scala/playground/language/DocumentSymbolProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/DocumentSymbolProviderTests.scala @@ -1,10 +1,10 @@ package playground.language -import playground.Assertions._ -import playground.language.Diffs._ +import playground.Assertions.* +import playground.language.Diffs.* import playground.smithyql.Position import playground.smithyql.SourceRange -import weaver._ +import weaver.* object DocumentSymbolProviderTests extends FunSuite { diff --git a/modules/language-support/src/test/scala/playground/language/FormattingProviderTests.scala b/modules/language-support/src/test/scala/playground/language/FormattingProviderTests.scala index fcbd4b46..5e2c0d47 100644 --- a/modules/language-support/src/test/scala/playground/language/FormattingProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/FormattingProviderTests.scala @@ -1,11 +1,10 @@ package playground.language import cats.Id -import cats.implicits._ import fs2.io.file.Path import playground.smithyql.Position import playground.smithyql.SourceRange -import weaver._ +import weaver.* object FormattingProviderTests extends FunSuite { private val anyUri = Uri.fromPath(Path("file.smithyql")) diff --git a/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala b/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala index e58f8f65..b69bf8ee 100644 --- a/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala +++ b/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala @@ -1,7 +1,7 @@ package playground.lsp import cats.effect.kernel.Sync -import cats.implicits._ +import cats.syntax.all.* import fs2.io.file.Files import fs2.io.file.Path import playground.PlaygroundConfig diff --git a/modules/lsp/src/main/scala/playground/lsp/ConfigurationValue.scala b/modules/lsp/src/main/scala/playground/lsp/ConfigurationValue.scala index 810455b1..880cd73b 100644 --- a/modules/lsp/src/main/scala/playground/lsp/ConfigurationValue.scala +++ b/modules/lsp/src/main/scala/playground/lsp/ConfigurationValue.scala @@ -1,6 +1,6 @@ package playground.lsp -import cats.implicits._ +import cats.syntax.all.* import io.circe.Codec import io.circe.Decoder import io.circe.Encoder diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala index 06a86299..8d77a1bf 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala @@ -2,7 +2,7 @@ package playground.lsp import cats.FlatMap import cats.effect.kernel.Async -import cats.implicits._ +import cats.syntax.all.* import com.google.gson.JsonElement import org.eclipse.lsp4j.ConfigurationItem import org.eclipse.lsp4j.ConfigurationParams @@ -11,8 +11,8 @@ import org.eclipse.lsp4j.MessageType import playground.language.Feedback import java.util.concurrent.CompletableFuture -import scala.jdk.CollectionConverters._ -import scala.util.chaining._ +import scala.jdk.CollectionConverters.* +import scala.util.chaining.* trait LanguageClient[F[_]] extends Feedback[F] { diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala index b2e2881f..98931e6f 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala @@ -3,16 +3,15 @@ package playground.lsp import cats.Applicative import cats.FlatMap import cats.MonadThrow -import cats.effect.implicits._ import cats.effect.kernel.Async -import cats.implicits._ import cats.parse.LocationMap +import cats.syntax.all.* import cats.~> import com.google.gson.JsonElement import com.google.gson.JsonPrimitive +import org.eclipse.lsp4j.* import org.eclipse.lsp4j.ServerCapabilities import org.eclipse.lsp4j.TextDocumentSyncKind -import org.eclipse.lsp4j._ import playground.CompilationError import playground.CompilationFailed import playground.FileCompiler @@ -32,13 +31,13 @@ import playground.language.FormattingProvider import playground.language.TextDocumentProvider import playground.language.Uri import playground.lsp.buildinfo.BuildInfo -import playground.types._ +import playground.types.* import smithy4s.dynamic.DynamicSchemaIndex -import scala.jdk.CollectionConverters._ -import scala.util.chaining._ +import scala.jdk.CollectionConverters.* +import scala.util.chaining.* -import ToUriOps._ +import ToUriOps.* trait LanguageServer[F[_]] { diff --git a/modules/lsp/src/main/scala/playground/lsp/Main.scala b/modules/lsp/src/main/scala/playground/lsp/Main.scala index d7c98024..78df39f5 100644 --- a/modules/lsp/src/main/scala/playground/lsp/Main.scala +++ b/modules/lsp/src/main/scala/playground/lsp/Main.scala @@ -5,7 +5,7 @@ import cats.effect.IOApp import cats.effect.kernel.Deferred import cats.effect.kernel.Resource import cats.effect.std.Dispatcher -import cats.implicits._ +import cats.syntax.all.* import org.eclipse.lsp4j.jsonrpc.Launcher import org.eclipse.lsp4j.launch.LSPLauncher diff --git a/modules/lsp/src/main/scala/playground/lsp/MainServer.scala b/modules/lsp/src/main/scala/playground/lsp/MainServer.scala index a122d857..dc9bac1d 100644 --- a/modules/lsp/src/main/scala/playground/lsp/MainServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/MainServer.scala @@ -1,6 +1,6 @@ package playground.lsp -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async import cats.effect.kernel.Resource import cats.effect.std diff --git a/modules/lsp/src/main/scala/playground/lsp/ModelLoader.scala b/modules/lsp/src/main/scala/playground/lsp/ModelLoader.scala index e8946bdc..6793316e 100644 --- a/modules/lsp/src/main/scala/playground/lsp/ModelLoader.scala +++ b/modules/lsp/src/main/scala/playground/lsp/ModelLoader.scala @@ -1,6 +1,6 @@ package playground.lsp -import coursier._ +import coursier.* import coursier.cache.FileCache import coursier.parse.DependencyParser import coursier.parse.RepositoryParser @@ -17,10 +17,10 @@ import java.net.URL import java.net.URLClassLoader import java.nio.file.FileSystems import java.nio.file.Files -import scala.concurrent.duration._ -import scala.jdk.CollectionConverters._ +import scala.concurrent.duration.* +import scala.jdk.CollectionConverters.* import scala.util.Using -import scala.util.chaining._ +import scala.util.chaining.* // NOTE: methods in this object are mostly side effecting and blocking. object ModelLoader { diff --git a/modules/lsp/src/main/scala/playground/lsp/PlaygroundLanguageServerAdapter.scala b/modules/lsp/src/main/scala/playground/lsp/PlaygroundLanguageServerAdapter.scala index 9c7f4b3c..2c2c68f9 100644 --- a/modules/lsp/src/main/scala/playground/lsp/PlaygroundLanguageServerAdapter.scala +++ b/modules/lsp/src/main/scala/playground/lsp/PlaygroundLanguageServerAdapter.scala @@ -2,8 +2,8 @@ package playground.lsp import cats.Functor import cats.effect.std.Dispatcher -import cats.implicits._ -import org.eclipse.lsp4j._ +import cats.syntax.all.* +import org.eclipse.lsp4j.* import org.eclipse.lsp4j.adapters.DocumentSymbolResponseAdapter import org.eclipse.lsp4j.jsonrpc.json.ResponseJsonAdapter import org.eclipse.lsp4j.jsonrpc.messages @@ -11,7 +11,7 @@ import org.eclipse.lsp4j.jsonrpc.services.JsonNotification import org.eclipse.lsp4j.jsonrpc.services.JsonRequest import java.util.concurrent.CompletableFuture -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* final class PlaygroundLanguageServerAdapter[F[_]: Functor]( impl: LanguageServer[F] diff --git a/modules/lsp/src/main/scala/playground/lsp/PluginResolver.scala b/modules/lsp/src/main/scala/playground/lsp/PluginResolver.scala index ea252816..5a171fb3 100644 --- a/modules/lsp/src/main/scala/playground/lsp/PluginResolver.scala +++ b/modules/lsp/src/main/scala/playground/lsp/PluginResolver.scala @@ -1,7 +1,7 @@ package playground.lsp import cats.effect.kernel.Sync -import cats.implicits._ +import cats.syntax.all.* import playground.PlaygroundConfig import playground.plugins.PlaygroundPlugin diff --git a/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala b/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala index 914a15ae..b7a4f935 100644 --- a/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala +++ b/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala @@ -1,10 +1,10 @@ package playground.lsp -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async import cats.effect.kernel.Resource import cats.effect.std -import cats.implicits._ +import cats.syntax.all.* import fs2.compression.Compression import fs2.io.file.Files import fs2.io.net.Network diff --git a/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala b/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala index b51a62da..97fabd41 100644 --- a/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala +++ b/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala @@ -2,7 +2,7 @@ package playground.lsp import cats.MonadThrow import cats.effect.kernel.Ref -import cats.implicits._ +import cats.syntax.all.* import playground.PlaygroundConfig import playground.language.Uri diff --git a/modules/lsp/src/main/scala/playground/lsp/TextDocumentManager.scala b/modules/lsp/src/main/scala/playground/lsp/TextDocumentManager.scala index 10e4f0b6..66b14d14 100644 --- a/modules/lsp/src/main/scala/playground/lsp/TextDocumentManager.scala +++ b/modules/lsp/src/main/scala/playground/lsp/TextDocumentManager.scala @@ -3,7 +3,7 @@ package playground import cats.data.OptionT import cats.effect.Concurrent import cats.effect.kernel.Ref -import cats.implicits._ +import cats.syntax.all.* import fs2.io.file.Files import playground.language.TextDocumentProvider import playground.language.Uri diff --git a/modules/lsp/src/main/scala/playground/lsp/converters.scala b/modules/lsp/src/main/scala/playground/lsp/converters.scala index fad723f6..93bde8d6 100644 --- a/modules/lsp/src/main/scala/playground/lsp/converters.scala +++ b/modules/lsp/src/main/scala/playground/lsp/converters.scala @@ -1,7 +1,7 @@ package playground.lsp -import cats.implicits._ import cats.parse.LocationMap +import cats.syntax.all.* import com.google.gson.JsonElement import io.circe.Json import io.circe.JsonNumber @@ -19,8 +19,8 @@ import playground.language.TextEdit import playground.smithyql.Position import playground.smithyql.SourceRange -import scala.jdk.CollectionConverters._ -import scala.util.chaining._ +import scala.jdk.CollectionConverters.* +import scala.util.chaining.* object converters { diff --git a/modules/lsp/src/main/scala/playground/lsp/util/KleisliOps.scala b/modules/lsp/src/main/scala/playground/lsp/util/KleisliOps.scala index fef2b7a0..a9e85393 100644 --- a/modules/lsp/src/main/scala/playground/lsp/util/KleisliOps.scala +++ b/modules/lsp/src/main/scala/playground/lsp/util/KleisliOps.scala @@ -2,7 +2,7 @@ package playground.lsp.util import cats.FlatMap import cats.data.Kleisli -import cats.implicits._ +import cats.syntax.all.* import cats.~> object KleisliOps { diff --git a/modules/lsp/src/test/resources/test-workspaces/default/smithy-build.json b/modules/lsp/src/test/resources/test-workspaces/default/smithy-build.json index a2102f0d..72dda0f9 100644 --- a/modules/lsp/src/test/resources/test-workspaces/default/smithy-build.json +++ b/modules/lsp/src/test/resources/test-workspaces/default/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.2.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6" + "com.disneystreaming.alloy:alloy-core:0.3.6", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15" ] } diff --git a/modules/lsp/src/test/scala/playground/lsp/EmptyConfigTests.scala b/modules/lsp/src/test/scala/playground/lsp/EmptyConfigTests.scala index eb04a45f..e791ad6b 100644 --- a/modules/lsp/src/test/scala/playground/lsp/EmptyConfigTests.scala +++ b/modules/lsp/src/test/scala/playground/lsp/EmptyConfigTests.scala @@ -6,7 +6,7 @@ import org.eclipse.lsp4j.DidChangeWatchedFilesParams import org.eclipse.lsp4j.MessageType import playground.lsp.harness.LanguageServerIntegrationTests import playground.lsp.harness.TestClient -import weaver._ +import weaver.* object EmptyConfigTests extends IOSuite with LanguageServerIntegrationTests { diff --git a/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala b/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala index b0f4a819..bb0e2e60 100644 --- a/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala +++ b/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala @@ -2,7 +2,7 @@ package playground.lsp import cats.effect.IO import cats.effect.Resource -import com.comcast.ip4s._ +import com.comcast.ip4s.* import org.eclipse.lsp4j.CodeLensParams import org.eclipse.lsp4j.Command import org.eclipse.lsp4j.CompletionParams @@ -14,16 +14,16 @@ import org.eclipse.lsp4j.Position import org.eclipse.lsp4j.TextDocumentIdentifier import org.http4s.HttpRoutes import org.http4s.ember.server.EmberServerBuilder -import org.http4s.implicits._ +import org.http4s.implicits.* import org.http4s.server.Server import playground.language.Uri import playground.lsp.buildinfo.BuildInfo import playground.lsp.harness.LanguageServerIntegrationTests import playground.lsp.harness.TestClient -import weaver._ +import weaver.* -import scala.concurrent.duration._ -import scala.jdk.CollectionConverters._ +import scala.concurrent.duration.* +import scala.jdk.CollectionConverters.* object LanguageServerIntegrationTestSharedServer extends IOSuite @@ -250,7 +250,7 @@ object LanguageServerIntegrationTestSharedServer .withPort(port"0") .withShutdownTimeout(Duration.Zero) .withHttpApp { - import org.http4s.dsl.io._ + import org.http4s.dsl.io.* HttpRoutes .of[IO] { case GET -> Root / "weather" / _ => Ok( diff --git a/modules/lsp/src/test/scala/playground/lsp/LanguageServerReloadIntegrationTests.scala b/modules/lsp/src/test/scala/playground/lsp/LanguageServerReloadIntegrationTests.scala index 5d5c59a0..6fb3d8d5 100644 --- a/modules/lsp/src/test/scala/playground/lsp/LanguageServerReloadIntegrationTests.scala +++ b/modules/lsp/src/test/scala/playground/lsp/LanguageServerReloadIntegrationTests.scala @@ -1,7 +1,7 @@ package playground.lsp import cats.effect.IO -import cats.implicits._ +import cats.syntax.all.* import fs2.io.file.Files import fs2.io.file.Path import org.eclipse.lsp4j.CodeLensParams @@ -13,9 +13,9 @@ import playground.PlaygroundConfig import playground.language.Uri import playground.lsp.harness.LanguageServerIntegrationTests import playground.lsp.harness.TestClient.MessageLog -import weaver._ +import weaver.* -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* object LanguageServerReloadIntegrationTests extends SimpleIOSuite diff --git a/modules/lsp/src/test/scala/playground/lsp/ModelLoaderTests.scala b/modules/lsp/src/test/scala/playground/lsp/ModelLoaderTests.scala index 1c0e9592..91c841c0 100644 --- a/modules/lsp/src/test/scala/playground/lsp/ModelLoaderTests.scala +++ b/modules/lsp/src/test/scala/playground/lsp/ModelLoaderTests.scala @@ -2,11 +2,11 @@ package playground.lsp import playground.PlaygroundConfig import software.amazon.smithy.model.shapes.ShapeId -import weaver._ +import weaver.* import java.util.stream.Collectors -import scala.jdk.CollectionConverters._ -import scala.jdk.OptionConverters._ +import scala.jdk.CollectionConverters.* +import scala.jdk.OptionConverters.* object ModelLoaderTests extends FunSuite { diff --git a/modules/lsp/src/test/scala/playground/lsp/PluginResolverTests.scala b/modules/lsp/src/test/scala/playground/lsp/PluginResolverTests.scala index 50a704f6..bc05b045 100644 --- a/modules/lsp/src/test/scala/playground/lsp/PluginResolverTests.scala +++ b/modules/lsp/src/test/scala/playground/lsp/PluginResolverTests.scala @@ -2,7 +2,7 @@ package playground.lsp import cats.effect.IO import playground.PlaygroundConfig -import weaver._ +import weaver.* object PluginResolverTests extends SimpleIOSuite { test("Empty plugin resolver finds no plugins") { diff --git a/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala b/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala index fd6b0607..a7922192 100644 --- a/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala +++ b/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala @@ -8,8 +8,8 @@ import playground.language.Uri import playground.lsp.LanguageServer import playground.lsp.MainServer -import scala.jdk.CollectionConverters._ -import scala.util.chaining._ +import scala.jdk.CollectionConverters.* +import scala.util.chaining.* trait LanguageServerIntegrationTests { @@ -24,7 +24,7 @@ trait LanguageServerIntegrationTests { ): InitializeParams = new InitializeParams().tap( _.setWorkspaceFolders( List( - new WorkspaceFolder(workspaceDir.value) + new WorkspaceFolder(workspaceDir.value, "test-workspace") ).asJava ) ) diff --git a/modules/lsp/src/test/scala/playground/lsp/harness/TestClient.scala b/modules/lsp/src/test/scala/playground/lsp/harness/TestClient.scala index 12a26d6b..d2831105 100644 --- a/modules/lsp/src/test/scala/playground/lsp/harness/TestClient.scala +++ b/modules/lsp/src/test/scala/playground/lsp/harness/TestClient.scala @@ -3,7 +3,7 @@ package playground.lsp.harness import cats.data.Chain import cats.effect.IO import cats.effect.IOLocal -import cats.implicits._ +import cats.syntax.all.* import cats.~> import io.circe.Json import org.eclipse.lsp4j.MessageType diff --git a/modules/parser/src/main/scala/playground/smithyql/parser/Parsers.scala b/modules/parser/src/main/scala/playground/smithyql/parser/Parsers.scala index fd3643c7..e6305336 100644 --- a/modules/parser/src/main/scala/playground/smithyql/parser/Parsers.scala +++ b/modules/parser/src/main/scala/playground/smithyql/parser/Parsers.scala @@ -1,19 +1,19 @@ package playground.smithyql.parser import cats.Defer -import cats.implicits._ import cats.parse.Numbers import cats.parse.Parser import cats.parse.Parser0 import cats.parse.Rfc5234 -import playground.smithyql._ +import cats.syntax.all.* +import playground.smithyql.* object Parsers { type T[+A] = WithSource[A] object tokens { - import Parser._ + import Parser.* val newline: Parser[Unit] = Rfc5234.lf val comment: Parser[Comment] = @@ -155,7 +155,7 @@ object Parsers { object parsers { - import Parser._ + import Parser.* val rawIdent: Parser[String] = tokens.identifier val ident: Parser[T[String]] = tokens.withComments(tokens.identifier) diff --git a/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala b/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala index 7e7d99c2..4ef6a887 100644 --- a/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala +++ b/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala @@ -1,6 +1,5 @@ package playground.smithyql.parser -import cats.implicits._ import cats.kernel.Eq import cats.parse.Parser import cats.parse.Parser.Expectation.EndOfString @@ -8,7 +7,8 @@ import cats.parse.Parser.Expectation.InRange import cats.parse.Parser.Expectation.OneOfStr import cats.parse.Parser.Expectation.WithContext import cats.parse.Parser0 -import playground.smithyql._ +import cats.syntax.all.* +import playground.smithyql.* trait SourceParser[Alg[_[_]]] { diff --git a/modules/parser/src/main/scala/playground/smithyql/parser/v2/scanner.scala b/modules/parser/src/main/scala/playground/smithyql/parser/v2/scanner.scala index 19946228..f0b4fb82 100644 --- a/modules/parser/src/main/scala/playground/smithyql/parser/v2/scanner.scala +++ b/modules/parser/src/main/scala/playground/smithyql/parser/v2/scanner.scala @@ -2,7 +2,6 @@ package playground.smithyql.parser.v2.scanner import cats.kernel.Eq import cats.parse.Numbers -import cats.syntax.all.* import scala.annotation.nowarn diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/Codecs.scala b/modules/parser/src/test/scala/playground/smithyql/parser/Codecs.scala index 06cdffb8..412c1976 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/Codecs.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/Codecs.scala @@ -11,8 +11,8 @@ import playground.smithyql.WithSource object Codecs { - import io.circe.generic.auto._ - import io.circe.generic.semiauto._ + import io.circe.generic.auto.* + import io.circe.generic.semiauto.* implicit val useClauseWithSourceCodec: Codec[UseClause[WithSource]] = deriveCodec diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/CommentParsingTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/CommentParsingTests.scala index 97ef3ec1..638fadcf 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/CommentParsingTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/CommentParsingTests.scala @@ -3,7 +3,7 @@ package playground.smithyql.parser import playground.smithyql.Comment import playground.smithyql.SourceFile import playground.smithyql.WithSource -import weaver._ +import weaver.* object CommentParsingTests extends SimpleIOSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/Diffs.scala b/modules/parser/src/test/scala/playground/smithyql/parser/Diffs.scala index 090a1e9a..15c7f4b9 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/Diffs.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/Diffs.scala @@ -3,7 +3,7 @@ package playground.smithyql.parser import com.softwaremill.diffx.Diff object Diffs { - import com.softwaremill.diffx.generic.auto._ + import com.softwaremill.diffx.generic.auto.* implicit val diffParsingFailure: Diff[ParsingFailure] = Diff.derivedDiff } diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/ParserSuite.scala b/modules/parser/src/test/scala/playground/smithyql/parser/ParserSuite.scala index 8e65bfc8..c9f1ef87 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/ParserSuite.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/ParserSuite.scala @@ -1,18 +1,18 @@ package playground.smithyql.parser import cats.effect.IO -import cats.implicits._ +import cats.syntax.all.* import com.softwaremill.diffx.Diff import fs2.io.file.Files import fs2.io.file.Path import io.circe.Codec import io.circe.Decoder -import io.circe.syntax._ -import playground.Assertions._ -import playground.smithyql._ +import io.circe.syntax.* +import playground.Assertions.* +import playground.smithyql.* import playground.smithyql.parser.v2.scanner.Scanner import playground.smithyql.parser.v2.scanner.TokenKind -import weaver._ +import weaver.* import java.nio.file import java.nio.file.NoSuchFileException diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/ListParserTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/ListParserTests.scala index bbb62af6..2c569430 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/ListParserTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/ListParserTests.scala @@ -1,8 +1,8 @@ package playground.smithyql.parser.generative -import playground.smithyql.Diffs._ -import playground.smithyql._ -import playground.smithyql.parser.Codecs._ +import playground.smithyql.* +import playground.smithyql.Diffs.* +import playground.smithyql.parser.Codecs.* import playground.smithyql.parser.ParserSuite object ListParserTests extends ParserSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/PreludeParserTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/PreludeParserTests.scala index c34b5e54..34ce313d 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/PreludeParserTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/PreludeParserTests.scala @@ -1,8 +1,8 @@ package playground.smithyql.parser.generative -import playground.smithyql.Diffs._ -import playground.smithyql._ -import playground.smithyql.parser.Codecs._ +import playground.smithyql.* +import playground.smithyql.Diffs.* +import playground.smithyql.parser.Codecs.* import playground.smithyql.parser.ParserSuite object PreludeParserTests extends ParserSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/QueryParserTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/QueryParserTests.scala index 9b82eae4..fe08713f 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/QueryParserTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/QueryParserTests.scala @@ -1,8 +1,8 @@ package playground.smithyql.parser.generative -import playground.smithyql.Diffs._ -import playground.smithyql._ -import playground.smithyql.parser.Codecs._ +import playground.smithyql.* +import playground.smithyql.Diffs.* +import playground.smithyql.parser.Codecs.* import playground.smithyql.parser.ParserSuite object QueryParserTests extends ParserSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/SourceFileParserTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/SourceFileParserTests.scala index 6bb5190e..5d6ad8a1 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/SourceFileParserTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/SourceFileParserTests.scala @@ -1,8 +1,8 @@ package playground.smithyql.parser.generative -import playground.smithyql.Diffs._ -import playground.smithyql._ -import playground.smithyql.parser.Codecs._ +import playground.smithyql.* +import playground.smithyql.Diffs.* +import playground.smithyql.parser.Codecs.* import playground.smithyql.parser.ParserSuite object SourceFileParserTests extends ParserSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/StructParserTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/StructParserTests.scala index a9ba9005..011c0cc4 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/StructParserTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/StructParserTests.scala @@ -1,8 +1,8 @@ package playground.smithyql.parser.generative -import playground.smithyql.Diffs._ -import playground.smithyql._ -import playground.smithyql.parser.Codecs._ +import playground.smithyql.* +import playground.smithyql.Diffs.* +import playground.smithyql.parser.Codecs.* import playground.smithyql.parser.ParserSuite object StructParserTests extends ParserSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/UseServiceParserTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/UseServiceParserTests.scala index ccb8aa67..052e3c93 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/UseServiceParserTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/UseServiceParserTests.scala @@ -1,8 +1,8 @@ package playground.smithyql.parser.generative -import playground.smithyql.Diffs._ -import playground.smithyql._ -import playground.smithyql.parser.Codecs._ +import playground.smithyql.* +import playground.smithyql.Diffs.* +import playground.smithyql.parser.Codecs.* import playground.smithyql.parser.ParserSuite object UseServiceParserTests extends ParserSuite { diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerExampleTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerExampleTests.scala index d6680264..0b1780d6 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerExampleTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerExampleTests.scala @@ -1,7 +1,7 @@ package playground.smithyql.parser.v2 -import playground.smithyql.parser.v2.scanner.TokenKind._ -import weaver._ +import playground.smithyql.parser.v2.scanner.TokenKind.* +import weaver.* object ScannerExampleTests extends SimpleIOSuite with ScannerSuite { scanTest( diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerSuite.scala b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerSuite.scala index 4c78d373..9ed715fe 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerSuite.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerSuite.scala @@ -1,15 +1,15 @@ package playground.smithyql.parser.v2 import cats.effect.IO -import cats.implicits._ +import cats.syntax.all.* import org.scalacheck.Arbitrary import org.scalacheck.Gen import playground.Assertions import playground.smithyql.parser.v2.scanner.Scanner import playground.smithyql.parser.v2.scanner.Token -import weaver._ +import weaver.* -import Diffs._ +import Diffs.* import Scanner.scan trait ScannerSuite { self: IOSuite => diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerTests.scala index 7b746be0..5bcbb054 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerTests.scala @@ -1,16 +1,16 @@ package playground.smithyql.parser.v2 import cats.Show -import cats.implicits._ import cats.parse.Numbers +import cats.syntax.all.* import org.scalacheck.Arbitrary import playground.Assertions import playground.smithyql.parser.v2.scanner.Scanner -import playground.smithyql.parser.v2.scanner.TokenKind._ -import weaver._ +import playground.smithyql.parser.v2.scanner.TokenKind.* +import weaver.* import weaver.scalacheck.Checkers -import Diffs._ +import Diffs.* import Scanner.scan object ScannerTests extends SimpleIOSuite with Checkers with ScannerSuite { diff --git a/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala b/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala index b192fd6d..b4da95c8 100644 --- a/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala +++ b/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala @@ -7,7 +7,7 @@ import smithy4s.UnsupportedProtocolError import smithy4s.http4s.SimpleProtocolBuilder import java.util.ServiceLoader -import scala.jdk.CollectionConverters._ +import scala.jdk.CollectionConverters.* trait PlaygroundPlugin { def simpleBuilders: List[SimpleHttpBuilder] diff --git a/modules/source/src/main/scala/playground/smithyql/WithSource.scala b/modules/source/src/main/scala/playground/smithyql/WithSource.scala index 75a92c41..6a455f58 100644 --- a/modules/source/src/main/scala/playground/smithyql/WithSource.scala +++ b/modules/source/src/main/scala/playground/smithyql/WithSource.scala @@ -5,9 +5,9 @@ import cats.Eval import cats.Id import cats.NonEmptyTraverse import cats.Show -import cats.implicits._ import cats.kernel.Eq import cats.kernel.Order +import cats.syntax.all.* import cats.~> import playground.smithyql.InputNode import playground.smithyql.Query diff --git a/modules/source/src/test/scala/playground/smithyql/Diffs.scala b/modules/source/src/test/scala/playground/smithyql/Diffs.scala index 15a39f50..d97d97c4 100644 --- a/modules/source/src/test/scala/playground/smithyql/Diffs.scala +++ b/modules/source/src/test/scala/playground/smithyql/Diffs.scala @@ -3,8 +3,8 @@ package playground.smithyql import com.softwaremill.diffx.Diff object Diffs { - import com.softwaremill.diffx.cats._ - import com.softwaremill.diffx.generic.auto._ + import com.softwaremill.diffx.cats.* + import com.softwaremill.diffx.generic.auto.* implicit val diffSourceRange: Diff[SourceRange] = Diff.derivedDiff diff --git a/project/plugins.sbt b/project/plugins.sbt index 43876a26..96b2c0a2 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,8 +3,13 @@ ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11") addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.3") +// remove when smithy4s catches up: https://github.com/disneystreaming/smithy4s/pull/1485 + release +libraryDependencies ++= Seq( + "software.amazon.smithy" % "smithy-model" % "1.47.0" +) + // try to keep in sync with smithy-build.json -addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.0") +addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.15") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.1") diff --git a/smithy-build.json b/smithy-build.json index aa1ca5f6..db696f47 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,8 +1,8 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.2.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.0", - "software.amazon.smithy:smithy-aws-traits:1.39.1" + "com.disneystreaming.alloy:alloy-core:0.3.6", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15", + "software.amazon.smithy:smithy-aws-traits:1.47.0" ] }