From 2ac9723af472cf13185de6f5b585f3e5b1c04e29 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 11 Aug 2023 18:06:17 +0000 Subject: [PATCH 001/114] Update alloy-core to 0.2.6 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 3418d8f6..b2f36837 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.2.6" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.34.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 fb4933d4..92755f08 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.3", + "com.disneystreaming.alloy:alloy-core:0.2.6", "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6" ] } diff --git a/smithy-build.json b/smithy-build.json index e471bc34..c94cae30 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.2.3", + "com.disneystreaming.alloy:alloy-core:0.2.6", "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6", "software.amazon.smithy:smithy-aws-traits:1.34.0" ] From 87cc2738830bc93030384c8247af6144d05b626c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 15 Aug 2023 17:11:05 +0000 Subject: [PATCH 002/114] Update cats-core to 2.10.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b2f36837..5b0f9bf0 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ ThisBuild / dynverSeparator := "-" val commonSettings = Seq( organization := "com.kubukoz.playground", libraryDependencies ++= Seq( - "org.typelevel" %% "cats-core" % "2.9.0", + "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, From 434ffb085a5d1af8c7cf76900df0ed4a62c39fe0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 27 Aug 2023 17:51:54 +0000 Subject: [PATCH 003/114] Update jsoniter-scala-macros to 2.23.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5b0f9bf0..3a016ba6 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.1", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.2", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From e48cbf3cf8d8aeb563dc2a47598794d1284526ef Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 27 Aug 2023 17:52:16 +0000 Subject: [PATCH 004/114] Update coursier to 2.1.6 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5b0f9bf0..6cf2c594 100644 --- a/build.sbt +++ b/build.sbt @@ -156,7 +156,7 @@ lazy val lsp = module("lsp") "io.circe" %% "circe-core" % "0.14.5", "org.http4s" %% "http4s-ember-client" % "0.23.23", "org.http4s" %% "http4s-ember-server" % "0.23.23" % Test, - "io.get-coursier" %% "coursier" % "2.1.5", + "io.get-coursier" %% "coursier" % "2.1.6", "org.typelevel" %% "cats-tagless-macros" % "0.15.0", ), buildInfoPackage := "playground.lsp.buildinfo", From ca4052496e64f3f6bf5a03a99828bbb7dcdf8840 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 29 Aug 2023 18:43:54 +0000 Subject: [PATCH 005/114] Update org.eclipse.lsp4j to 0.21.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2fb42346..b16c7f63 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ lazy val languageSupport = module("language-support") lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( - "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.0", + "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1", "io.circe" %% "circe-core" % "0.14.5", "org.http4s" %% "http4s-ember-client" % "0.23.23", "org.http4s" %% "http4s-ember-server" % "0.23.23" % Test, From 641c78e7993690f9b51d41a8d75f62405a43a6e6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 31 Aug 2023 19:18:22 +0000 Subject: [PATCH 006/114] Update fs2-io to 3.9.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index b16c7f63..2643ea0d 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "org.typelevel" %% "cats-parse" % "0.3.10", "io.circe" %% "circe-generic" % "0.14.5" % Test, "io.circe" %% "circe-parser" % "0.14.5" % Test, - "co.fs2" %% "fs2-io" % "3.8.0" % Test, + "co.fs2" %% "fs2-io" % "3.9.1" % Test, ) ) .dependsOn( From 93507c40cc0ab6caac6f433e6252d5037239fb34 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 31 Aug 2023 19:18:38 +0000 Subject: [PATCH 007/114] Update circe-core, circe-generic, ... to 0.14.6 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index b16c7f63..2b996df1 100644 --- a/build.sbt +++ b/build.sbt @@ -96,8 +96,8 @@ lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-parse" % "0.3.10", - "io.circe" %% "circe-generic" % "0.14.5" % Test, - "io.circe" %% "circe-parser" % "0.14.5" % Test, + "io.circe" %% "circe-generic" % "0.14.6" % Test, + "io.circe" %% "circe-parser" % "0.14.6" % Test, "co.fs2" %% "fs2-io" % "3.8.0" % Test, ) ) @@ -153,7 +153,7 @@ lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1", - "io.circe" %% "circe-core" % "0.14.5", + "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.6", From 46a204a10717c0e93ffc568a9087c400a62b7a7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:09:42 +0000 Subject: [PATCH 008/114] Bump cachix/install-nix-action from 22 to 23 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 22 to 23. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v22...v23) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 668103b8..3ed5d10a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v3.5.3 - - uses: cachix/install-nix-action@v22 + - uses: cachix/install-nix-action@v23 - uses: cachix/cachix-action@v12 with: From 109cce205b9127af0e7e19ed59b7c9d4995c7da7 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 6 Sep 2023 23:30:52 +0000 Subject: [PATCH 009/114] Update jsoniter-scala-macros to 2.23.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2643ea0d..18a5db05 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.1", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.3", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From f29d1f753f9e0a8abb8e8ec7f05bffef75fab6c5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 6 Sep 2023 23:30:57 +0000 Subject: [PATCH 010/114] Revert commit(s) 93507c4 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 2b996df1..b16c7f63 100644 --- a/build.sbt +++ b/build.sbt @@ -96,8 +96,8 @@ lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-parse" % "0.3.10", - "io.circe" %% "circe-generic" % "0.14.6" % Test, - "io.circe" %% "circe-parser" % "0.14.6" % Test, + "io.circe" %% "circe-generic" % "0.14.5" % Test, + "io.circe" %% "circe-parser" % "0.14.5" % Test, "co.fs2" %% "fs2-io" % "3.8.0" % Test, ) ) @@ -153,7 +153,7 @@ lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1", - "io.circe" %% "circe-core" % "0.14.6", + "io.circe" %% "circe-core" % "0.14.5", "org.http4s" %% "http4s-ember-client" % "0.23.23", "org.http4s" %% "http4s-ember-server" % "0.23.23" % Test, "io.get-coursier" %% "coursier" % "2.1.6", From 27073b7524001a4a9e486e2c010673b781cea21f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 6 Sep 2023 23:31:07 +0000 Subject: [PATCH 011/114] Update circe-core, circe-generic, ... to 0.14.6 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 2643ea0d..5d97dd81 100644 --- a/build.sbt +++ b/build.sbt @@ -96,8 +96,8 @@ lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-parse" % "0.3.10", - "io.circe" %% "circe-generic" % "0.14.5" % Test, - "io.circe" %% "circe-parser" % "0.14.5" % Test, + "io.circe" %% "circe-generic" % "0.14.6" % Test, + "io.circe" %% "circe-parser" % "0.14.6" % Test, "co.fs2" %% "fs2-io" % "3.9.1" % Test, ) ) @@ -153,7 +153,7 @@ lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.1", - "io.circe" %% "circe-core" % "0.14.5", + "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.6", From a377a50b7a82aa1abe7972e505f6d0913a76b8bf Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 10 Sep 2023 17:14:48 +0000 Subject: [PATCH 012/114] Update coursier to 2.1.7 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a829befb..dec4a2b4 100644 --- a/build.sbt +++ b/build.sbt @@ -156,7 +156,7 @@ lazy val lsp = module("lsp") "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.6", + "io.get-coursier" %% "coursier" % "2.1.7", "org.typelevel" %% "cats-tagless-macros" % "0.15.0", ), buildInfoPackage := "playground.lsp.buildinfo", From 51541bcaeac26d0f25aaad57dbc22753a17e2ce9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:27:08 +0000 Subject: [PATCH 013/114] Bump actions/cache from 3.3.1 to 3.3.2 Bumps [actions/cache](https://github.com/actions/cache) from 3.3.1 to 3.3.2. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3.3.1...v3.3.2) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 668103b8..b6791581 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 From c419524c68364040162fb24d6886449dad973c8a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 12 Sep 2023 19:52:07 +0000 Subject: [PATCH 014/114] Update fs2-io to 3.9.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index dec4a2b4..3329a574 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "org.typelevel" %% "cats-parse" % "0.3.10", "io.circe" %% "circe-generic" % "0.14.6" % Test, "io.circe" %% "circe-parser" % "0.14.6" % Test, - "co.fs2" %% "fs2-io" % "3.9.1" % Test, + "co.fs2" %% "fs2-io" % "3.9.2" % Test, ) ) .dependsOn( From 9e9e0fae2f878ef13c47716adb2b05dbc30bf57e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 12 Sep 2023 19:52:18 +0000 Subject: [PATCH 015/114] Update alloy-core to 0.2.7 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index dec4a2b4..a6135b95 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.6" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.2.7" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.34.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 92755f08..dbd4843b 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.6", + "com.disneystreaming.alloy:alloy-core:0.2.7", "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6" ] } diff --git a/smithy-build.json b/smithy-build.json index c94cae30..1bdb8712 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.2.6", + "com.disneystreaming.alloy:alloy-core:0.2.7", "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6", "software.amazon.smithy:smithy-aws-traits:1.34.0" ] From 70a8f9471c759641de64e4000a4b5a5d51d56fe7 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 24 Sep 2023 15:20:09 +0000 Subject: [PATCH 016/114] Update diffx-cats, diffx-core to 0.9.0 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 37aadb91..9d362cf7 100644 --- a/build.sbt +++ b/build.sbt @@ -48,8 +48,8 @@ val commonSettings = Seq( "com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test, "com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test, "com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test, - "com.softwaremill.diffx" %% "diffx-core" % "0.8.3" % Test, - "com.softwaremill.diffx" %% "diffx-cats" % "0.8.3" % Test, + "com.softwaremill.diffx" %% "diffx-core" % "0.9.0" % Test, + "com.softwaremill.diffx" %% "diffx-cats" % "0.9.0" % Test, ), compilerPlugins, scalacOptions -= "-Xfatal-warnings", From ef8880e58e755ada0e22eff974787ba88ce3d6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Mon, 25 Sep 2023 01:24:48 +0200 Subject: [PATCH 017/114] Use Eq more (#336) --- .../ast/src/main/scala/playground/smithyql/AST.scala | 2 +- .../src/main/scala/playground/CompilationError.scala | 9 ++++++--- .../main/scala/playground/QueryCompilerVisitor.scala | 8 ++++---- .../src/test/scala/playground/IorUtilsTests.scala | 2 +- .../scala/playground/smithyql/format/Formatter.scala | 10 ---------- .../playground/language/CompletionProvider.scala | 2 +- .../playground/language/CompletionVisitor.scala | 5 ++++- .../playground/smithyql/parser/SourceParser.scala | 12 ++++++------ 8 files changed, 23 insertions(+), 27 deletions(-) diff --git a/modules/ast/src/main/scala/playground/smithyql/AST.scala b/modules/ast/src/main/scala/playground/smithyql/AST.scala index f3467d9c..3adc2baf 100644 --- a/modules/ast/src/main/scala/playground/smithyql/AST.scala +++ b/modules/ast/src/main/scala/playground/smithyql/AST.scala @@ -270,7 +270,7 @@ object Struct { )( getValue: F[Identifier] => Identifier ): Option[F[InputNode[F]]] = value - .find(pair => getValue(pair.identifier).text == name) + .find(pair => getValue(pair.identifier).text === name) .map(_.value) } diff --git a/modules/core/src/main/scala/playground/CompilationError.scala b/modules/core/src/main/scala/playground/CompilationError.scala index 93b312c4..1aeded31 100644 --- a/modules/core/src/main/scala/playground/CompilationError.scala +++ b/modules/core/src/main/scala/playground/CompilationError.scala @@ -4,6 +4,7 @@ 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 playground.smithyql.format.Formatter @@ -19,8 +20,8 @@ final case class CompilationError( ) { def deprecated: CompilationError = copy(tags = tags + DiagnosticTag.Deprecated) - def isError: Boolean = severity == DiagnosticSeverity.Error - def isWarning: Boolean = severity == DiagnosticSeverity.Warning + def isError: Boolean = severity === DiagnosticSeverity.Error + def isWarning: Boolean = severity === DiagnosticSeverity.Warning } object CompilationError { @@ -69,6 +70,8 @@ object DiagnosticSeverity { case object Warning extends DiagnosticSeverity case object Error extends DiagnosticSeverity case object Information extends DiagnosticSeverity + + implicit val eq: Eq[DiagnosticSeverity] = Eq.fromUniversalEquals } sealed trait DiagnosticTag extends Product with Serializable @@ -145,7 +148,7 @@ sealed trait CompilationErrorDetails extends Product with Serializable { val expectedRemainingString = if (remainingFields.isEmpty) "" - else if (remainingFields.size == 1) + else if (remainingFields.sizeIs == 1) s" Expected: ${remainingFields.head}." else s" Expected: one of ${remainingFields.mkString(", ")}." diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index 1ce3f248..851080b5 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -271,7 +271,7 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { val presentKeys = struct.value.fields.value.keys val extraFieldErrors: QueryCompiler.Result[Unit] = presentKeys - .filterNot(field => validFields.contains(field.value.text)) + .filterNot(field => validFields.contains_(field.value.text)) .map { unexpectedKey => CompilationError.error( UnexpectedField(remainingValidFields), @@ -342,7 +342,7 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { // todo: should say it's a union .typeCheck(NodeKind.Struct) { case s @ Struct(_) => s } .emap { - case s if s.value.fields.value.size == 1 => + case s if s.value.fields.value.size === 1 => val definition = s.value.fields.value.head val key = definition.identifier @@ -462,10 +462,10 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { total: E => EnumValue[E], ): QueryCompiler[E] = (string, QueryCompiler.pos).tupled.emap { case (name, range) => val byValue = values - .find(_.stringValue == name) + .find(_.stringValue === name) val byName = values - .find(_.name == name) + .find(_.name === name) (byName, byValue) match { case (Some(v), _) => v.value.pure[QueryCompiler.Result] diff --git a/modules/core/src/test/scala/playground/IorUtilsTests.scala b/modules/core/src/test/scala/playground/IorUtilsTests.scala index 98bf621e..1d1cb067 100644 --- a/modules/core/src/test/scala/playground/IorUtilsTests.scala +++ b/modules/core/src/test/scala/playground/IorUtilsTests.scala @@ -26,7 +26,7 @@ object IorUtilsTests extends FunSuite { .foreach { testCase => test(s"orElseCombine(${testCase.lhs}, ${testCase.rhs})") { val result = IorUtils.orElseCombine(testCase.lhs, testCase.rhs) - assert(result == testCase.expected) + assert(result === testCase.expected) } } } 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 9e28ef1c..3a71f518 100644 --- a/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala +++ b/modules/formatter/src/main/scala/playground/smithyql/format/Formatter.scala @@ -68,16 +68,6 @@ private[format] object FormattingVisitor extends ASTVisitor[WithSource, Doc] { v internal + commentsRHSSep + commentsRHS - /* - case CommentPosition.After if lines.lengthIs == 1 => - // one line: we add a space before the comment - Doc.lineOrSpace + internalString - - case CommentPosition.After => - // more lines: we force a hardline before the comments - Doc.hardLine + internalString - } - */ } private def printGeneric( 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 ee309930..56e1890c 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala @@ -51,7 +51,7 @@ object CompletionProvider { presentServiceIdentifiers: List[QualifiedIdentifier], insertBodyStruct: CompletionItem.InsertBodyStruct, ): List[CompletionItem] = { - val needsUseClause = !presentServiceIdentifiers.contains(serviceId) + val needsUseClause = !presentServiceIdentifiers.contains_(serviceId) val insertUseClause = if (needsUseClause) 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 98a64ed3..4cc15da1 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -2,6 +2,7 @@ package playground.language import cats.Id import cats.implicits._ +import cats.kernel.Eq import playground.ServiceNameExtractor import playground.TextUtils import playground.language.CompletionItem.InsertUseClause.NotRequired @@ -145,7 +146,7 @@ object CompletionItem { insertText: InsertText, schema: Schema[_], ): CompletionItem = { - val isField = kind == CompletionItemKind.Field + val isField = kind === CompletionItemKind.Field val sortText = isField match { @@ -402,6 +403,8 @@ object CompletionItemKind { case object Constant extends CompletionItemKind case object UnionMember extends CompletionItemKind case object Function extends CompletionItemKind + + implicit val eq: Eq[CompletionItemKind] = Eq.fromUniversalEquals } object CompletionVisitor extends SchemaVisitor[CompletionResolver] { 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 30307495..7e7d99c2 100644 --- a/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala +++ b/modules/parser/src/main/scala/playground/smithyql/parser/SourceParser.scala @@ -72,12 +72,12 @@ case class ParsingFailure( e: Parser.Expectation, ): String = e match { - case OneOfStr(_, List(str)) => prep(str) - case OneOfStr(_, strs) => strs.map(prep).mkString_(" OR ") - case InRange(_, 'A', 'Z') => "an uppercase letter" - case InRange(_, 'a', 'z') => "a lowercase letter" - case InRange(_, '0', '9') => "digit" - case InRange(_, from, to) if from == to => prep(from.toString) + case OneOfStr(_, List(str)) => prep(str) + case OneOfStr(_, strs) => strs.map(prep).mkString_(" OR ") + case InRange(_, 'A', 'Z') => "an uppercase letter" + case InRange(_, 'a', 'z') => "a lowercase letter" + case InRange(_, '0', '9') => "digit" + case InRange(_, from, to) if from === to => prep(from.toString) case InRange(_, from, to) => s"one of ${prep(from.toString)} - ${prep(to.toString)}" case EndOfString(_, _) => "end of string" case WithContext(contextStr, underlying) if verbose => From 078fa1ab372c0d1aee18099ee04064ef01941e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Tue, 3 Oct 2023 01:22:35 +0200 Subject: [PATCH 018/114] Scala 3 prep: drop cats-tagless-macros (#341) --- build.sbt | 2 +- .../scala/playground/lsp/LanguageClient.scala | 32 +++++++-- .../scala/playground/lsp/LanguageServer.scala | 72 +++++++++++++++++-- .../playground/plugins/PlaygroundPlugin.scala | 2 +- 4 files changed, 92 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index 9d362cf7..cea3e66b 100644 --- a/build.sbt +++ b/build.sbt @@ -157,7 +157,7 @@ lazy val lsp = module("lsp") "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-macros" % "0.15.0", + "org.typelevel" %% "cats-tagless-core" % "0.15.0", ), buildInfoPackage := "playground.lsp.buildinfo", buildInfoKeys ++= Seq(version, scalaBinaryVersion), diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala index f22f9811..06a86299 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala @@ -3,16 +3,12 @@ package playground.lsp import cats.FlatMap import cats.effect.kernel.Async import cats.implicits._ -import cats.tagless.Derive -import cats.tagless.FunctorK -import cats.tagless.implicits._ import com.google.gson.JsonElement import org.eclipse.lsp4j.ConfigurationItem import org.eclipse.lsp4j.ConfigurationParams import org.eclipse.lsp4j.MessageParams import org.eclipse.lsp4j.MessageType import playground.language.Feedback -import playground.lsp.util.KleisliOps import java.util.concurrent.CompletableFuture import scala.jdk.CollectionConverters._ @@ -52,8 +48,6 @@ object LanguageClient { implicit F: LanguageClient[F] ): LanguageClient[F] = F - implicit val functorK: FunctorK[LanguageClient] = Derive.functorK - def adapt[F[_]: Async]( client: PlaygroundLanguageClient ): LanguageClient[F] = @@ -107,9 +101,33 @@ object LanguageClient { def refreshDiagnostics: F[Unit] = withClientF(_.refreshDiagnostics()).void } + // courtesy of github copilot + // workaround for https://github.com/typelevel/cats-tagless/pull/401 def defer[F[_]: FlatMap]( fa: F[LanguageClient[F]] - ): LanguageClient[F] = Derive.readerT[LanguageClient, F].mapK(KleisliOps.applyEffectK(fa)) + ): LanguageClient[F] = + new LanguageClient[F] { + + override def configuration[A]( + v: ConfigurationValue[A] + ): F[A] = fa.flatMap(_.configuration(v)) + + override def showMessage( + tpe: MessageType, + msg: String, + ): F[Unit] = fa.flatMap(_.showMessage(tpe, msg)) + + override def refreshDiagnostics: F[Unit] = fa.flatMap(_.refreshDiagnostics) + + override def refreshCodeLenses: F[Unit] = fa.flatMap(_.refreshCodeLenses) + + override def showOutputPanel: F[Unit] = fa.flatMap(_.showOutputPanel) + + override def logOutput( + msg: String + ): F[Unit] = fa.flatMap(_.logOutput(msg)) + + } val NoChangeDetected: String = "No change detected, not rebuilding server" } diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala index add0d3bc..4a5b7d37 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala @@ -7,9 +7,6 @@ import cats.effect.implicits._ import cats.effect.kernel.Async import cats.implicits._ import cats.parse.LocationMap -import cats.tagless.Derive -import cats.tagless.FunctorK -import cats.tagless.implicits._ import cats.~> import com.google.gson.JsonElement import com.google.gson.JsonPrimitive @@ -35,7 +32,6 @@ import playground.language.FormattingProvider import playground.language.TextDocumentProvider import playground.language.Uri import playground.lsp.buildinfo.BuildInfo -import playground.lsp.util.KleisliOps import playground.types._ import smithy4s.dynamic.DynamicSchemaIndex @@ -108,8 +104,6 @@ trait LanguageServer[F[_]] { object LanguageServer { - implicit val functorK: FunctorK[LanguageServer] = Derive.functorK - def notAvailable[F[_]: MonadThrow]: LanguageServer[F] = defer( new Throwable("Server not available").raiseError[F, LanguageServer[F]] ) @@ -358,8 +352,72 @@ object LanguageServer { def exit: F[Unit] = Applicative[F].unit } + // courtesy of github copilot + // workaround for https://github.com/typelevel/cats-tagless/pull/401 def defer[F[_]: FlatMap]( fa: F[LanguageServer[F]] - ): LanguageServer[F] = Derive.readerT[LanguageServer, F].mapK(KleisliOps.applyEffectK(fa)) + ): LanguageServer[F] = + new LanguageServer[F] { + + override def initialize( + params: InitializeParams + ): F[InitializeResult] = fa.flatMap(_.initialize(params)); + + override def initialized( + params: InitializedParams + ): F[Unit] = fa.flatMap(_.initialized(params)); + + override def didChange( + params: DidChangeTextDocumentParams + ): F[Unit] = fa.flatMap(_.didChange(params)); + + override def didOpen( + params: DidOpenTextDocumentParams + ): F[Unit] = fa.flatMap(_.didOpen(params)); + + override def didSave( + params: DidSaveTextDocumentParams + ): F[Unit] = fa.flatMap(_.didSave(params)); + + override def didClose( + params: DidCloseTextDocumentParams + ): F[Unit] = fa.flatMap(_.didClose(params)); + + override def formatting( + params: DocumentFormattingParams + ): F[List[TextEdit]] = fa.flatMap(_.formatting(params)); + + override def completion( + position: CompletionParams + ): F[Either[List[CompletionItem], CompletionList]] = fa.flatMap(_.completion(position)); + + override def diagnostic( + params: DocumentDiagnosticParams + ): F[DocumentDiagnosticReport] = fa.flatMap(_.diagnostic(params)); + + override def codeLens( + params: CodeLensParams + ): F[List[CodeLens]] = fa.flatMap(_.codeLens(params)); + + override def documentSymbol( + params: DocumentSymbolParams + ): F[List[DocumentSymbol]] = fa.flatMap(_.documentSymbol(params)); + + override def didChangeWatchedFiles( + params: DidChangeWatchedFilesParams + ): F[Unit] = fa.flatMap(_.didChangeWatchedFiles(params)); + + override def executeCommand( + params: ExecuteCommandParams + ): F[Unit] = fa.flatMap(_.executeCommand(params)); + + override def runFile( + params: RunFileParams + ): F[Unit] = fa.flatMap(_.runFile(params)); + + override def shutdown: F[Unit] = fa.flatMap(_.shutdown); + + override def exit: F[Unit] = fa.flatMap(_.exit) + } } 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 03541224..9fa54bc2 100644 --- a/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala +++ b/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala @@ -51,7 +51,7 @@ object SimpleHttpBuilder { service: Service[Alg], backend: Client[F], ): Either[UnsupportedProtocolError, FunctorAlgebra[Alg, F]] = - builder(service).client(backend).use + builder(service).client(backend).make } From b5a7e2faf102722dd70df3dee14618f83d4a8b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Tue, 3 Oct 2023 03:55:24 +0200 Subject: [PATCH 019/114] Support numbers with exponential syntax outside of bigints/bigdecimals (#342) --- .../playground/QueryCompilerVisitor.scala | 39 +++++----- .../smithyql/CompilationTests.scala | 73 ++++++++++++++++++- 2 files changed, 91 insertions(+), 21 deletions(-) diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index 851080b5..97756614 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -58,18 +58,22 @@ object QueryCompilerVisitor { object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { - private def checkRange[A, B]( - pc: QueryCompiler[A] + private def checkRange[B]( + pc: QueryCompiler[BigDecimal] )( tag: String )( - matchToRange: A => Option[B] + matchToRange: PartialFunction[BigDecimal, B] ) = (pc, QueryCompiler.pos).tupled.emap { case (i, range) => - matchToRange(i) - .toRightIor( + Either + .catchOnly[ArithmeticException](matchToRange.lift(i).toRight(())) + .leftWiden[Any] + .flatten + .leftMap(_ => CompilationError .error(NumberOutOfRange(i.toString, tag), range) ) + .toIor .toIorNec } @@ -85,12 +89,12 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { .typeCheck(NodeKind.Bool) { case b @ BooleanLiteral(_) => b } .map(_.value.value) case PUnit => struct(shapeId, hints, Vector.empty, _ => ()) - case PLong => checkRange(integer)("int")(_.toLongOption) - case PInt => checkRange(integer)("int")(_.toIntOption) - case PShort => checkRange(integer)("short")(_.toShortOption) - case PByte => checkRange(integer)("byte")(_.toByteOption) - case PFloat => checkRange(integer)("float")(_.toFloatOption) - case PDouble => checkRange(integer)("double")(_.toDoubleOption) + case PLong => checkRange(number)("int")(_.toLongExact) + case PInt => checkRange(number)("int")(_.toIntExact) + case PShort => checkRange(number)("short")(_.toShortExact) + case PByte => checkRange(number)("byte")(_.toByteExact) + case PFloat => checkRange(number)("float") { case i if i.isDecimalFloat => i.toFloat } + case PDouble => checkRange(number)("double") { case i if i.isDecimalDouble => i.toDouble } case PDocument => document case PBlob => (string, QueryCompiler.pos).tupled.emap { case (s, range) => @@ -101,14 +105,8 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { .toIor .toIorNec } - case PBigDecimal => - checkRange(integer)("bigdecimal") { s => - Either.catchNonFatal(BigDecimal(s)).toOption - } - case PBigInt => - checkRange(integer)("bigint") { s => - Either.catchNonFatal(BigInt(s)).toOption - } + case PBigDecimal => number + case PBigInt => checkRange(number)("bigint")(_.toBigIntExact.get) case PUUID => stringLiteral.emap { s => Either @@ -137,9 +135,10 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { } } - private val integer: QueryCompiler[String] = QueryCompiler + private val number: QueryCompiler[BigDecimal] = QueryCompiler .typeCheck(NodeKind.IntLiteral) { case i @ IntLiteral(_) => i } .map(_.value.value) + .map(BigDecimal(_)) def collection[C[_], A]( shapeId: ShapeId, diff --git a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala index e061bab0..b0dc813e 100644 --- a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala @@ -265,6 +265,23 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("int with exponential syntax - in range") { + assertNoDiff( + compile { + WithSource.liftId(IntLiteral("1e2").mapK(WithSource.liftId)) + }(Schema.int), + Ior.right(100), + ) + } + + pureTest("int with exponential syntax - in range, but not an integer") { + assert( + compile { + WithSource.liftId(IntLiteral("10.1e0").mapK(WithSource.liftId)) + }(Schema.int).isLeft + ) + } + pureTest("short") { assertNoDiff( compile { @@ -282,6 +299,15 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("short with exponential syntax - in range") { + assertNoDiff( + compile { + WithSource.liftId(IntLiteral("1e2").mapK(WithSource.liftId)) + }(Schema.short), + Ior.right(100.toShort), + ) + } + pureTest("byte") { assertNoDiff( compile { @@ -299,8 +325,17 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } - pureTest("float") { + pureTest("byte with exponential syntax - in range") { assertNoDiff( + compile { + WithSource.liftId(IntLiteral("1e2").mapK(WithSource.liftId)) + }(Schema.byte), + Ior.right(100.toByte), + ) + } + + pureTest("float") { + assert.same( compile { WithSource.liftId(Float.MaxValue.mapK(WithSource.liftId)) }(Schema.float), @@ -316,6 +351,15 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("float - exponential syntax") { + assertNoDiff( + compile { + WithSource.liftId(IntLiteral("0.1e0").mapK(WithSource.liftId)) + }(Schema.float), + Ior.right(0.1f), + ) + } + pureTest("double") { assertNoDiff( compile { @@ -334,6 +378,15 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("double - exponential syntax") { + assertNoDiff( + compile { + WithSource.liftId(IntLiteral("0.1e0").mapK(WithSource.liftId)) + }(Schema.double), + Ior.right(0.1), + ) + } + test("bigint - OK") { forall { (bi: BigInt) => assertNoDiff( @@ -353,6 +406,15 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("bigint - exponential syntax") { + assertNoDiff( + compile { + WithSource.liftId(IntLiteral("1e2").mapK(WithSource.liftId)) + }(Schema.bigint), + Ior.right(BigInt(100)), + ) + } + test("bigdecimal - OK") { forall { (bd: BigDecimal) => assertNoDiff( @@ -372,6 +434,15 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("bigdecimal - exponential syntax") { + assertNoDiff( + compile { + WithSource.liftId(IntLiteral("1e2").mapK(WithSource.liftId)) + }(Schema.bigdecimal), + Ior.right(BigDecimal(100)), + ) + } + pureTest("boolean") { assertNoDiff( compile { From 8ec96c9c6a8b5caf4243b7a6a16b8aee760f6271 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 3 Oct 2023 21:59:59 +0000 Subject: [PATCH 020/114] Update jsoniter-scala-macros to 2.23.5 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index cea3e66b..bcc0176b 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.1", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.5", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 52fdf8160e1eb0bd0db05148b7ea190479f1e68e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 3 Oct 2023 22:00:25 +0000 Subject: [PATCH 021/114] Update cats-effect to 3.5.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index cea3e66b..ceb6c40d 100644 --- a/build.sbt +++ b/build.sbt @@ -124,7 +124,7 @@ lazy val formatter = module("formatter") lazy val core = module("core") .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "cats-effect" % "3.5.1", + "org.typelevel" %% "cats-effect" % "3.5.2", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, From 7d9e6b1712c0f182e410b8816e125da4c695e52f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Wed, 4 Oct 2023 02:56:12 +0200 Subject: [PATCH 022/114] V2 Parser: Add scanner (#340) --- .../test/scala/playground/Assertions.scala | 2 +- .../smithyql/parser/v2/scanner.scala | 247 +++++++++++++ .../smithyql/parser/ParserSuite.scala | 25 ++ .../negative/PreludeParserNegativeTests.scala | 2 +- .../playground/smithyql/parser/v2/Diffs.scala | 12 + .../parser/v2/ScannerExampleTests.scala | 119 +++++++ .../smithyql/parser/v2/ScannerSuite.scala | 72 ++++ .../smithyql/parser/v2/ScannerTests.scala | 337 ++++++++++++++++++ .../playground/plugins/PlaygroundPlugin.scala | 6 +- 9 files changed, 816 insertions(+), 6 deletions(-) create mode 100644 modules/parser/src/main/scala/playground/smithyql/parser/v2/scanner.scala create mode 100644 modules/parser/src/test/scala/playground/smithyql/parser/v2/Diffs.scala create mode 100644 modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerExampleTests.scala create mode 100644 modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerSuite.scala create mode 100644 modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerTests.scala diff --git a/modules/ast/src/test/scala/playground/Assertions.scala b/modules/ast/src/test/scala/playground/Assertions.scala index 9dd6bed4..23207841 100644 --- a/modules/ast/src/test/scala/playground/Assertions.scala +++ b/modules/ast/src/test/scala/playground/Assertions.scala @@ -23,7 +23,7 @@ object Assertions extends Expectations.Helpers { val stringWithResets = d.show()(conf).linesWithSeparators.map(Console.RESET + _).mkString failure( - s"Diff failed:\n${Console.RESET}(${conf.right("expected")}, ${conf.left("actual")})\n\n" + stringWithResets + s"Diff failed:\n${Console.RESET}(${conf.left("expected")}, ${conf.right("actual")})\n\n" + stringWithResets ) } 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 new file mode 100644 index 00000000..229953ae --- /dev/null +++ b/modules/parser/src/main/scala/playground/smithyql/parser/v2/scanner.scala @@ -0,0 +1,247 @@ +package playground.smithyql.parser.v2.scanner + +import cats.kernel.Eq +import cats.parse.Numbers +import cats.syntax.all.* + +import scala.annotation.nowarn + +case class Token( + kind: TokenKind, + text: String, +) { + def width: Int = text.length +} + +object Token { + implicit val eq: Eq[Token] = Eq.fromUniversalEquals +} + +sealed trait TokenKind extends Product with Serializable { + + def apply( + text: String + ): Token = Token(this, text) + +} + +object TokenKind { + case object KW_USE extends TokenKind + case object KW_SERVICE extends TokenKind + case object KW_BOOLEAN extends TokenKind + case object LIT_NUMBER extends TokenKind + case object LIT_STRING extends TokenKind + case object KW_NULL extends TokenKind + + case object DOT extends TokenKind + case object COMMA extends TokenKind + case object HASH extends TokenKind + case object LB extends TokenKind + case object RB extends TokenKind + case object LBR extends TokenKind + case object RBR extends TokenKind + case object COLON extends TokenKind + case object EQ extends TokenKind + case object SPACE extends TokenKind + case object NEWLINE extends TokenKind + case object IDENT extends TokenKind + case object COMMENT extends TokenKind + case object Error extends TokenKind + + implicit val eq: Eq[TokenKind] = Eq.fromUniversalEquals +} + +object Scanner { + + /** Entrypoint to scanning text into tokens. + * + * Always produces an output that can be rendered back to the original text. + */ + def scan( + s: String + ): List[Token] = { + var remaining = s + var tokens = List.empty[Token] + def add( + tok: Token + ) = tokens ::= tok + + def readSimple( + token: String, + tok: TokenKind, + ): PartialFunction[Unit, Unit] = { + case _ if remaining.startsWith(token) => + add(tok(token.toString)) + remaining = remaining.drop(token.length()) + } + + def simpleTokens( + pairings: ( + String, + TokenKind, + )* + ): PartialFunction[Unit, Unit] = pairings.map(readSimple.tupled).reduce(_.orElse(_)) + + val keywords = Map( + "use" -> TokenKind.KW_USE, + "service" -> TokenKind.KW_SERVICE, + "null" -> TokenKind.KW_NULL, + "true" -> TokenKind.KW_BOOLEAN, + "false" -> TokenKind.KW_BOOLEAN, + ) + + val readIdent: PartialFunction[Unit, Unit] = { + case _ if remaining.head.isLetter => + val (letters, rest) = remaining.span(ch => ch.isLetterOrDigit || ch == '_') + + keywords.get(letters) match { + case Some(kind) => + // we matched a keyword, return it. + add(kind(letters)) + + case None => + // normal ident + add(TokenKind.IDENT(letters)) + } + + remaining = rest + } + + val readPunctuation: PartialFunction[Unit, Unit] = simpleTokens( + "." -> TokenKind.DOT, + "," -> TokenKind.COMMA, + "#" -> TokenKind.HASH, + "[" -> TokenKind.LB, + "]" -> TokenKind.RB, + "{" -> TokenKind.LBR, + "}" -> TokenKind.RBR, + ":" -> TokenKind.COLON, + "=" -> TokenKind.EQ, + ) + + val readStringLiteral: PartialFunction[Unit, Unit] = { + case _ if remaining.startsWith("\"") => + val (str, rest) = remaining.tail.span(_ != '\"') + if (rest.isEmpty) { // hit EOF + add(TokenKind.LIT_STRING("\"" + str)) + remaining = rest + } else { + add(TokenKind.LIT_STRING("\"" + str + "\"")) + remaining = rest.tail + } + } + + val readNumberLiteral: PartialFunction[Unit, Unit] = { + // I love this language + object jsonNumber { + def unapply( + @nowarn("cat=unused") + unused: Unit + ): Option[ + ( + String, + String, + ) + ] = + // For now, we're using the cats-parse implementation simply because it's consistent with the current implementation + // and we can rewrite this later on when we drop support for the other parser + // and no longer need cats-parse. + Numbers.jsonNumber.parse(remaining).toOption + } + + { case jsonNumber(rest, num) => + add(TokenKind.LIT_NUMBER(num.toString)) + remaining = rest + } + } + + // readOne and friends are all partial functions: this is the current implementation of lookahead. + // it's not great, but it kinda works. + val readOne: PartialFunction[Unit, Unit] = readIdent + .orElse(readPunctuation) + .orElse(readStringLiteral) + .orElse(readNumberLiteral) + + // split "whitespace" string into chains of contiguous newlines OR whitespace characters. + def whitespaceChains( + whitespace: String + ): List[Token] = { + val isNewline = (ch: Char) => ch == '\n' + + if (whitespace.isEmpty) + Nil + else if (isNewline(whitespace.head)) { + val (nl, rest) = whitespace.span(isNewline) + TokenKind.NEWLINE(nl) :: whitespaceChains(rest) + } else { + val (wsp, rest) = whitespace.span(!isNewline(_)) + TokenKind.SPACE(wsp) :: whitespaceChains(rest) + } + } + + def eatWhitespace( + ) = { + val (wsp, rest) = remaining.span(ch => ch.isWhitespace) + if (wsp.isEmpty()) + false + else { + whitespaceChains(wsp).foreach(add) + remaining = rest + + true + } + } + + def eatComments( + ) = + if (!remaining.startsWith("//")) + false + else { + while (remaining.startsWith("//")) { + val (comment, rest) = remaining.span(_ != '\n') + add(TokenKind.COMMENT(comment)) + remaining = rest + } + + true + } + + def eatErrors( + ) = { + // todo: bug: even if the next character starts a multi-char token, this will consider it an error. + // instead, we should rework "readOne" to consume arbitrary constant-length tokens, and also include the possibility that `rest` has comments or whitespace. + val (failures, _) = remaining.span { _ => + if (readOne.isDefinedAt(())) + // this will match. stop! + false + else { + // didn't match. We need to move the cursor manually here + remaining = remaining.tail + true + } + } + + if (failures.nonEmpty) { + add(TokenKind.Error(failures)) + true + } else + false + } + + while (remaining.nonEmpty) { + val last = remaining + + readOne.lift(()).isDefined || + eatWhitespace() || + eatComments() || + eatErrors(): Unit + + // last-effort sanity check + if (remaining == last) + sys.error(s"no progress in the last run! remaining string: $remaining") + } + + tokens.reverse + } + +} 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 f0faa515..8e65bfc8 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/ParserSuite.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/ParserSuite.scala @@ -10,6 +10,8 @@ import io.circe.Decoder 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 java.nio.file @@ -52,11 +54,30 @@ trait ParserSuite extends SimpleIOSuite { } } } + + validTokensTest(testCase, trimWhitespace) } + private def validTokensTest( + testCase: TestCase, + trimWhitespace: Boolean, + ) = + test(testCase.name + " (v2 scanner)") { + testCase.readInput(trimWhitespace).map { input => + val scanned = Scanner.scan(input) + + val errors = scanned.filter(_.kind == TokenKind.Error) + // non-empty inputs should parse to non-empty outputs + assert(input.isEmpty || scanned.nonEmpty) && + assert(errors.isEmpty) + } + } + + // invalidTokens: a flag that tells the suite whether the file should contain invalid tokens. def loadNegativeParserTests[Alg[_[_]]: SourceParser]( prefix: String, trimWhitespace: Boolean = false, + invalidTokens: Boolean, ): Unit = loadTestCases("", List("negative", prefix)).foreach { testCase => test(testCase.name) { testCase.readInput(trimWhitespace).map { input => @@ -66,6 +87,10 @@ trait ParserSuite extends SimpleIOSuite { } } } + + if (!invalidTokens) + validTokensTest(testCase, trimWhitespace) + } private def readText( diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/generative/negative/PreludeParserNegativeTests.scala b/modules/parser/src/test/scala/playground/smithyql/parser/generative/negative/PreludeParserNegativeTests.scala index 55c2f618..b4b258f3 100644 --- a/modules/parser/src/test/scala/playground/smithyql/parser/generative/negative/PreludeParserNegativeTests.scala +++ b/modules/parser/src/test/scala/playground/smithyql/parser/generative/negative/PreludeParserNegativeTests.scala @@ -4,5 +4,5 @@ import playground.smithyql.Prelude import playground.smithyql.parser.ParserSuite object PreludeParserNegativeTests extends ParserSuite { - loadNegativeParserTests[Prelude]("prelude", trimWhitespace = true) + loadNegativeParserTests[Prelude]("prelude", trimWhitespace = true, invalidTokens = false) } diff --git a/modules/parser/src/test/scala/playground/smithyql/parser/v2/Diffs.scala b/modules/parser/src/test/scala/playground/smithyql/parser/v2/Diffs.scala new file mode 100644 index 00000000..1ddca3d8 --- /dev/null +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/Diffs.scala @@ -0,0 +1,12 @@ +package playground.smithyql.parser.v2 + +import com.softwaremill.diffx.Diff +import playground.smithyql.parser.v2.scanner.Token +import playground.smithyql.parser.v2.scanner.TokenKind + +object Diffs { + + implicit val tokenKindDiff: Diff[TokenKind] = Diff.derived + implicit val tokenDiff: Diff[Token] = Diff.derived + +} 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 new file mode 100644 index 00000000..d6680264 --- /dev/null +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerExampleTests.scala @@ -0,0 +1,119 @@ +package playground.smithyql.parser.v2 + +import playground.smithyql.parser.v2.scanner.TokenKind._ +import weaver._ + +object ScannerExampleTests extends SimpleIOSuite with ScannerSuite { + scanTest( + explicitName = "Real file 1", + input = + """use service demo.smithy#DemoService + | + |// CreateSubscription { + |// subscription: { + |// id: "subscription_id", + |// name: "name", + |// createdAt: "2020-04-01T00:00:00Z", + |// }, + |// } + |CreateHero { + | hero: { + | good: // bgasdfasldf + | { + | howGood: 10, + | }, + | }, + | intSet: [ + | 1, + | 2, + | 1, + | ], + |} + |""".stripMargin, + )( + List( + KW_USE("use"), + SPACE(" "), + KW_SERVICE("service"), + SPACE(" "), + IDENT("demo"), + DOT("."), + IDENT("smithy"), + HASH("#"), + IDENT("DemoService"), + NEWLINE("\n\n"), + COMMENT("// CreateSubscription {"), + NEWLINE("\n"), + COMMENT("// subscription: {"), + NEWLINE("\n"), + COMMENT("// id: \"subscription_id\","), + NEWLINE("\n"), + COMMENT("// name: \"name\","), + NEWLINE("\n"), + COMMENT("// createdAt: \"2020-04-01T00:00:00Z\","), + NEWLINE("\n"), + COMMENT("// },"), + NEWLINE("\n"), + COMMENT("// }"), + NEWLINE("\n"), + IDENT("CreateHero"), + SPACE(" "), + LBR("{"), + NEWLINE("\n"), + SPACE(" "), + IDENT("hero"), + COLON(":"), + SPACE(" "), + LBR("{"), + NEWLINE("\n"), + SPACE(" "), + IDENT("good"), + COLON(":"), + SPACE(" "), + COMMENT("// bgasdfasldf"), + NEWLINE("\n"), + SPACE(" "), + LBR("{"), + NEWLINE("\n"), + SPACE(" "), + IDENT("howGood"), + COLON(":"), + SPACE(" "), + LIT_NUMBER("10"), + COMMA(","), + NEWLINE("\n"), + SPACE(" "), + RBR("}"), + COMMA(","), + NEWLINE("\n"), + SPACE(" "), + RBR("}"), + COMMA(","), + NEWLINE("\n"), + SPACE(" "), + IDENT("intSet"), + COLON(":"), + SPACE(" "), + LB("["), + NEWLINE("\n"), + SPACE(" "), + LIT_NUMBER("1"), + COMMA(","), + NEWLINE("\n"), + SPACE(" "), + LIT_NUMBER("2"), + COMMA(","), + NEWLINE("\n"), + SPACE(" "), + LIT_NUMBER("1"), + COMMA(","), + NEWLINE("\n"), + SPACE(" "), + RB("]"), + COMMA(","), + NEWLINE("\n"), + RBR("}"), + NEWLINE("\n"), + ) + ) +} 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 new file mode 100644 index 00000000..4c78d373 --- /dev/null +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerSuite.scala @@ -0,0 +1,72 @@ +package playground.smithyql.parser.v2 + +import cats.effect.IO +import cats.implicits._ +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 Diffs._ +import Scanner.scan + +trait ScannerSuite { self: IOSuite => + + protected def arbTests( + name: TestName + )( + withArb: Arbitrary[String] => IO[Expectations] + ): Unit = { + + val sampleStringGen = Gen.oneOf( + Gen.alphaStr, + Gen.alphaNumStr, + Gen.asciiPrintableStr, + Gen.identifier, + Gen.oneOf(List(' ', '\n', '\t', '\r', '\f', '\b')).map(_.toString), + ) + + val arbString: Arbitrary[String] = Arbitrary { + Gen.listOf(sampleStringGen).map(_.mkString) + } + + test(name)(withArb(Arbitrary.arbString)) + test(name.copy(name = name.name + " (prepared input)"))(withArb(arbString)) + } + + protected def scanTest( + input: String, + explicitName: TestName = "", + )( + expected: List[Token] + )( + implicit loc: SourceLocation + ): Unit = + pureTest( + if (explicitName.name.nonEmpty) + explicitName + else + "Scan string: " + sanitize(input) + ) { + Assertions.assertNoDiff(scan(input), expected) + } + + // Runs scanTest by first rendering the expected tokens to a string, then scanning it to get them back. + // If the output is not the same as the input, the test fails. + // While it's guaranteed that rendering tokens to text produces scannable code (everything is scannable), + // due to ambiguities in the scanner it's not guaranteed that the output will be the same as the input - hence the need to test. + protected def scanTestReverse( + explicitName: String + )( + expected: List[Token] + )( + implicit loc: SourceLocation + ): Unit = scanTest(expected.foldMap(_.text), explicitName)(expected) + + protected def sanitize( + text: String + ) = text.replace(" ", "·").replace("\n", "↵") + +} 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 new file mode 100644 index 00000000..7009f55f --- /dev/null +++ b/modules/parser/src/test/scala/playground/smithyql/parser/v2/ScannerTests.scala @@ -0,0 +1,337 @@ +package playground.smithyql.parser.v2 + +import cats.Show +import cats.implicits._ +import cats.parse.Numbers +import org.scalacheck.Arbitrary +import playground.Assertions +import playground.smithyql.parser.v2.scanner.Scanner +import playground.smithyql.parser.v2.scanner.TokenKind._ +import weaver._ +import weaver.scalacheck.Checkers + +import Diffs._ +import Scanner.scan + +object ScannerTests extends SimpleIOSuite with Checkers with ScannerSuite { + + arbTests("Any string input scans successfully") { implicit arbString => + forall { (s: String) => + scan(s): Unit + success + } + } + + arbTests("Scanning is lossless") { implicit arbString => + forall { (s: String) => + assert.eql(scan(s).foldMap(_.text), s) + } + } + scanTest("{")(List(LBR("{"))) + scanTest("}")(List(RBR("}"))) + scanTest("[")(List(LB("["))) + scanTest("]")(List(RB("]"))) + scanTest(".")(List(DOT("."))) + scanTest(",")(List(COMMA(","))) + scanTest("#")(List(HASH("#"))) + scanTest(":")(List(COLON(":"))) + scanTest("=")(List(EQ("="))) + scanTest("a")(List(IDENT("a"))) + scanTest("use")(List(KW_USE("use"))) + scanTest("service")(List(KW_SERVICE("service"))) + scanTest("null")(List(KW_NULL("null"))) + scanTest("true")(List(KW_BOOLEAN("true"))) + scanTest("false")(List(KW_BOOLEAN("false"))) + + scanTest("5")(List(LIT_NUMBER("5"))) + scanTest("50")(List(LIT_NUMBER("50"))) + + // todo: this would be nice to parse as a single error token. + // might be possible to achieve by catching epsilon failures in the number parser, so that if any progress is seen we'd skip N characters before another token is attempted. + // need to test this for interactions with other following tokens (as well as error tokens before numbers, which are using readOne). + scanTest("05")(List(LIT_NUMBER("0"), LIT_NUMBER("5"))) + scanTest("0")(List(LIT_NUMBER("0"))) + scanTest("0.0")(List(LIT_NUMBER("0.0"))) + scanTest("0.5")(List(LIT_NUMBER("0.5"))) + // tbh: this might work better as a single error token. + // see above comment about epsilon failures. + scanTest("0.")(List(Error("0"), DOT("."))) + + scanTest("1e10")(List(LIT_NUMBER("1e10"))) + + private def numberTest[A: Arbitrary: Show]( + name: String + ) = + test(s"Any $name can be parsed as a number") { + forall { (a: A) => + Assertions.assertNoDiff(scan(a.toString()), List(LIT_NUMBER(a.toString()))) + } + } + + numberTest[Byte]("byte") + numberTest[Short]("short") + numberTest[Int]("int") + numberTest[Long]("long") + numberTest[Float]("float") + numberTest[Double]("double") + numberTest[BigInt]("bigint") + // deliberately not testing BigDecimal this way - these are wider than json numbers so we can't test the full range + + test("If cats-parse can parse a JSON number, so can we") { + forall { (s: String) => + Numbers.jsonNumber.parseAll(s).toOption match { + case None => success + case Some(succ) => + println("woop woop!") + Assertions.assertNoDiff(scan(succ), List(LIT_NUMBER(succ))) + } + } + } + + // idents + scanTest("abcdef")(List(IDENT("abcdef"))) + + scanTest( + "hello_world" + )( + List( + IDENT("hello_world") + ) + ) + + scanTest( + "helloworld123" + )( + List( + IDENT("helloworld123") + ) + ) + + scanTest(explicitName = "Identifier similar to a keyword - prefix", input = "notfalse")( + List( + IDENT("notfalse") + ) + ) + + scanTest(explicitName = "Identifier similar to a keyword - suffix", input = "falsely")( + List( + IDENT("falsely") + ) + ) + + // whitespace + scanTest(" ")(List(SPACE(" "))) + scanTest("\n")(List(NEWLINE("\n"))) + + // contiguous whitespace of all kinds + // notably newlines are grouped together separately from other whitespace + scanTest(" \r \r \n\n")(List(SPACE(" \r \r "), NEWLINE("\n\n"))) + scanTest(" \n\n \n ")( + List( + SPACE(" "), + NEWLINE("\n\n"), + SPACE(" "), + NEWLINE("\n"), + SPACE(" "), + ) + ) + + // comments + scanTest("// hello 123 foo bar --")(List(COMMENT("// hello 123 foo bar --"))) + + scanTest( + explicitName = "Scan multiple line-comments", + input = + """//hello + |//world""".stripMargin, + )( + List( + COMMENT("//hello"), + NEWLINE("\n"), + COMMENT("//world"), + ) + ) + + scanTest( + "hello world //this is a comment" + )( + List( + IDENT("hello"), + SPACE(" "), + IDENT("world"), + SPACE(" "), + COMMENT("//this is a comment"), + ) + ) + + // errors + + scanTest( + explicitName = "Error tokens for input that doesn't match any other token", + input = "🤷*%$^@-+?", + )(List(Error("🤷*%$^@-+?"))) + + scanTest( + explicitName = "Error tokens mixed between other tokens", + input = "hello@world", + )( + List( + IDENT("hello"), + Error("@"), + IDENT("world"), + ) + ) + + scanTest( + explicitName = "Error tokens mixed between other tokens - complex", + input = "hello@world-this?is=an Date: Wed, 4 Oct 2023 15:32:25 +0000 Subject: [PATCH 023/114] Revert commit(s) 8ec96c9 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index bcc0176b..cea3e66b 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.1", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.5", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 2b0ec36ac88a31ed8ab0386e41ccf6b357d5a1ce Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 4 Oct 2023 15:32:39 +0000 Subject: [PATCH 024/114] Update jsoniter-scala-macros to 2.23.5 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ceb6c40d..6248f1ee 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.2", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.5", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 469cd86c86492278ac5cdb216ba29b8b2454c56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Thu, 5 Oct 2023 13:20:24 +0200 Subject: [PATCH 025/114] Update to smithy4s 0.18 (#255) --- README.md | 5 +- build.sbt | 2 +- .../playground/DynamicServiceProxy.scala | 47 +----- .../scala/playground/NodeEncoderVisitor.scala | 55 +++---- .../scala/playground/OperationCompiler.scala | 5 +- .../scala/playground/OperationRunner.scala | 19 ++- .../playground/QueryCompilerVisitor.scala | 145 ++++++++++-------- .../smithyutil/AddDynamicRefinements.scala | 3 +- .../smithyutil/TransitiveCompiler.scala | 20 ++- .../src/test/scala/playground/Diffs.scala | 4 +- .../test/scala/playground/DynamicModel.scala | 2 +- .../scala/playground/NodeEncoderTests.scala | 31 +++- .../smithyql/CompilationTests.scala | 36 ++++- modules/core/src/test/smithy/demo.smithy | 21 ++- .../test/scala/playground/e2e/E2ETests.scala | 4 +- .../language/CompletionProvider.scala | 3 +- .../language/CompletionVisitor.scala | 111 ++++++++++---- .../language/CompletionProviderTests.scala | 22 +-- .../playground/language/CompletionTests.scala | 73 ++++++++- .../language/DiagnosticProviderTests.scala | 8 + .../scala/playground/lsp/BuildLoader.scala | 19 +-- .../scala/playground/lsp/LanguageServer.scala | 2 +- .../scala/playground/lsp/MainServer.scala | 3 +- .../scala/playground/lsp/ServerBuilder.scala | 12 +- .../lsp/util/SerializedSmithyModel.scala | 21 --- project/plugins.sbt | 3 +- smithy-build.json | 4 +- 27 files changed, 426 insertions(+), 254 deletions(-) delete mode 100644 modules/lsp/src/main/scala/playground/lsp/util/SerializedSmithyModel.scala diff --git a/README.md b/README.md index 111c10fd..12e285d7 100644 --- a/README.md +++ b/README.md @@ -131,8 +131,9 @@ We have: - booleans: `true`, `false` - lists: `[ true, false, ]` - structures: `{ k: "value", k2: true, k3: [ 10, 20, ], }` - note that keys aren't quoted, unlike in JSON -- null, but it's not what you think: the `null` literal only typechecks as a Smithy `Document`, - and corresponds to the [Null document](https://awslabs.github.io/smithy/2.0/spec/simple-types.html?highlight=null#document). +- null, but it's not what you think: the `null` literal only typechecks as two things: + - a Smithy `Document`: corresponds to the [Null document](https://awslabs.github.io/smithy/2.0/spec/simple-types.html?highlight=null#document) + - an element of a sparse collection. ### Type representation diff --git a/build.sbt b/build.sbt index 6248f1ee..ce3c7270 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test, "com.disneystreaming.alloy" % "alloy-core" % "0.2.7" % Test, - "software.amazon.smithy" % "smithy-aws-traits" % "1.34.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.39.1" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/modules/core/src/main/scala/playground/DynamicServiceProxy.scala b/modules/core/src/main/scala/playground/DynamicServiceProxy.scala index d03bb6fc..b5e15479 100644 --- a/modules/core/src/main/scala/playground/DynamicServiceProxy.scala +++ b/modules/core/src/main/scala/playground/DynamicServiceProxy.scala @@ -50,11 +50,11 @@ class DynamicServiceProxy[Alg[_[_, _, _, _, _]], Op[_, _, _, _, _]]( val mapOutput = makeProxy(endpointStatic.output, endpoint.output) def errorMapper[A]: Throwable => F[A] = - endpointStatic.errorable match { + endpointStatic.error match { case None => _.raiseError[F, A] case Some(errorableStatic) => - val errorable = endpoint.errorable.get // should be there at this point - val mapError = makeProxy(errorableStatic.error, errorable.error) + val errorable = endpoint.error.get // should be there at this point + val mapError = makeProxy(errorableStatic.schema, errorable.schema) e => errorableStatic.liftError(e) match { @@ -77,47 +77,8 @@ class DynamicServiceProxy[Alg[_[_, _, _, _, _]], Op[_, _, _, _, _]]( endpoint: Endpoint[Op, I, E, O, SI, SO] ): I => F[O] = applyWithStatic(endpoint, grp(endpoint.id)) } - .precomputeBy(service.endpoints, _.name) - - new FunctorInterpreter[Op, F] { - def apply[I, E, O, SI, SO]( - op: Op[I, E, O, SI, SO] - ): F[O] = { - val (input, endpoint) = service.endpoint(op) - endpointMapping(endpoint)(input) - } - } - } - - private final implicit class PolyFunction5Ops[F[_, _, _, _, _], G[_, _, _, _, _]]( - self: PolyFunction5[F, G] - ) { - - // copied from smithy4s PolyFunction5's unsafeCacheBy - final def precomputeBy[K]( - allPossibleInputs: Seq[Kind5.Existential[F]], - getKey: Kind5.Existential[F] => K, - ): PolyFunction5[F, G] = - new PolyFunction5[F, G] { - - private val map: Map[K, Any] = { - val builder = Map.newBuilder[K, Any] - allPossibleInputs.foreach(input => - builder += getKey(input) -> self - .apply(input.asInstanceOf[F[Any, Any, Any, Any, Any]]) - .asInstanceOf[Any] - ) - builder.result() - } - - def apply[A0, A1, A2, A3, A4]( - input: F[A0, A1, A2, A3, A4] - ): G[A0, A1, A2, A3, A4] = map( - getKey(Kind5.existential(input)) - ).asInstanceOf[G[A0, A1, A2, A3, A4]] - - } + service.functorInterpreter(endpointMapping) } } diff --git a/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala b/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala index 44c855f5..37a346ce 100644 --- a/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala +++ b/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala @@ -13,7 +13,6 @@ import playground.smithyql.NullLiteral import playground.smithyql.StringLiteral import playground.smithyql.Struct import smithy4s.Bijection -import smithy4s.ByteArray import smithy4s.Document import smithy4s.Document.DArray import smithy4s.Document.DBoolean @@ -32,12 +31,12 @@ import smithy4s.schema.CollectionTag.IndexedSeqTag import smithy4s.schema.CollectionTag.ListTag import smithy4s.schema.CollectionTag.SetTag import smithy4s.schema.CollectionTag.VectorTag +import smithy4s.schema.EnumTag import smithy4s.schema.EnumValue import smithy4s.schema.Field import smithy4s.schema.Primitive import smithy4s.schema.Primitive._ import smithy4s.schema.Schema -import smithy4s.schema.SchemaField import smithy4s.schema.SchemaVisitor trait NodeEncoder[A] { @@ -111,16 +110,24 @@ object NodeEncoderVisitor extends SchemaVisitor[NodeEncoder] { self => case PBigInt => bigint case PBoolean => boolean case PBigDecimal => bigdecimal - case PBlob => string.contramap((_: ByteArray).toString) + case PBlob => string.contramap(_.toBase64String) case PDouble => double case PDocument => document case PFloat => float - case PUnit => _ => obj(Nil) case PUUID => string.contramap(_.toString()) case PByte => byte case PTimestamp => string.contramap(_.toString) } + def option[A]( + schema: Schema[A] + ): NodeEncoder[Option[A]] = { + val base = schema.compile(this) + val nullDoc = document.toNode(Document.nullDoc) + + _.fold(nullDoc)(base.toNode) + } + def collection[C[_], A]( shapeId: ShapeId, hints: Hints, @@ -162,6 +169,7 @@ object NodeEncoderVisitor extends SchemaVisitor[NodeEncoder] { self => def enumeration[E]( shapeId: ShapeId, hints: Hints, + tag: EnumTag[E], values: List[EnumValue[E]], total: E => EnumValue[E], ): NodeEncoder[E] = string.contramap(total(_).name) @@ -169,39 +177,32 @@ object NodeEncoderVisitor extends SchemaVisitor[NodeEncoder] { self => def struct[S]( shapeId: ShapeId, hints: Hints, - fieldsRaw: Vector[SchemaField[S, _]], + fieldsRaw: Vector[Field[S, _]], make: IndexedSeq[Any] => S, ): NodeEncoder[S] = { - val fields = fieldsRaw.map(_.mapK(this)) def go[A]( - f: Field[NodeEncoder, S, A], - s: S, - ): Option[Binding[Id]] = f.fold( - new Field.Folder[NodeEncoder, S, Option[Binding[Id]]] { - def onRequired[F]( - label: String, - instance: NodeEncoder[F], - get: S => F, - ): Option[Binding[Id]] = Binding[Id](Identifier(label), instance.toNode(get(s))).some - - def onOptional[F]( - label: String, - instance: NodeEncoder[F], - get: S => Option[F], - ): Option[Binding[Id]] = get(s).map(f => Binding[Id](Identifier(label), instance.toNode(f))) - } - ) + f: Field[S, A] + ): S => Option[Binding[Id]] = { + val instance = f.schema.compile(this) + + s => + f.getUnlessDefault(s).map(instance.toNode(_)).map { v => + Binding[Id](Identifier(f.label), v) + } + } + + val fields = fieldsRaw.map(go(_)) - s => obj(fields.flatMap(go(_, s)).toList) + s => obj(fields.mapFilter(_.apply(s)).toList) } def union[U]( shapeId: ShapeId, hints: Hints, - alternatives: Vector[Alt[Schema, U, _]], - dispatcher: Alt.Dispatcher[Schema, U], - ): NodeEncoder[U] = dispatcher.compile(new Alt.Precompiler[Schema, NodeEncoder] { + alternatives: Vector[Alt[U, _]], + dispatcher: Alt.Dispatcher[U], + ): NodeEncoder[U] = dispatcher.compile(new Alt.Precompiler[NodeEncoder] { def apply[A]( label: String, diff --git a/modules/core/src/main/scala/playground/OperationCompiler.scala b/modules/core/src/main/scala/playground/OperationCompiler.scala index 4048d388..631d34a8 100644 --- a/modules/core/src/main/scala/playground/OperationCompiler.scala +++ b/modules/core/src/main/scala/playground/OperationCompiler.scala @@ -83,7 +83,7 @@ object OperationCompiler { def fromSchemaIndex( dsi: DynamicSchemaIndex - ): OperationCompiler[Eff] = fromServices(dsi.allServices) + ): OperationCompiler[Eff] = fromServices(dsi.allServices.toList) def fromServices( services: List[DynamicSchemaIndex.ServiceWrapper] @@ -154,7 +154,7 @@ private class ServiceCompiler[Alg[_[_, _, _, _, _]]]( ): QueryCompiler[CompiledInput] = { val inputCompiler = e.input.compile(QueryCompilerVisitor.full) val outputEncoder = NodeEncoder.derive(e.output) - val errorEncoder = e.errorable.map(e => NodeEncoder.derive(e.error)) + val errorEncoder = e.error.map(e => NodeEncoder.derive(e.schema)) ast => inputCompiler @@ -177,6 +177,7 @@ private class ServiceCompiler[Alg[_[_, _, _, _, _]]]( // map of endpoint names to (endpoint, input compiler) private val endpoints = service .endpoints + .toList .groupByNel(_.name) .map(_.map(_.head).map(e => (e, compileEndpoint(e)))) diff --git a/modules/core/src/main/scala/playground/OperationRunner.scala b/modules/core/src/main/scala/playground/OperationRunner.scala index f9b69a53..ed018e0c 100644 --- a/modules/core/src/main/scala/playground/OperationRunner.scala +++ b/modules/core/src/main/scala/playground/OperationRunner.scala @@ -2,16 +2,21 @@ package playground import aws.protocols.AwsJson1_0 import aws.protocols.AwsJson1_1 +import aws.protocols.AwsQuery +import aws.protocols.Ec2Query +import aws.protocols.RestJson1 +import aws.protocols.RestXml import cats.Defer import cats.Id import cats.data.IorNel import cats.data.NonEmptyList -import cats.effect.Concurrent +import cats.effect.Async import cats.effect.MonadCancelThrow import cats.effect.Resource import cats.effect.implicits._ import cats.effect.std import cats.implicits._ +import fs2.compression.Compression import org.http4s.Uri import org.http4s.client.Client import playground._ @@ -135,14 +140,14 @@ object OperationRunner { } } - def forSchemaIndex[F[_]: StdlibRuntime: Concurrent: Defer: std.Console]( + def forSchemaIndex[F[_]: StdlibRuntime: Async: Compression: std.Console]( dsi: DynamicSchemaIndex, client: Client[F], baseUri: F[Uri], awsEnv: Resource[F, AwsEnvironment[F]], plugins: List[PlaygroundPlugin], ): Map[QualifiedIdentifier, Resolver[F]] = forServices( - services = dsi.allServices, + services = dsi.allServices.toList, getSchema = dsi.getSchema, client = client, baseUri = baseUri, @@ -150,7 +155,7 @@ object OperationRunner { plugins = plugins, ) - def forServices[F[_]: StdlibRuntime: Concurrent: Defer: std.Console]( + def forServices[F[_]: StdlibRuntime: Async: Compression: std.Console]( services: List[DynamicSchemaIndex.ServiceWrapper], getSchema: ShapeId => Option[Schema[_]], client: Client[F], @@ -194,7 +199,7 @@ object OperationRunner { } - def forService[Alg[_[_, _, _, _, _]], F[_]: StdlibRuntime: Concurrent: Defer: std.Console]( + def forService[Alg[_[_, _, _, _, _]], F[_]: StdlibRuntime: Async: Compression: std.Console]( service: Service[Alg], client: Client[F], baseUri: F[Uri], @@ -256,14 +261,14 @@ object OperationRunner { .prepare(service) .map { builder => awsEnv - .map(builder.buildSimple(_)) + .map(builder.build(_)) .map(service.toPolyFunction(_)) } .map(liftFunctorInterpreterResource(_)) .toIor .leftMap(_ => NonEmptyList - .of(AwsJson1_0.id, AwsJson1_1.id) + .of(AwsJson1_0.id, AwsJson1_1.id, RestJson1.id, AwsQuery.id, RestXml.id, Ec2Query.id) .map(Issue.InvalidProtocol(_, serviceProtocols)) ) diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index 97756614..e8f90cc6 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -11,7 +11,7 @@ import playground.smithyutil._ import smithy.api import smithy.api.TimestampFormat import smithy4s.Bijection -import smithy4s.ByteArray +import smithy4s.Blob import smithy4s.Document import smithy4s.Hints import smithy4s.Lazy @@ -24,7 +24,9 @@ import smithy4s.schema.CollectionTag.IndexedSeqTag import smithy4s.schema.CollectionTag.ListTag import smithy4s.schema.CollectionTag.SetTag import smithy4s.schema.CollectionTag.VectorTag +import smithy4s.schema.EnumTag import smithy4s.schema.EnumValue +import smithy4s.schema.Field import smithy4s.schema.Primitive import smithy4s.schema.Primitive.PBigDecimal import smithy4s.schema.Primitive.PBigInt @@ -40,9 +42,7 @@ import smithy4s.schema.Primitive.PShort import smithy4s.schema.Primitive.PString import smithy4s.schema.Primitive.PTimestamp import smithy4s.schema.Primitive.PUUID -import smithy4s.schema.Primitive.PUnit import smithy4s.schema.Schema -import smithy4s.schema.SchemaField import smithy4s.schema.SchemaVisitor import smithy4s.~> import types._ @@ -50,6 +50,7 @@ import util.chaining._ import java.util.Base64 import java.util.UUID +import scala.collection.immutable.ListMap object QueryCompilerVisitor { val full: Schema ~> QueryCompiler = @@ -88,7 +89,6 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { QueryCompiler .typeCheck(NodeKind.Bool) { case b @ BooleanLiteral(_) => b } .map(_.value.value) - case PUnit => struct(shapeId, hints, Vector.empty, _ => ()) case PLong => checkRange(number)("int")(_.toLongExact) case PInt => checkRange(number)("int")(_.toIntExact) case PShort => checkRange(number)("short")(_.toShortExact) @@ -100,7 +100,7 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { (string, QueryCompiler.pos).tupled.emap { case (s, range) => Either .catchNonFatal(Base64.getDecoder().decode(s)) - .map(ByteArray(_)) + .map(Blob(_)) .leftMap(_ => CompilationError.error(CompilationErrorDetails.InvalidBlob, range)) .toIor .toIorNec @@ -223,34 +223,31 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { def default: Option[A] } - private val compileField: Schema ~> FieldCompiler = - new (Schema ~> FieldCompiler) { + private object FieldCompiler { - def apply[A]( - schema: Schema[A] - ): FieldCompiler[A] = - new FieldCompiler[A] { - def compiler: QueryCompiler[A] = schema.compile(QueryCompilerVisitorInternal) + def compile[A]( + field: Field[_, A] + ): FieldCompiler[A] = + new FieldCompiler[A] { + override val compiler: QueryCompiler[A] = field.schema.compile(QueryCompilerVisitorInternal) - def default: Option[A] = schema - .hints - .get(api.Default) - // Ignoring precise error, as this should generally be a Right _always_ due to smithy-level validation - .flatMap(v => Document.Decoder.fromSchema(schema).decode(v.value).toOption) + override val default: Option[A] = field.schema.getDefaultValue - } + } - } + } def struct[S]( shapeId: ShapeId, hints: Hints, - fieldsRaw: Vector[SchemaField[S, _]], + fieldsRaw: Vector[Field[S, _]], make: IndexedSeq[Any] => S, ): QueryCompiler[S] = { - val fields = fieldsRaw.map(_.mapK(compileField)) + val fields = fieldsRaw + .map(f => f.label -> FieldCompiler.compile(f)) + .to(ListMap) - val validFields = fields.map(_.label) + val validFields = fields val deprecatedFields = fieldsRaw.flatMap { f => f.hints.get(api.Deprecated).tupleLeft(f.label) @@ -259,21 +256,16 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { QueryCompiler .typeCheck(NodeKind.Struct) { case s @ Struct(_) => s } .emap { struct => - // this is a list to keep the original type's ordering - val remainingValidFields = - validFields - .filterNot( - struct.value.fields.value.keys.map(_.value.text).toSet - ) - .toList - val presentKeys = struct.value.fields.value.keys + // this is a list to keep the original type's ordering + val remainingValidFields = validFields -- presentKeys.map(_.value.text).toSet + val extraFieldErrors: QueryCompiler.Result[Unit] = presentKeys - .filterNot(field => validFields.contains_(field.value.text)) + .filterNot(field => validFields.keySet.contains_(field.value.text)) .map { unexpectedKey => CompilationError.error( - UnexpectedField(remainingValidFields), + UnexpectedField(remainingValidFields.keys.toList), unexpectedKey.range, ) } @@ -294,44 +286,60 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { .toBothLeft(()) .combine(Ior.right(())) - val buildStruct = fields - .parTraverse { field => - val fieldOpt = struct + def handleField[T]( + label: String, + field: FieldCompiler[T], + ): QueryCompiler.Result[T] = { + val fieldByName = + struct .value .fields .value - .byName(field.label)(_.value) - .parTraverse(field.instance.compiler.compile) - - if (field.isOptional) - fieldOpt - else - // Note: defaults get no special handling in dynamic schemas (in which a field with a default is considered optional). - // There's no real need to provide the default value in a dynamic client, as it can just omit the field in the request being sent. - // The server shall provide the default value on its own. - // This `orElse` fallback will arguably never be hit in practice, but it's here for completeness - just in case the compiler ends up being used with static services. - fieldOpt.map(_.orElse(field.instance.default)).flatMap { - _.toRightIor( - CompilationError.error( - MissingField(field.label), - struct.value.fields.range, - ) - ).toIorNec - } - } + .byName(label)(_.value) + + // Note: defaults get no special handling in dynamic schemas (in which a field with a default is considered optional). + // There's no real need to provide the default value in a dynamic client, as it can just omit the field in the request being sent. + // The server shall provide the default value on its own. + // This `orElse` fallback will arguably never be hit in practice, but it's here for completeness - just in case the compiler ends up being used with static + fieldByName + .parTraverse(field.compiler.compile) + .map(_.orElse(field.default)) + .flatMap { + _.toRightIor( + CompilationError.error( + MissingField(label), + struct.value.fields.range, + ) + ).toIorNec + } + } + + val buildStruct = fields + .toVector + .parTraverse { case (label, instance) => handleField(label, instance) } buildStruct.map(make) <& extraFieldErrors <& deprecatedFieldWarnings } - } def union[U]( shapeId: ShapeId, hints: Hints, - alternatives: Vector[Alt[Schema, U, _]], - dispatcher: Alt.Dispatcher[Schema, U], + alternatives: Vector[Alt[U, _]], + dispatcher: Alt.Dispatcher[U], ): QueryCompiler[U] = { - val alternativesCompiled = alternatives.map(_.mapK(this)).groupBy(_.label).map(_.map(_.head)) + def handleAlt[A]( + alt: Alt[U, A] + ): QueryCompiler[U] = alt + .schema + .compile(QueryCompilerVisitorInternal.this) + .map(alt.inject) + + val alternativesCompiled = alternatives + .groupByNev(_.label) + .fmap(_.head) + .fmap(handleAlt(_)) + val deprecatedAlternativeLabels = alternatives.flatMap(alt => alt.hints.get(api.Deprecated).tupleLeft(alt.label)).toMap @@ -345,10 +353,6 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { val definition = s.value.fields.value.head val key = definition.identifier - def go[A]( - alt: Alt[QueryCompiler, U, A] - ): QueryCompiler[U] = alt.instance.map(alt.inject) - val op = alternativesCompiled .get(key.value.text) @@ -372,7 +376,7 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { .toBothLeft(()) .combine(Ior.right(())) - op.flatMap(go(_).compile(definition.value)) <& deprecationWarning + op.flatMap(_.compile(definition.value)) <& deprecationWarning case s if s.value.fields.value.isEmpty => CompilationError @@ -454,9 +458,22 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { val string: QueryCompiler[String] = stringLiteral.map(_.value) - def enumeration[E]( + def option[A]( + schema: Schema[A] + ): QueryCompiler[Option[A]] = { + val underlying = schema.compile(this) + + in => + in.value match { + case NullLiteral() => None.rightIor + case _ => underlying.compile(in).map(Some(_)) + } + } + + override def enumeration[E]( shapeId: ShapeId, hints: Hints, + tag: EnumTag[E], values: List[EnumValue[E]], total: E => EnumValue[E], ): QueryCompiler[E] = (string, QueryCompiler.pos).tupled.emap { case (name, range) => diff --git a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala index fb5de0bc..e5817182 100644 --- a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala +++ b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala @@ -64,7 +64,7 @@ object AddDynamicRefinements extends (Schema ~> Schema) { case PBigInt => schema.reifyHint[api.Range] case PBigDecimal => schema.reifyHint[api.Range] case PBlob => schema.reifyHint[api.Length] - case PUnit | PTimestamp | PDocument | PBoolean | PUUID => schema + case PTimestamp | PDocument | PBoolean | PUUID => schema } case c: CollectionSchema[_, _] => collection(c) @@ -76,6 +76,7 @@ object AddDynamicRefinements extends (Schema ~> Schema) { case s: StructSchema[_] => s case l: LazySchema[_] => l case u: UnionSchema[_] => u + case n: OptionSchema[_] => n } } diff --git a/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala b/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala index 50ce4dff..f61baf0f 100644 --- a/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala +++ b/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala @@ -1,11 +1,14 @@ package playground.smithyutil +import smithy4s.schema.Alt +import smithy4s.schema.Field import smithy4s.schema.Schema import smithy4s.schema.Schema.BijectionSchema import smithy4s.schema.Schema.CollectionSchema import smithy4s.schema.Schema.EnumerationSchema import smithy4s.schema.Schema.LazySchema import smithy4s.schema.Schema.MapSchema +import smithy4s.schema.Schema.OptionSchema import smithy4s.schema.Schema.PrimitiveSchema import smithy4s.schema.Schema.RefinementSchema import smithy4s.schema.Schema.StructSchema @@ -21,16 +24,25 @@ final class TransitiveCompiler( fa: Schema[A] ): Schema[A] = fa match { - case e @ EnumerationSchema(_, _, _, _) => underlying(e) - case p @ PrimitiveSchema(_, _, _) => underlying(p) + case e @ EnumerationSchema(_, _, _, _, _) => underlying(e) + case p @ PrimitiveSchema(_, _, _) => underlying(p) case u @ UnionSchema(_, _, _, _) => - underlying(u.copy(alternatives = u.alternatives.map(_.mapK(this)))) + underlying(u.copy(alternatives = u.alternatives.map(handleAlt(_)))) case BijectionSchema(s, bijection) => underlying(BijectionSchema(this(s), bijection)) case LazySchema(suspend) => underlying(LazySchema(suspend.map(this.apply))) case RefinementSchema(s, refinement) => underlying(RefinementSchema(this(s), refinement)) case c @ CollectionSchema(_, _, _, _) => underlying(c.copy(member = this(c.member))) case m @ MapSchema(_, _, _, _) => underlying(m.copy(key = this(m.key), value = this(m.value))) - case s @ StructSchema(_, _, _, _) => underlying(s.copy(fields = s.fields.map(_.mapK(this)))) + case s @ StructSchema(_, _, _, _) => underlying(s.copy(fields = s.fields.map(handleField(_)))) + case n @ OptionSchema(_) => underlying(n.copy(underlying = this(n.underlying))) } + private def handleField[S, A]( + field: Field[S, A] + ): Field[S, A] = field.copy(schema = this(field.schema)) + + private def handleAlt[S, A]( + alt: Alt[S, A] + ): Alt[S, A] = alt.copy(schema = this(alt.schema)) + } diff --git a/modules/core/src/test/scala/playground/Diffs.scala b/modules/core/src/test/scala/playground/Diffs.scala index af51a0d6..da60e236 100644 --- a/modules/core/src/test/scala/playground/Diffs.scala +++ b/modules/core/src/test/scala/playground/Diffs.scala @@ -3,7 +3,7 @@ package playground import cats.data.Ior import playground.smithyql.ContextRange import playground.smithyql.NodeContext -import smithy4s.ByteArray +import smithy4s.Blob import scala.annotation.nowarn @@ -27,7 +27,7 @@ object Diffs { @nowarn("cat=unused") implicit def diffForIor[E: Diff, A: Diff]: Diff[Ior[E, A]] = Diff.derivedDiff - implicit val diffByteArray: Diff[ByteArray] = Diff[String].contramap(_.toString()) + implicit val diffByteArray: Diff[Blob] = Diff[String].contramap(_.toString()) implicit val diffDocument: Diff[smithy4s.Document] = Diff.derivedDiff implicit val diffTimestamp: Diff[smithy4s.Timestamp] = Diff[String].contramap(_.toString()) } diff --git a/modules/core/src/test/scala/playground/DynamicModel.scala b/modules/core/src/test/scala/playground/DynamicModel.scala index 926e7967..543bb2f9 100644 --- a/modules/core/src/test/scala/playground/DynamicModel.scala +++ b/modules/core/src/test/scala/playground/DynamicModel.scala @@ -13,7 +13,7 @@ object DynamicModel { .assemble() .unwrap() - DynamicSchemaIndex.loadModel(model).toTry.get + DynamicSchemaIndex.loadModel(model) } } diff --git a/modules/core/src/test/scala/playground/NodeEncoderTests.scala b/modules/core/src/test/scala/playground/NodeEncoderTests.scala index adbbc554..aa14e71f 100644 --- a/modules/core/src/test/scala/playground/NodeEncoderTests.scala +++ b/modules/core/src/test/scala/playground/NodeEncoderTests.scala @@ -3,14 +3,17 @@ package playground import cats.Id import demo.smithy.Good import demo.smithy.Hero +import demo.smithy.Person import demo.smithy.Power +import demo.smithy.SampleSparseList import playground.NodeEncoder import playground.smithyql.AST import playground.smithyql.DSL._ +import playground.smithyql.Listed import playground.smithyql.NullLiteral import playground.smithyql.StringLiteral import smithy.api.TimestampFormat -import smithy4s.ByteArray +import smithy4s.Blob import smithy4s.Document import smithy4s.Timestamp import smithy4s.schema.Schema @@ -50,6 +53,22 @@ object NodeEncoderTests extends FunSuite { assertEncodes(Good.schema, Good(42), struct("howGood" -> 42)) } + test("struct with optionals: defined") { + assertEncodes( + Person.schema, + Person("My name", age = Some(42)), + struct("name" -> "My name", "age" -> 42), + ) + } + + test("struct with optionals: empty") { + assertEncodes( + Person.schema, + Person("My name", age = None), + struct("name" -> "My name"), + ) + } + test("enum") { assertEncodes(Power.schema, Power.ICE, "ICE") } @@ -69,7 +88,7 @@ object NodeEncoderTests extends FunSuite { test("blob") { assertEncodes( Schema.bytes, - ByteArray("foo".getBytes()), + Blob("foo"), StringLiteral("Zm9v"), ) } @@ -81,4 +100,12 @@ object NodeEncoderTests extends FunSuite { NullLiteral(), ) } + + test("sparse list") { + assertEncodes( + SampleSparseList.schema, + SampleSparseList(List(Some(1), None, Some(3))), + Listed[Id](List(1, NullLiteral(), 3)), + ) + } } diff --git a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala index b0dc813e..3a1d880a 100644 --- a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala @@ -1,5 +1,6 @@ package playground.smithyql +import cats.Id import cats.Show import cats.data.Chain import cats.data.Ior @@ -22,6 +23,7 @@ import demo.smithy.Ints import demo.smithy.MyInstant import demo.smithy.Person import demo.smithy.Power +import demo.smithy.SampleSparseList import demo.smithy.StringWithLength import org.scalacheck.Arbitrary import playground.Assertions._ @@ -46,7 +48,7 @@ import playground.std.ClockGen import playground.std.RandomGen import playground.types.IorThrow import smithy.api.TimestampFormat -import smithy4s.ByteArray +import smithy4s.Blob import smithy4s.Document import smithy4s.Refinement import smithy4s.Service @@ -474,7 +476,7 @@ object CompilationTests extends SimpleIOSuite with Checkers { compile { WithSource.liftId("dGVzdA==".mapK(WithSource.liftId)) }(Schema.bytes), - Ior.right(ByteArray("test".getBytes())), + Ior.right(Blob("test".getBytes())), ) } @@ -780,6 +782,36 @@ object CompilationTests extends SimpleIOSuite with Checkers { ) } + pureTest("sparse list of ints") { + implicit val diffSSL: Diff[SampleSparseList] = Diff[List[Option[Int]]].contramap(_.value) + + assertNoDiff( + compile[SampleSparseList]( + WithSource.liftId(List[InputNode[Id]](1, NullLiteral(), 3).mapK(WithSource.liftId)) + ).leftMap(_.map(_.err)), + Ior.right( + SampleSparseList(List(Some(1), None, Some(3))) + ), + ) + } + + pureTest("sparse list of ints - dynamic") { + assert.same( + compile( + WithSource.liftId(List[InputNode[Id]](1, NullLiteral(), 3).mapK(WithSource.liftId)) + )(dynamicSchemaFor[SampleSparseList]).leftMap(_.map(_.err)), + Ior.right( + Document.array( + List( + Document.fromInt(1), + Document.nullDoc, + Document.fromInt(3), + ) + ) + ), + ) + } + pureTest("set of ints") { assert( compile[IntSet](WithSource.liftId(List(1, 2, 3).mapK(WithSource.liftId))) == Ior.right( diff --git a/modules/core/src/test/smithy/demo.smithy b/modules/core/src/test/smithy/demo.smithy index b0799872..af8c7695 100644 --- a/modules/core/src/test/smithy/demo.smithy +++ b/modules/core/src/test/smithy/demo.smithy @@ -67,7 +67,9 @@ structure CreateHeroInput { friendSet: FriendSet hasNewtypes: HasNewtypes hasDeprecations: HasDeprecations - doc: Document + doc: Document, + sparse: SampleSparseList, + sparseMap: SampleSparseMap } @uniqueItems @@ -146,6 +148,11 @@ enum Power { WIND = "Wind" } +intEnum PrivacyTier { + PUBLIC = 0 + PRIVATE = 1 +} + @http(method: "PUT", uri: "/subscriptions") @idempotent @documentation(""" @@ -257,3 +264,15 @@ structure HasMixin with [SampleMixin] { @required name: String } + + +@sparse +list SampleSparseList { + member: Integer +} + +@sparse +map SampleSparseMap { + key: String + value: Integer +} diff --git a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala index d3dc01a5..7ca8f8c7 100644 --- a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala +++ b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala @@ -21,6 +21,7 @@ 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._ @@ -92,7 +93,7 @@ object E2ETests extends SimpleIOSuite { .create() Resource - .make(IO(launcher.startListening()))(f => IO(f.cancel(true): Unit)) + .make(IO(launcher.startListening()).timeout(5.seconds))(f => IO(f.cancel(true): Unit)) .as(new LanguageServerAdapter(launcher.getRemoteProxy())) } } @@ -123,5 +124,6 @@ object E2ETests extends SimpleIOSuite { } } + .timeout(20.seconds) } } 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 56e1890c..8740b3d2 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionProvider.scala @@ -31,7 +31,7 @@ object CompletionProvider { def forSchemaIndex( dsi: DynamicSchemaIndex - ): CompletionProvider = forServices(dsi.allServices) + ): CompletionProvider = forServices(dsi.allServices.toList) def forServices( allServices: List[DynamicSchemaIndex.ServiceWrapper] @@ -70,6 +70,7 @@ object CompletionProvider { insertBodyStruct = insertBodyStruct, ) } + .toList } def completeRootOperationName( 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 4cc15da1..b8262c32 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -32,13 +32,13 @@ import smithy4s.Timestamp import smithy4s.dynamic.DynamicSchemaIndex import smithy4s.schema.Alt import smithy4s.schema.CollectionTag +import smithy4s.schema.EnumTag +import smithy4s.schema.EnumTag.IntEnum import smithy4s.schema.EnumValue import smithy4s.schema.Field import smithy4s.schema.Primitive import smithy4s.schema.Schema import smithy4s.schema.Schema._ -import smithy4s.schema.SchemaAlt -import smithy4s.schema.SchemaField import smithy4s.schema.SchemaVisitor import java.util.UUID @@ -102,6 +102,18 @@ object InsertText { object CompletionItem { + def forNull: CompletionItem = CompletionItem( + kind = CompletionItemKind.Constant, + label = "null", + insertText = InsertText.JustString("null"), + detail = ": null", + description = None, + deprecated = false, + docs = None, + extraTextEdits = Nil, + sortText = None, + ) + def useServiceClause( ident: QualifiedIdentifier, service: DynamicSchemaIndex.ServiceWrapper, @@ -115,29 +127,29 @@ object CompletionItem { ).copy(detail = describeService(service)) def fromField( - field: Field[Schema, _, _] + field: Field[_, _] ): CompletionItem = fromHints( kind = CompletionItemKind.Field, label = field.label, insertText = InsertText.JustString(s"${field.label}: "), - schema = field.instance, + schema = field.schema, ) def fromAlt( - alt: Alt[Schema, _, _] + alt: Alt[_, _] ): CompletionItem = fromHints( kind = CompletionItemKind.UnionMember, label = alt.label, // needs proper completions for the inner schema // https://github.com/kubukoz/smithy-playground/pull/120 insertText = - if (describeSchema(alt.instance).apply().startsWith("structure ")) + if (describeSchema(alt.schema).apply().startsWith("structure ")) InsertText.SnippetString(s"""${alt.label}: { | $$0 |},""".stripMargin) else InsertText.JustString(s"${alt.label}: "), - alt.instance, + alt.schema, ) def fromHints( @@ -200,7 +212,6 @@ object CompletionItem { case PByte => "byte" case PDouble => "double" case PShort => "short" - case PUnit => "unit" case PBigInt => "bigInteger" case PInt => "integer" case PUUID => "uuid" @@ -214,15 +225,21 @@ object CompletionItem { } } - private def describeCollection[C[_]]: CollectionTag[C] => String = { + private def describeCollection[C[_]]( + tag: CollectionTag[C], + hints: Hints, + ): String = { import smithy4s.schema.CollectionTag._ - { - case ListTag => "list" - case SetTag => "set" - case IndexedSeqTag => "@indexedSeq list" - case VectorTag => "@vector list" - } + val base = + tag match { + case ListTag => "list" + case SetTag => "set" + case IndexedSeqTag => "@indexedSeq list" + case VectorTag => "@vector list" + } + + sparseTraitDescription(hints).foldMap(_ + " ") + base } def describeService( @@ -237,18 +254,31 @@ object CompletionItem { schema match { case PrimitiveSchema(shapeId, _, tag) => now(s"${describePrimitive(tag)} ${shapeId.name}") - case Schema.CollectionSchema(shapeId, _, tag, member) => - now(s"${describeCollection(tag)} ${shapeId.name} { member: ${describeSchema(member)()} }") + case Schema.CollectionSchema(shapeId, hints, tag, member) => + now( + s"${describeCollection(tag, hints)} ${shapeId.name} { member: ${describeSchema(member)()} }" + ) - case EnumerationSchema(shapeId, _, _, _) => now(s"enum ${shapeId.name}") + case e @ EnumerationSchema(_, _, _, _, _) => + e.tag match { + case IntEnum() => now(s"intEnum ${e.shapeId.name}") + case _ => now(s"enum ${e.shapeId.name}") + } case MapSchema(shapeId, _, key, value) => - now(s"map ${shapeId.name} { key: ${key.shapeId.name}, value: ${value.shapeId.name} }") + now( + sparseTraitDescription(schema.hints).foldMap(_ + " ") + + s"map ${shapeId.name} { key: ${describeSchema(key)()}, value: ${describeSchema(value)()} }" + ) case StructSchema(shapeId, _, _, _) => now(s"structure ${shapeId.name}") case UnionSchema(shapeId, _, _, _) => now(s"union ${shapeId.name}") + case OptionSchema(underlying) => + // ignore the fact that it's nullable, just describe the underlying schema + describeSchema(underlying) + case LazySchema(suspend) => // we don't look at fields or whatnot, // so we can immediately evaluate the schema and compile it as usual. @@ -259,6 +289,10 @@ object CompletionItem { case BijectionSchema(underlying, _) => describeSchema(underlying) } + private def sparseTraitDescription( + hints: Hints + ): Option[String] = hints.get(api.Sparse).as("@sparse") + private def now( s: String ): ( @@ -495,9 +529,21 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { ) } + override def option[A]( + schema: Schema[A] + ): CompletionResolver[Option[A]] = { + val underlying = schema.compile(this) + + { + case p @ EmptyPath => underlying.getCompletions(p).appended(CompletionItem.forNull) + case more => underlying.getCompletions(more) + } + } + override def enumeration[E]( shapeId: ShapeId, hints: Hints, + tag: EnumTag[E], values: List[EnumValue[E]], total: E => EnumValue[E], ): CompletionResolver[E] = quoteAware { transformString => @@ -507,7 +553,7 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { CompletionItemKind.EnumMember, enumValue.name, InsertText.JustString(transformString(enumValue.name)), - Schema.enumeration(total, values).addHints(hints).withId(shapeId), + Schema.enumeration(total, tag, values).addHints(hints).withId(shapeId), ) } } @@ -527,16 +573,16 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { override def struct[S]( shapeId: ShapeId, hints: Hints, - fields: Vector[SchemaField[S, _]], + fields: Vector[Field[S, _]], make: IndexedSeq[Any] => S, ): CompletionResolver[S] = { - val compiledFields = fields.map(field => (field.mapK(this), field.instance)) + val compiledFields = fields.map(field => (field, field.schema.compile(this))) structLike( inBody = fields // todo: filter out present fields - .sortBy(field => (field.isRequired, field.label)) + .sortBy(field => (field.isStrictlyRequired, field.label)) .map(CompletionItem.fromField) .toList, inValue = @@ -546,20 +592,20 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { ) => compiledFields .collectFirst { - case (field, _) if field.label === h => field + case (field, instance) if field.label === h => instance } - .foldMap(_.instance.getCompletions(rest)), + .foldMap(_.getCompletions(rest)), ) } override def union[U]( shapeId: ShapeId, hints: Hints, - alternatives: Vector[SchemaAlt[U, _]], - dispatcher: Alt.Dispatcher[Schema, U], + alternatives: Vector[Alt[U, _]], + dispatcher: Alt.Dispatcher[U], ): CompletionResolver[U] = { - val allWithIds = alternatives.map { alt => - (alt.mapK(this), alt.instance) + val compiledAlts = alternatives.map { alt => + (alt, alt.schema.compile(this)) } structLike( @@ -568,7 +614,12 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { ( head, tail, - ) => allWithIds.find(_._1.label === head).toList.flatMap(_._1.instance.getCompletions(tail)), + ) => + compiledAlts + .collect { + case (alt, instance) if alt.label === head => instance + } + .foldMap(_.getCompletions(tail)), ) } 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 6f639bb2..53c4fdc7 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala @@ -26,16 +26,18 @@ object CompletionProviderTests extends SimpleIOSuite { Position(0), ) - val expected = RandomGen - .endpoints - .map(endpoint => - CompletionItem.forOperation( - insertUseClause = CompletionItem.InsertUseClause.Required, - endpoint, - QualifiedIdentifier.forService(RandomGen), - CompletionItem.InsertBodyStruct.Yes, - ) - ) + val expected = + RandomGen + .endpoints + .map { endpoint => + CompletionItem.forOperation( + insertUseClause = CompletionItem.InsertUseClause.Required, + endpoint, + QualifiedIdentifier.forService(RandomGen), + CompletionItem.InsertBodyStruct.Yes, + ) + } + .toList assertNoDiff(result, expected) } 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 b87da126..2a4b5d84 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionTests.scala @@ -12,6 +12,11 @@ import demo.smithy.MyInt import demo.smithy.MyString import demo.smithy.Power 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.smithyql.NodeContext import playground.smithyql.NodeContext.PathEntry._ import smithy.api.TimestampFormat @@ -115,6 +120,34 @@ object CompletionTests extends FunSuite { assert(completions.isEmpty) } + test("completions in sparse collection root contain null") { + val completions = getCompletions( + Schema.list(Schema.int.option), + NodeContext.EmptyPath.inCollectionEntry(None), + ) + + assertNoDiff( + completions, + List( + CompletionItem.forNull + ), + ) + } + + test("completions in sparse map root contain null") { + val completions = getCompletions( + Schema.map(Schema.string, Schema.int.option), + NodeContext.EmptyPath.inStructBody.inStructValue("test"), + ) + + assertNoDiff( + completions, + List( + CompletionItem.forNull + ), + ) + } + test("completions on struct in list are available") { val completions = getCompletions( Schema.list(Good.schema), @@ -126,6 +159,17 @@ object CompletionTests extends FunSuite { assert.eql(fieldNames, List("howGood")) } + test("completions on struct in sparse list are available") { + val completions = getCompletions( + Schema.list(Good.schema.option), + NodeContext.EmptyPath.inCollectionEntry(0.some).inStructBody, + ) + + val fieldNames = completions.map(_.label) + + assert.eql(fieldNames, List("howGood")) + } + test("completions on enum without quotes have quotes") { val completions = getCompletions(Power.schema, NodeContext.EmptyPath) @@ -288,10 +332,17 @@ object CompletionTests extends FunSuite { ) } + test("describe int enum") { + assert.eql( + CompletionItem.describeSchema(PrivacyTier.schema)(), + "intEnum PrivacyTier", + ) + } + test("describe map") { assert.eql( CompletionItem.describeSchema(PowerMap.schema)(), - "map PowerMap { key: Power, value: Hero }", + "map PowerMap { key: enum Power, value: union Hero }", ) } @@ -330,6 +381,26 @@ object CompletionTests extends FunSuite { ) } + test("describe sparse collection: sparse trait present") { + assert.eql( + CompletionItem.describeType( + isField = false, + SampleSparseList.schema, + ), + ": @sparse list SampleSparseList { member: integer Integer }", + ) + } + + test("describe sparse map: sparse trait present") { + assert.eql( + CompletionItem.describeType( + isField = false, + SampleSparseMap.schema, + ), + ": @sparse map SampleSparseMap { key: string String, value: integer Integer }", + ) + } + test("buildDocumentation: deprecation note goes before optionality note") { val doc = CompletionItem.buildDocumentation( isField = true, 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 23a0c3cc..d3e791f2 100644 --- a/modules/language-support/src/test/scala/playground/language/DiagnosticProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/DiagnosticProviderTests.scala @@ -3,6 +3,10 @@ package playground.language import alloy.SimpleRestJson import aws.protocols.AwsJson1_0 import aws.protocols.AwsJson1_1 +import aws.protocols.AwsQuery +import aws.protocols.Ec2Query +import aws.protocols.RestJson1 +import aws.protocols.RestXml import cats.data.NonEmptyList import cats.effect.IO import cats.effect.kernel.Resource @@ -60,6 +64,10 @@ object DiagnosticProviderTests extends SimpleIOSuite { SimpleRestJson, AwsJson1_0, AwsJson1_1, + RestJson1, + AwsQuery, + RestXml, + Ec2Query, Stdlib, ) .map(_.id) diff --git a/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala b/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala index f27e216b..e58f8f65 100644 --- a/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala +++ b/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala @@ -7,7 +7,6 @@ import fs2.io.file.Path import playground.PlaygroundConfig import playground.language.TextDocumentProvider import playground.language.Uri -import playground.lsp.util.SerializedSmithyModel import smithy4s.dynamic.DynamicSchemaIndex trait BuildLoader[F[_]] { @@ -101,7 +100,7 @@ object BuildLoader { for { specs <- filterImports(rawImportPaths) model <- loadModel(specs, loaded.config) - dsi <- DynamicSchemaIndex.loadModel(model).liftTo[F] + dsi = DynamicSchemaIndex.loadModel(model) } yield dsi } @@ -123,25 +122,9 @@ object BuildLoader { .emits(specs.toSeq) .flatMap(Files[F].walk(_)) .evalFilterNot(Files[F].isDirectory) - .evalFilter { file => - val isSmithyFile = file.extName === ".smithy" - - if (isSmithyFile) - true.pure[F] - else - isSerializedSmithyModelF(file) - } .compile .to(Set) - private def isSerializedSmithyModelF( - file: Path - ): F[Boolean] = Files[F] - .readAll(file) - .compile - .to(Array) - .map(SerializedSmithyModel.decode(_).isRight) - } } diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala index 4a5b7d37..b2e2881f 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala @@ -127,7 +127,7 @@ object LanguageServer { // see if we can pass this everywhere // https://github.com/kubukoz/smithy-playground/issues/164 - val serviceIndex: ServiceIndex = ServiceIndex.fromServices(dsi.allServices) + val serviceIndex: ServiceIndex = ServiceIndex.fromServices(dsi.allServices.toList) val compiler: FileCompiler[IorThrow] = FileCompiler .instance( diff --git a/modules/lsp/src/main/scala/playground/lsp/MainServer.scala b/modules/lsp/src/main/scala/playground/lsp/MainServer.scala index 36f33a45..a122d857 100644 --- a/modules/lsp/src/main/scala/playground/lsp/MainServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/MainServer.scala @@ -4,6 +4,7 @@ import cats.effect.implicits._ import cats.effect.kernel.Async import cats.effect.kernel.Resource import cats.effect.std +import fs2.compression.Compression import fs2.io.file.Files import fs2.io.net.Network import playground.TextDocumentManager @@ -14,7 +15,7 @@ import playground.TextDocumentManager */ object MainServer { - def makeServer[F[_]: LanguageClient: Async: Files: Network: std.Console] + def makeServer[F[_]: LanguageClient: Async: Files: Network: Compression: std.Console] : Resource[F, LanguageServer[F]] = TextDocumentManager .instance[F] .toResource diff --git a/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala b/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala index 5b623650..914a15ae 100644 --- a/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala +++ b/modules/lsp/src/main/scala/playground/lsp/ServerBuilder.scala @@ -5,6 +5,7 @@ import cats.effect.kernel.Async import cats.effect.kernel.Resource import cats.effect.std import cats.implicits._ +import fs2.compression.Compression import fs2.io.file.Files import fs2.io.net.Network import org.http4s.client.Client @@ -18,11 +19,8 @@ import playground.TextDocumentManager import playground.language.CommandResultReporter import playground.std.StdlibRuntime import smithy4s.aws.AwsEnvironment -import smithy4s.aws.http4s.AwsHttp4sBackend import smithy4s.aws.kernel.AwsRegion -import scala.concurrent.duration._ - trait ServerBuilder[F[_]] { def build( @@ -38,7 +36,7 @@ object ServerBuilder { implicit F: ServerBuilder[F] ): ServerBuilder[F] = F - def instance[F[_]: Async: LanguageClient: BuildLoader: Files: Network: std.Console] + def instance[F[_]: Async: LanguageClient: BuildLoader: Files: Network: Compression: std.Console] : Resource[F, ServerBuilder[F]] = { implicit val pluginResolver: PluginResolver[F] = PluginResolver.instance[F] @@ -62,9 +60,7 @@ object ServerBuilder { client <- makeClient awsEnv <- AwsEnvironment - .default(AwsHttp4sBackend(client), AwsRegion.US_EAST_1) - // workaround for https://github.com/disneystreaming/smithy4s/issues/1075... which doesn't actually work - .timeout(1.second) + .default(client, AwsRegion.US_EAST_1) .memoize tdm <- TextDocumentManager.instance[F].toResource } yield new ServerBuilder[F] { @@ -88,7 +84,7 @@ object ServerBuilder { plugins = plugins, ) - val serviceIndex = ServiceIndex.fromServices(dsi.allServices) + val serviceIndex = ServiceIndex.fromServices(dsi.allServices.toList) implicit val sl: ServerLoader[F] = loader diff --git a/modules/lsp/src/main/scala/playground/lsp/util/SerializedSmithyModel.scala b/modules/lsp/src/main/scala/playground/lsp/util/SerializedSmithyModel.scala deleted file mode 100644 index 0f12f988..00000000 --- a/modules/lsp/src/main/scala/playground/lsp/util/SerializedSmithyModel.scala +++ /dev/null @@ -1,21 +0,0 @@ -package playground.lsp.util - -import cats.implicits._ - -case class SerializedSmithyModel( - smithy: String -) - -object SerializedSmithyModel { - import com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec - import com.github.plokhotnyuk.jsoniter_scala.core._ - import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker - - private implicit val c: JsonValueCodec[SerializedSmithyModel] = JsonCodecMaker.make - - val decode: Array[Byte] => Either[Throwable, SerializedSmithyModel] = - bytes => - Either - .catchNonFatal(readFromArray[SerializedSmithyModel](bytes)) - -} diff --git a/project/plugins.sbt b/project/plugins.sbt index b6cbc9ac..43876a26 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -3,7 +3,8 @@ 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") -addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.17.11") +// try to keep in sync with smithy-build.json +addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.0") 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 1bdb8712..5b86edb3 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.7", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6", - "software.amazon.smithy:smithy-aws-traits:1.34.0" + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.0", + "software.amazon.smithy:smithy-aws-traits:1.39.1" ] } From f878c18246ccb3e8e828d80fff27c5b9c6da95dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Thu, 5 Oct 2023 22:21:24 +0200 Subject: [PATCH 026/114] Handle error tokens before whitespace/comments (#347) --- .../smithyql/parser/v2/scanner.scala | 48 +++++++++++-------- .../smithyql/parser/v2/ScannerTests.scala | 13 +++++ 2 files changed, 40 insertions(+), 21 deletions(-) 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 229953ae..19946228 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 @@ -179,39 +179,45 @@ object Scanner { } } - def eatWhitespace( - ) = { - val (wsp, rest) = remaining.span(ch => ch.isWhitespace) - if (wsp.isEmpty()) - false - else { + val eatWhitespace: PartialFunction[Unit, Unit] = { + object matches { + def unapply( + @nowarn("cat=unused") u: Unit + ): Option[ + ( + String, + String, + ) + ] = { + val (wsp, rest) = remaining.span(ch => ch.isWhitespace) + if (wsp.isEmpty()) + None + else + Some((wsp, rest)) + } + } + + { case matches(wsp, rest) => whitespaceChains(wsp).foreach(add) remaining = rest - - true } } - def eatComments( - ) = - if (!remaining.startsWith("//")) - false - else { + val eatComments: PartialFunction[Unit, Unit] = { + case _ if remaining.startsWith("//") => while (remaining.startsWith("//")) { val (comment, rest) = remaining.span(_ != '\n') add(TokenKind.COMMENT(comment)) remaining = rest } + } - true - } + val readAny = readOne.orElse(eatWhitespace).orElse(eatComments) def eatErrors( ) = { - // todo: bug: even if the next character starts a multi-char token, this will consider it an error. - // instead, we should rework "readOne" to consume arbitrary constant-length tokens, and also include the possibility that `rest` has comments or whitespace. val (failures, _) = remaining.span { _ => - if (readOne.isDefinedAt(())) + if (readAny.isDefinedAt(())) // this will match. stop! false else { @@ -231,9 +237,9 @@ object Scanner { while (remaining.nonEmpty) { val last = remaining - readOne.lift(()).isDefined || - eatWhitespace() || - eatComments() || + readAny + .lift(()) + .isDefined || eatErrors(): Unit // last-effort sanity check 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 7009f55f..7b746be0 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 @@ -208,6 +208,19 @@ object ScannerTests extends SimpleIOSuite with Checkers with ScannerSuite { ) ) + scanTest(explicitName = "Error tokens before a comment", input = "--//hello")( + List( + Error("--"), + COMMENT("//hello"), + ) + ) + + scanTest(explicitName = "Error tokens before whitespace", input = "-- ")( + List( + Error("--"), + SPACE(" "), + ) + ) // complex cases scanTestReverse( From 3019d07f6ad2fd2d5c4be5e6b6e905d0a6808a75 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 6 Oct 2023 15:55:34 +0000 Subject: [PATCH 027/114] Update alloy-core to 0.2.8 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index ce3c7270..8cd07e73 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.7" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.2.8" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.39.1" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 dbd4843b..a2102f0d 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.7", + "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.17.6" ] } diff --git a/smithy-build.json b/smithy-build.json index 5b86edb3..aa1ca5f6 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.2.7", + "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" ] From c38d6a0b898d471d330872596f1add7e6f161e8c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 6 Oct 2023 15:55:45 +0000 Subject: [PATCH 028/114] Update jsoniter-scala-macros to 2.24.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ce3c7270..47493129 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.2", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.23.5", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.1", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From eaca64f6a9ef028c4ded94b236e0a12a7c8b2f0d Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 16 Oct 2023 22:13:45 +0000 Subject: [PATCH 029/114] Update smithy4s-aws-http4s, ... to 0.18.2 --- smithy-build.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smithy-build.json b/smithy-build.json index aa1ca5f6..c6c95741 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.0", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", "software.amazon.smithy:smithy-aws-traits:1.39.1" ] } From 6d7b769e1f5aa6ad2dcb71a8df4cd40cd1488d16 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 18 Oct 2023 18:53:03 +0000 Subject: [PATCH 030/114] Update smithy-aws-traits to 1.40.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index daaa7ab2..0be989d4 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "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, + "software.amazon.smithy" % "smithy-aws-traits" % "1.40.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index c6c95741..31b194c7 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", - "software.amazon.smithy:smithy-aws-traits:1.39.1" + "software.amazon.smithy:smithy-aws-traits:1.40.0" ] } From 0eb3b0038ba98202c556e4d715d20503f6babffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Wed, 18 Oct 2023 23:21:38 +0200 Subject: [PATCH 031/114] bump smithy-build --- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..dcb2b350 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 @@ -2,6 +2,6 @@ "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.smithy4s:smithy4s-protocol:0.18.2" ] } From 981e1b3ea081bf6fc050e24862c8882911909679 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:20:36 +0000 Subject: [PATCH 032/114] Bump actions/checkout from 3.5.3 to 4.1.1 Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 4.1.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3.5.3...v4.1.1) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- .github/workflows/dependency-graph.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 668103b8..d73e4efd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@v3.5.3 + - uses: actions/checkout@v4.1.1 - uses: cachix/install-nix-action@v22 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 From e4d2e9c62f846683c11bd3b84b4174421b8a4567 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 26 Oct 2023 19:14:25 +0000 Subject: [PATCH 033/114] Update jsoniter-scala-macros to 2.24.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 0be989d4..f15fa82c 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ 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", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.2", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From f8a49aab9cf0b7a33780ef316dacb5633154884a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 26 Oct 2023 19:14:50 +0000 Subject: [PATCH 034/114] Update cats-mtl to 1.4.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 0be989d4..180384b2 100644 --- a/build.sbt +++ b/build.sbt @@ -44,7 +44,7 @@ val commonSettings = Seq( organization := "com.kubukoz.playground", libraryDependencies ++= Seq( "org.typelevel" %% "cats-core" % "2.10.0", - "org.typelevel" %% "cats-mtl" % "1.3.1", + "org.typelevel" %% "cats-mtl" % "1.4.0", "com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test, "com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test, "com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test, From 3f3261a1e3a8db8ba66aaa2501a9a0b56bfb70d7 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 28 Oct 2023 15:50:07 +0000 Subject: [PATCH 035/114] Update jsoniter-scala-macros to 2.24.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a653897a..672c74ab 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ 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.2", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From b9aef1ceb01d5056fdca22675ac0dac47600c189 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 30 Oct 2023 15:37:02 +0000 Subject: [PATCH 036/114] Update jsoniter-scala-macros to 2.24.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 672c74ab..5cf81f30 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ 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.3", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.24.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 6c0614527c32f60717f8bfd661c0ea49967a34bb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 7 Nov 2023 22:23:55 +0000 Subject: [PATCH 037/114] Update fs2-io to 3.9.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5cf81f30..4ce2dede 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "org.typelevel" %% "cats-parse" % "0.3.10", "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.9.3" % Test, ) ) .dependsOn( From e52e2e1311f0d966141675f93eec55ca1d9611a2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 11 Nov 2023 18:25:00 +0000 Subject: [PATCH 038/114] Update smithy-aws-traits to 1.41.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 4ce2dede..b16a9a2a 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "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.40.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.41.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index 31b194c7..b44e31ad 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", - "software.amazon.smithy:smithy-aws-traits:1.40.0" + "software.amazon.smithy:smithy-aws-traits:1.41.0" ] } From 479f936bec5004c6d36adabef35a138d7d0ae222 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 17 Nov 2023 20:02:04 +0000 Subject: [PATCH 039/114] Update smithy-aws-traits to 1.41.1 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index b16a9a2a..fc24af7c 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "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.41.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.41.1" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index b44e31ad..8afc9c2f 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", - "software.amazon.smithy:smithy-aws-traits:1.41.0" + "software.amazon.smithy:smithy-aws-traits:1.41.1" ] } From f9825343362721d0c0026b8fdd919901d91e9a96 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 23 Nov 2023 18:26:35 +0000 Subject: [PATCH 040/114] Update coursier to 2.1.8 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index fc24af7c..5cb935e5 100644 --- a/build.sbt +++ b/build.sbt @@ -156,7 +156,7 @@ lazy val lsp = module("lsp") "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", + "io.get-coursier" %% "coursier" % "2.1.8", "org.typelevel" %% "cats-tagless-core" % "0.15.0", ), buildInfoPackage := "playground.lsp.buildinfo", From f385e30aec3a76326ccc4fe72c46d59e922382bc Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 1 Dec 2023 17:22:24 +0000 Subject: [PATCH 041/114] Update jsoniter-scala-macros to 2.25.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5cb935e5..ff2bcf1e 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ 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.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.25.0", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 1665662792777850def6a6f9e633401500006a37 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 9 Dec 2023 16:13:34 +0000 Subject: [PATCH 042/114] Update smithy-aws-traits to 1.42.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index ff2bcf1e..29251bf7 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "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.41.1" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.42.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index 8afc9c2f..0f8d4059 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", - "software.amazon.smithy:smithy-aws-traits:1.41.1" + "software.amazon.smithy:smithy-aws-traits:1.42.0" ] } From afad267df27771c1f754b6bcd8717dd8cf4c6900 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 12 Jan 2024 22:54:22 +0000 Subject: [PATCH 043/114] Update jsoniter-scala-macros to 2.27.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 29251bf7..dcb3f536 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.2", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.25.0", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.2", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 58c14ffc1726c86501e29076eccdb28a0b5b84c3 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 12 Jan 2024 22:54:43 +0000 Subject: [PATCH 044/114] Update org.eclipse.lsp4j to 0.21.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 29251bf7..0596272c 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ 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.21.2", "io.circe" %% "circe-core" % "0.14.6", "org.http4s" %% "http4s-ember-client" % "0.23.23", "org.http4s" %% "http4s-ember-server" % "0.23.23" % Test, From e6ba40ee2d1a7a5ae633b303fa50e74ff4c76dec Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 12 Jan 2024 22:55:17 +0000 Subject: [PATCH 045/114] Update smithy-aws-traits to 1.43.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 29251bf7..5cf9c2a5 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "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.42.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.43.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index 0f8d4059..7f4db7d2 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", - "software.amazon.smithy:smithy-aws-traits:1.42.0" + "software.amazon.smithy:smithy-aws-traits:1.43.0" ] } From 8713db5ab9022b94d875c3c79a844b9c2ca1573b Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 15 Jan 2024 12:26:14 +0000 Subject: [PATCH 046/114] Update jsoniter-scala-macros to 2.27.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index efe37925..1fe5e695 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.2", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.2", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 888755b2203d3e9720c06af00adee79733d34d6e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 16 Jan 2024 18:00:00 +0000 Subject: [PATCH 047/114] Update cats-effect to 3.5.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 1fe5e695..bc902563 100644 --- a/build.sbt +++ b/build.sbt @@ -124,7 +124,7 @@ lazy val formatter = module("formatter") lazy val core = module("core") .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "cats-effect" % "3.5.2", + "org.typelevel" %% "cats-effect" % "3.5.3", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, From 1d4325db4593e0a7d9dff0246a8b2a4cd597eb63 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 22 Jan 2024 18:05:21 +0000 Subject: [PATCH 048/114] Update fs2-io to 3.9.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index bc902563..bd37d85b 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "org.typelevel" %% "cats-parse" % "0.3.10", "io.circe" %% "circe-generic" % "0.14.6" % Test, "io.circe" %% "circe-parser" % "0.14.6" % Test, - "co.fs2" %% "fs2-io" % "3.9.3" % Test, + "co.fs2" %% "fs2-io" % "3.9.4" % Test, ) ) .dependsOn( From bdf40b7e37822124bec7ed7da4c7e74e7b4b2bf6 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 22 Jan 2024 18:05:31 +0000 Subject: [PATCH 049/114] Update jsoniter-scala-macros to 2.27.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index bc902563..f7c4e4ab 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.3", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.3", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 5a0a7ddf419a66ef7c1210c16c298512ab991553 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 24 Jan 2024 17:04:46 +0000 Subject: [PATCH 050/114] Update jsoniter-scala-macros to 2.27.5 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 399e5cd5..5b424fdf 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.3", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.5", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 7ddd5514d02d87a8a3edd5002b1f4b7507062eb2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 26 Jan 2024 16:26:48 +0000 Subject: [PATCH 051/114] Update weaver-cats, weaver-discipline, ... to 0.8.4 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 5b424fdf..19d592fe 100644 --- a/build.sbt +++ b/build.sbt @@ -45,9 +45,9 @@ val commonSettings = Seq( libraryDependencies ++= Seq( "org.typelevel" %% "cats-core" % "2.10.0", "org.typelevel" %% "cats-mtl" % "1.4.0", - "com.disneystreaming" %% "weaver-cats" % "0.8.3" % Test, - "com.disneystreaming" %% "weaver-discipline" % "0.8.3" % Test, - "com.disneystreaming" %% "weaver-scalacheck" % "0.8.3" % Test, + "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, ), From 925a846316b413107eede9286a444a88029ded59 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 26 Jan 2024 16:26:58 +0000 Subject: [PATCH 052/114] Update jsoniter-scala-macros to 2.27.7 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5b424fdf..c193ad08 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.3", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.5", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.7", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From be96ed80d38369caa79c2e6abc23e79f084a4179 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 30 Jan 2024 16:26:29 +0000 Subject: [PATCH 053/114] Update jsoniter-scala-macros to 2.28.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a2dc37b9..c7cabfba 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.3", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.27.7", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.0", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 9d4d287b860014fe8acdd7701ebd0d1eb717cccf Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 19 Feb 2024 22:33:26 +0000 Subject: [PATCH 054/114] Update jsoniter-scala-macros to 2.28.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c7cabfba..ee586b3d 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.3", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.0", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.2", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From ec9863cf1518386a7224acbbc9b0fffc7bfc75dd Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 19 Feb 2024 22:33:46 +0000 Subject: [PATCH 055/114] Update coursier to 2.1.9 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c7cabfba..1f179a7b 100644 --- a/build.sbt +++ b/build.sbt @@ -156,7 +156,7 @@ lazy val lsp = module("lsp") "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.8", + "io.get-coursier" %% "coursier" % "2.1.9", "org.typelevel" %% "cats-tagless-core" % "0.15.0", ), buildInfoPackage := "playground.lsp.buildinfo", From 1798a9de0842abf9ed2560dd4e02bbdd9dca35e4 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 19 Feb 2024 22:34:15 +0000 Subject: [PATCH 056/114] Update smithy-aws-traits to 1.45.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index c7cabfba..d4f25966 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "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.43.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index 7f4db7d2..8e5362c8 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", - "software.amazon.smithy:smithy-aws-traits:1.43.0" + "software.amazon.smithy:smithy-aws-traits:1.45.0" ] } From 60955c876b873d694f0598bfb3d5321faa0298b6 Mon Sep 17 00:00:00 2001 From: msosnicki Date: Wed, 21 Feb 2024 18:55:13 +0100 Subject: [PATCH 057/114] Add support for dynamic enum validation (#384) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for dynamic enum validation * We don't need no casting --------- Co-authored-by: Jakub Kozłowski --- build.sbt | 6 +-- .../smithyutil/AddDynamicRefinements.scala | 11 +++- .../smithyql/CompilationTests.scala | 52 +++++++++++++++++++ modules/core/src/test/smithy/demo.smithy | 25 +++++++++ project/plugins.sbt | 2 +- smithy-build.json | 2 +- 6 files changed, 91 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 3045860b..eaf9035b 100644 --- a/build.sbt +++ b/build.sbt @@ -95,7 +95,7 @@ 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.4" % Test, @@ -154,8 +154,8 @@ lazy val lsp = module("lsp") libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.2", "io.circe" %% "circe-core" % "0.14.6", - "org.http4s" %% "http4s-ember-client" % "0.23.23", - "org.http4s" %% "http4s-ember-server" % "0.23.23" % Test, + "org.http4s" %% "http4s-ember-client" % "0.23.25", + "org.http4s" %% "http4s-ember-server" % "0.23.25" % Test, "io.get-coursier" %% "coursier" % "2.1.9", "org.typelevel" %% "cats-tagless-core" % "0.15.0", ), diff --git a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala index e5817182..a91aecb0 100644 --- a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala +++ b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala @@ -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/test/scala/playground/smithyql/CompilationTests.scala b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala index 3a1d880a..4a5c9327 100644 --- a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala @@ -11,6 +11,7 @@ import com.softwaremill.diffx.Diff 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 @@ -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 diff --git a/modules/core/src/test/smithy/demo.smithy b/modules/core/src/test/smithy/demo.smithy index af8c7695..80f04d05 100644 --- a/modules/core/src/test/smithy/demo.smithy +++ b/modules/core/src/test/smithy/demo.smithy @@ -228,6 +228,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/project/plugins.sbt b/project/plugins.sbt index 43876a26..390e4710 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,7 +4,7 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.11") addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.3") // 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.8") 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 8e5362c8..4a732538 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.2.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.8", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] } From 88cae7ed08a987bc9c87f0071574a443aeaf52eb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 21 Feb 2024 21:41:52 +0000 Subject: [PATCH 058/114] Update alloy-core to 0.3.0 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index eaf9035b..5acfa987 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.0" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 dcb2b350..fa37646e 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.alloy:alloy-core:0.3.0", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" ] } diff --git a/smithy-build.json b/smithy-build.json index 4a732538..f34994dc 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.2.8", + "com.disneystreaming.alloy:alloy-core:0.3.0", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.8", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] From 89ea01f17dd8808daaa00590668015b7e01c3dba Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 25 Feb 2024 19:08:24 +0000 Subject: [PATCH 059/114] Update kind-projector to 0.13.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5acfa987..506e0824 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ 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") From d43c8bf0682cc945412c577808323e7e08cfc2e8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 27 Feb 2024 21:59:35 +0000 Subject: [PATCH 060/114] Update smithy4s-aws-http4s, ... to 0.18.9 --- smithy-build.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smithy-build.json b/smithy-build.json index f34994dc..230ec133 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.0", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.8", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] } From 6d5030d8688e4b00f7752a6651e79b2afdfc1776 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 27 Feb 2024 21:59:56 +0000 Subject: [PATCH 061/114] Update org.eclipse.lsp4j to 0.22.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 506e0824..4536fd2e 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ lazy val languageSupport = module("language-support") lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( - "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.2", + "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.22.0", "io.circe" %% "circe-core" % "0.14.6", "org.http4s" %% "http4s-ember-client" % "0.23.25", "org.http4s" %% "http4s-ember-server" % "0.23.25" % Test, From 6dd8a0a8f148a4b24c59b0113de7005d34e08ffe Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 29 Feb 2024 18:03:42 +0000 Subject: [PATCH 062/114] Update alloy-core to 0.3.1 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 506e0824..1e3ddfb8 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.0" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.1" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 fa37646e..8800e2d2 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.3.0", + "com.disneystreaming.alloy:alloy-core:0.3.1", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" ] } diff --git a/smithy-build.json b/smithy-build.json index 230ec133..0a530862 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.0", + "com.disneystreaming.alloy:alloy-core:0.3.1", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] From a2a8b91afa310f5965a6db2ba4e0fd7cbd096c50 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 2 Mar 2024 18:36:25 +0000 Subject: [PATCH 063/114] Update alloy-core to 0.3.2 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 1e3ddfb8..1d98a777 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.1" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.2" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 8800e2d2..b129c8d9 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.3.1", + "com.disneystreaming.alloy:alloy-core:0.3.2", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" ] } diff --git a/smithy-build.json b/smithy-build.json index 0a530862..b50562b3 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.1", + "com.disneystreaming.alloy:alloy-core:0.3.2", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] From 9f965482acd3fe2a7d0e2bb46d07f0ead49be255 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 2 Mar 2024 18:36:41 +0000 Subject: [PATCH 064/114] Update jsoniter-scala-macros to 2.28.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 1e3ddfb8..de3444f4 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.3", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.2", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From d4c291ef8c340ada7c424dd4e241fc1abf0b6280 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 6 Mar 2024 18:03:55 +0000 Subject: [PATCH 065/114] Update http4s-ember-client, ... to 0.23.26 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index f4c7a600..c70fad7b 100644 --- a/build.sbt +++ b/build.sbt @@ -154,8 +154,8 @@ lazy val lsp = module("lsp") libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.21.2", "io.circe" %% "circe-core" % "0.14.6", - "org.http4s" %% "http4s-ember-client" % "0.23.25", - "org.http4s" %% "http4s-ember-server" % "0.23.25" % Test, + "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.15.0", ), From 9b52395b92f1cbd015d90428b85ce33af71844c0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 6 Mar 2024 18:04:06 +0000 Subject: [PATCH 066/114] Update cats-effect to 3.5.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index f4c7a600..38cd2455 100644 --- a/build.sbt +++ b/build.sbt @@ -124,7 +124,7 @@ lazy val formatter = module("formatter") lazy val core = module("core") .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "cats-effect" % "3.5.3", + "org.typelevel" %% "cats-effect" % "3.5.4", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, From a5f43608edfeae30871fc09e020284619e0d69fa Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 8 Mar 2024 17:54:49 +0000 Subject: [PATCH 067/114] Update jsoniter-scala-macros to 2.28.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4660f614..9d3992e0 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.3", + "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, From d979b17a8d8d83e21a8d52870068ad5c5b5fbf94 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 14 Mar 2024 17:13:47 +0000 Subject: [PATCH 068/114] Update alloy-core to 0.3.4 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 9d3992e0..13ddb860 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.2" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.4" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 b129c8d9..58393bc2 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.3.2", + "com.disneystreaming.alloy:alloy-core:0.3.4", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" ] } diff --git a/smithy-build.json b/smithy-build.json index b50562b3..5e158860 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.2", + "com.disneystreaming.alloy:alloy-core:0.3.4", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] From f079759ccff782ff674f7e5dd2b8b28a4c3fb8b7 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 18 Mar 2024 17:27:57 +0000 Subject: [PATCH 069/114] Update fs2-io to 3.10.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 13ddb860..dc638860 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "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.4" % Test, + "co.fs2" %% "fs2-io" % "3.10.0" % Test, ) ) .dependsOn( From 115e91c234bd0a01a183f80549e56a15950ca220 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 26 Mar 2024 17:20:57 +0000 Subject: [PATCH 070/114] Update fs2-io to 3.10.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index dc638860..53658386 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "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.10.0" % Test, + "co.fs2" %% "fs2-io" % "3.10.1" % Test, ) ) .dependsOn( From 216c69ec91c2449dd344256454b11efc33b3820a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 28 Mar 2024 17:33:22 +0000 Subject: [PATCH 071/114] Update fs2-io to 3.10.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 53658386..313ef642 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,7 @@ lazy val parser = module("parser") "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.10.1" % Test, + "co.fs2" %% "fs2-io" % "3.10.2" % Test, ) ) .dependsOn( From ead7862418457106e9e2c1fc02fe59429094dfa0 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 30 Mar 2024 18:38:15 +0000 Subject: [PATCH 072/114] Update alloy-core to 0.3.5 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 313ef642..8a8cb288 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.4" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.5" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 58393bc2..196ee10b 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.3.4", + "com.disneystreaming.alloy:alloy-core:0.3.5", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" ] } diff --git a/smithy-build.json b/smithy-build.json index 5e158860..5c6e6685 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.4", + "com.disneystreaming.alloy:alloy-core:0.3.5", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] From fb782259ab6b0c79c65062cf6a984d6412ca439e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 8 Apr 2024 15:28:56 +0000 Subject: [PATCH 073/114] Update alloy-core to 0.3.6 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 8a8cb288..d9e58891 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.5" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.6" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 196ee10b..65ec8e62 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.3.5", + "com.disneystreaming.alloy:alloy-core:0.3.6", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" ] } diff --git a/smithy-build.json b/smithy-build.json index 5c6e6685..d604b4a0 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.5", + "com.disneystreaming.alloy:alloy-core:0.3.6", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", "software.amazon.smithy:smithy-aws-traits:1.45.0" ] From 8fa81a7c318a512dc711dc5374fa698bacd53efe Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 8 Apr 2024 15:29:17 +0000 Subject: [PATCH 074/114] Update cats-tagless-core to 0.16.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 8a8cb288..7a995abb 100644 --- a/build.sbt +++ b/build.sbt @@ -157,7 +157,7 @@ lazy val lsp = module("lsp") "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.15.0", + "org.typelevel" %% "cats-tagless-core" % "0.16.0", ), buildInfoPackage := "playground.lsp.buildinfo", buildInfoKeys ++= Seq(version, scalaBinaryVersion), From 0666329b5129a0b1932481706868b0635e7d0126 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 9 Apr 2024 16:01:42 +0000 Subject: [PATCH 075/114] Update smithy-aws-traits to 1.47.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 3672edf0..b34f4af7 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test, "com.disneystreaming.alloy" % "alloy-core" % "0.3.6" % Test, - "software.amazon.smithy" % "smithy-aws-traits" % "1.45.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.47.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index d604b4a0..b34684b4 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.6", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", - "software.amazon.smithy:smithy-aws-traits:1.45.0" + "software.amazon.smithy:smithy-aws-traits:1.47.0" ] } From eff0dc76ad0eef9eb7136a4f3099c8b29c2033a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Apr 2024 00:12:16 +0200 Subject: [PATCH 076/114] bump smithy4s/alloy --- .../test/scala/playground/smithyql/CompilationTests.scala | 2 +- .../test/scala/playground/language/CompletionTests.scala | 6 +++--- .../resources/test-workspaces/default/smithy-build.json | 2 +- project/plugins.sbt | 7 ++++++- smithy-build.json | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala index 4a5c9327..3b7d5d4d 100644 --- a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala @@ -817,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/language-support/src/test/scala/playground/language/CompletionTests.scala b/modules/language-support/src/test/scala/playground/language/CompletionTests.scala index 2a4b5d84..dedb1ee5 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionTests.scala @@ -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/lsp/src/test/resources/test-workspaces/default/smithy-build.json b/modules/lsp/src/test/resources/test-workspaces/default/smithy-build.json index 65ec8e62..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 @@ -2,6 +2,6 @@ "imports": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.6", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.2" + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15" ] } diff --git a/project/plugins.sbt b/project/plugins.sbt index 390e4710..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.8") +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 b34684b4..db696f47 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.6", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.9", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15", "software.amazon.smithy:smithy-aws-traits:1.47.0" ] } From b4c901f6dba2ebca2dd4afddd4b31874f193f620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Apr 2024 00:14:20 +0200 Subject: [PATCH 077/114] Add missing WorkspaceFolder param --- modules/e2e/src/test/scala/playground/e2e/E2ETests.scala | 9 ++++++--- .../lsp/harness/LanguageServerIntegrationTests.scala | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala index 7ca8f8c7..660664d9 100644 --- a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala +++ b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala @@ -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/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala b/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala index fd6b0607..6a898c2d 100644 --- a/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala +++ b/modules/lsp/src/test/scala/playground/lsp/harness/LanguageServerIntegrationTests.scala @@ -24,7 +24,7 @@ trait LanguageServerIntegrationTests { ): InitializeParams = new InitializeParams().tap( _.setWorkspaceFolders( List( - new WorkspaceFolder(workspaceDir.value) + new WorkspaceFolder(workspaceDir.value, "test-workspace") ).asJava ) ) From c21499967626d65e124e53bd2e34c4536d53a29e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Apr 2024 00:21:14 +0200 Subject: [PATCH 078/114] bump scala --- build.sbt | 4 ++-- modules/core/src/main/scala/playground/FileCompiler.scala | 1 - modules/core/src/main/scala/playground/FileRunner.scala | 1 - modules/core/src/main/scala/playground/PreludeCompiler.scala | 1 - .../main/scala/playground/language/CompletionVisitor.scala | 2 +- .../src/main/scala/playground/language/Uri.scala | 5 ++++- .../main/scala/playground/smithyql/parser/v2/scanner.scala | 1 - 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index c37e1feb..e5b3fe27 100644 --- a/build.sbt +++ b/build.sbt @@ -34,8 +34,8 @@ 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 := "-" diff --git a/modules/core/src/main/scala/playground/FileCompiler.scala b/modules/core/src/main/scala/playground/FileCompiler.scala index 105b45c9..8e2afaa0 100644 --- a/modules/core/src/main/scala/playground/FileCompiler.scala +++ b/modules/core/src/main/scala/playground/FileCompiler.scala @@ -1,7 +1,6 @@ package playground import cats.Parallel -import cats.effect.implicits._ import cats.implicits._ import cats.~> import playground._ diff --git a/modules/core/src/main/scala/playground/FileRunner.scala b/modules/core/src/main/scala/playground/FileRunner.scala index 35738bb7..acf5bb9d 100644 --- a/modules/core/src/main/scala/playground/FileRunner.scala +++ b/modules/core/src/main/scala/playground/FileRunner.scala @@ -1,7 +1,6 @@ package playground import cats.data.NonEmptyList -import cats.effect.implicits._ import cats.implicits._ import playground._ import playground.smithyql.SourceFile diff --git a/modules/core/src/main/scala/playground/PreludeCompiler.scala b/modules/core/src/main/scala/playground/PreludeCompiler.scala index b98e6e61..ae1a23dc 100644 --- a/modules/core/src/main/scala/playground/PreludeCompiler.scala +++ b/modules/core/src/main/scala/playground/PreludeCompiler.scala @@ -3,7 +3,6 @@ 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._ 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 b8262c32..2cf78414 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -582,7 +582,7 @@ object CompletionVisitor extends SchemaVisitor[CompletionResolver] { inBody = 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/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/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 From d74fb10a52512616dedadfe420e6bd265769ac78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Apr 2024 00:21:59 +0200 Subject: [PATCH 079/114] unused import --- modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala index b2e2881f..ce967389 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala @@ -3,7 +3,6 @@ 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 From 4d7966cd432111dba09fa3426d6800c34568bde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Apr 2024 00:32:52 +0200 Subject: [PATCH 080/114] Move imports to new syntax + change cats imports --- build.sbt | 2 +- .../main/scala/playground/smithyql/AST.scala | 2 +- .../main/scala/playground/smithyql/DSL.scala | 2 +- .../test/scala/playground/Assertions.scala | 4 ++-- .../scala/playground/CompilationError.scala | 7 ++++--- .../playground/DynamicServiceProxy.scala | 4 ++-- .../main/scala/playground/FileCompiler.scala | 4 ++-- .../main/scala/playground/FileRunner.scala | 4 ++-- .../src/main/scala/playground/IorUtils.scala | 2 +- .../playground/MultiServiceResolver.scala | 2 +- .../scala/playground/NodeEncoderVisitor.scala | 4 ++-- .../scala/playground/OperationCompiler.scala | 10 +++++----- .../scala/playground/OperationRunner.scala | 10 +++++----- .../scala/playground/PlaygroundConfig.scala | 4 ++-- .../scala/playground/PreludeCompiler.scala | 6 +++--- .../main/scala/playground/QueryCompiler.scala | 6 +++--- .../playground/QueryCompilerVisitor.scala | 12 +++++------ .../main/scala/playground/ServiceIndex.scala | 4 ++-- .../playground/ServiceNameExtractor.scala | 2 +- .../playground/smithyql/NodeContext.scala | 4 ++-- .../playground/smithyql/RangeIndex.scala | 2 +- .../scala/playground/smithyql/syntax.scala | 2 +- .../smithyutil/AddDynamicRefinements.scala | 8 ++++---- .../scala/playground/std/StdlibRuntime.scala | 2 +- .../src/test/scala/playground/Diffs.scala | 6 +++--- .../test/scala/playground/IorUtilsTests.scala | 4 ++-- .../MultiServiceResolverTests.scala | 14 ++++++------- .../scala/playground/NodeEncoderTests.scala | 4 ++-- .../playground/PreludeCompilerTests.scala | 12 +++++------ .../ServiceNameExtractorTests.scala | 2 +- .../playground/smithyql/AtPositionTests.scala | 6 +++--- .../smithyql/CompilationTests.scala | 20 +++++++++---------- .../test/scala/playground/e2e/E2ETests.scala | 12 +++++------ .../smithyql/format/Formatter.scala | 7 ++++--- .../smithyql/format/FormattingTests.scala | 12 +++++------ .../language/CodeLensProvider.scala | 4 ++-- .../playground/language/CommandProvider.scala | 2 +- .../language/CommandResultReporter.scala | 2 +- .../language/CompletionProvider.scala | 5 +++-- .../language/CompletionVisitor.scala | 8 ++++---- .../language/DiagnosticProvider.scala | 4 ++-- .../language/DocumentSymbolProvider.scala | 2 +- .../language/FormattingProvider.scala | 2 +- .../language/TextDocumentProvider.scala | 2 +- .../language/CodeLensProviderTests.scala | 12 +++++------ .../language/CompletionItemTests.scala | 8 ++++---- .../language/CompletionProviderTests.scala | 12 +++++------ .../playground/language/CompletionTests.scala | 10 +++++----- .../language/DiagnosticProviderTests.scala | 10 +++++----- .../scala/playground/language/Diffs.scala | 2 +- .../DocumentSymbolProviderTests.scala | 6 +++--- .../language/FormattingProviderTests.scala | 3 +-- .../scala/playground/lsp/BuildLoader.scala | 2 +- .../playground/lsp/ConfigurationValue.scala | 2 +- .../scala/playground/lsp/LanguageClient.scala | 6 +++--- .../scala/playground/lsp/LanguageServer.scala | 12 +++++------ .../src/main/scala/playground/lsp/Main.scala | 2 +- .../scala/playground/lsp/MainServer.scala | 2 +- .../scala/playground/lsp/ModelLoader.scala | 8 ++++---- .../lsp/PlaygroundLanguageServerAdapter.scala | 6 +++--- .../scala/playground/lsp/PluginResolver.scala | 2 +- .../scala/playground/lsp/ServerBuilder.scala | 4 ++-- .../scala/playground/lsp/ServerLoader.scala | 2 +- .../playground/lsp/TextDocumentManager.scala | 2 +- .../scala/playground/lsp/converters.scala | 6 +++--- .../playground/lsp/util/KleisliOps.scala | 2 +- .../playground/lsp/EmptyConfigTests.scala | 2 +- ...ageServerIntegrationTestSharedServer.scala | 12 +++++------ ...LanguageServerReloadIntegrationTests.scala | 6 +++--- .../playground/lsp/ModelLoaderTests.scala | 6 +++--- .../playground/lsp/PluginResolverTests.scala | 2 +- .../LanguageServerIntegrationTests.scala | 4 ++-- .../playground/lsp/harness/TestClient.scala | 2 +- .../playground/smithyql/parser/Parsers.scala | 8 ++++---- .../smithyql/parser/SourceParser.scala | 4 ++-- .../playground/smithyql/parser/Codecs.scala | 4 ++-- .../smithyql/parser/CommentParsingTests.scala | 2 +- .../playground/smithyql/parser/Diffs.scala | 2 +- .../smithyql/parser/ParserSuite.scala | 10 +++++----- .../parser/generative/ListParserTests.scala | 6 +++--- .../generative/PreludeParserTests.scala | 6 +++--- .../parser/generative/QueryParserTests.scala | 6 +++--- .../generative/SourceFileParserTests.scala | 6 +++--- .../parser/generative/StructParserTests.scala | 6 +++--- .../generative/UseServiceParserTests.scala | 6 +++--- .../parser/v2/ScannerExampleTests.scala | 4 ++-- .../smithyql/parser/v2/ScannerSuite.scala | 6 +++--- .../smithyql/parser/v2/ScannerTests.scala | 8 ++++---- .../playground/plugins/PlaygroundPlugin.scala | 2 +- .../playground/smithyql/WithSource.scala | 2 +- .../scala/playground/smithyql/Diffs.scala | 4 ++-- 91 files changed, 244 insertions(+), 242 deletions(-) diff --git a/build.sbt b/build.sbt index e5b3fe27..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 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 8e2afaa0..d79a7529 100644 --- a/modules/core/src/main/scala/playground/FileCompiler.scala +++ b/modules/core/src/main/scala/playground/FileCompiler.scala @@ -1,9 +1,9 @@ package playground import cats.Parallel -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 acf5bb9d..a118273b 100644 --- a/modules/core/src/main/scala/playground/FileRunner.scala +++ b/modules/core/src/main/scala/playground/FileRunner.scala @@ -1,8 +1,8 @@ package playground import cats.data.NonEmptyList -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 ae1a23dc..6bfbc511 100644 --- a/modules/core/src/main/scala/playground/PreludeCompiler.scala +++ b/modules/core/src/main/scala/playground/PreludeCompiler.scala @@ -3,10 +3,10 @@ package playground import cats.Applicative import cats.Parallel import cats.data.NonEmptyList -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 a91aecb0..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. 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 3b7d5d4d..32842f3a 100644 --- a/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala +++ b/modules/core/src/test/scala/playground/smithyql/CompilationTests.scala @@ -6,9 +6,9 @@ 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 @@ -27,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 @@ -35,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 @@ -58,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 diff --git a/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala b/modules/e2e/src/test/scala/playground/e2e/E2ETests.scala index 660664d9..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 { 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 8740b3d2..58c99f4e 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 smithy4s.dynamic.DynamicSchemaIndex trait CompletionProvider { 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 2cf78414..6135a95c 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -1,8 +1,8 @@ package playground.language import cats.Id -import cats.implicits._ import cats.kernel.Eq +import cats.syntax.all.* import playground.ServiceNameExtractor import playground.TextUtils import playground.language.CompletionItem.InsertUseClause.NotRequired @@ -38,7 +38,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 @@ -205,7 +205,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" @@ -229,7 +229,7 @@ object CompletionItem { tag: CollectionTag[C], hints: Hints, ): String = { - import smithy4s.schema.CollectionTag._ + import smithy4s.schema.CollectionTag.* val base = tag match { 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/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 dedb1ee5..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 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 ce967389..98931e6f 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala @@ -4,14 +4,14 @@ import cats.Applicative import cats.FlatMap import cats.MonadThrow 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 @@ -31,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/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 6a898c2d..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 { 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/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 From 4dc28e0960a3f4327f54d7272a5bce04acee8f80 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 17 Apr 2024 16:00:47 +0000 Subject: [PATCH 081/114] Update alloy-core to 0.3.7 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 9a2b82f2..462d9d90 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.6" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.7" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.47.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 72dda0f9..a4057464 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.3.6", + "com.disneystreaming.alloy:alloy-core:0.3.7", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15" ] } diff --git a/smithy-build.json b/smithy-build.json index db696f47..e90d9018 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.6", + "com.disneystreaming.alloy:alloy-core:0.3.7", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15", "software.amazon.smithy:smithy-aws-traits:1.47.0" ] From 245c52f11bcdc01a2f5e3e7fd4c7380f9164ed49 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 19 Apr 2024 16:56:47 +0000 Subject: [PATCH 082/114] Update smithy4s-aws-http4s, ... to 0.18.16 --- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 a4057464..9684696e 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 @@ -2,6 +2,6 @@ "imports": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.7", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15" + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16" ] } diff --git a/smithy-build.json b/smithy-build.json index e90d9018..109e7ea8 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.7", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16", "software.amazon.smithy:smithy-aws-traits:1.47.0" ] } From ce502af07d7fe5c56fbbfe8bc5098b9ebc4fbcba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Tue, 23 Apr 2024 23:59:02 +0200 Subject: [PATCH 083/114] Bump flake deps --- flake.lock | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index a8c3a9a2..1c25de58 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,15 @@ { "nodes": { "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -17,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1665856037, - "narHash": "sha256-/RvIWnGKdTSoIq5Xc2HwPIL0TzRslzU6Rqk4Img6UNg=", + "lastModified": 1713905099, + "narHash": "sha256-6+M6qG/7PmDxYeXdutxS6gcS2MQR50ilEaIcNwnAmto=", "owner": "nixos", "repo": "nixpkgs", - "rev": "c95ebc5125ffffcd431df0ad8620f0926b8125b8", + "rev": "0e7e9561350c68125627534b7c0f2d3cd5d32151", "type": "github" }, "original": { @@ -35,6 +38,21 @@ "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", From cd295658125dabfd6fd8855f23c9fd27470bc5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Wed, 24 Apr 2024 00:04:19 +0200 Subject: [PATCH 084/114] use node --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index c70a0ebb..9afa5030 100644 --- a/flake.nix +++ b/flake.nix @@ -24,7 +24,7 @@ devShell = pkgs.mkShell { buildInputs = [ pkgs.yarn - pkgs.nodejs-14_x + pkgs.nodejs pkgs.sbt pkgs.jless pkgs.gnupg From a5dbbb10d822c4503d77eb793c9df86b032bef07 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 27 Apr 2024 15:56:00 +0000 Subject: [PATCH 085/114] Update circe-core, circe-generic, ... to 0.14.7 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 462d9d90..af27293d 100644 --- a/build.sbt +++ b/build.sbt @@ -96,8 +96,8 @@ lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-parse" % "1.0.0", - "io.circe" %% "circe-generic" % "0.14.6" % Test, - "io.circe" %% "circe-parser" % "0.14.6" % Test, + "io.circe" %% "circe-generic" % "0.14.7" % Test, + "io.circe" %% "circe-parser" % "0.14.7" % Test, "co.fs2" %% "fs2-io" % "3.10.2" % Test, ) ) @@ -153,7 +153,7 @@ lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.22.0", - "io.circe" %% "circe-core" % "0.14.6", + "io.circe" %% "circe-core" % "0.14.7", "org.http4s" %% "http4s-ember-client" % "0.23.26", "org.http4s" %% "http4s-ember-server" % "0.23.26" % Test, "io.get-coursier" %% "coursier" % "2.1.9", From 739cdde2cd869bd9acfe5b804e722cdf529d5ff1 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 27 Apr 2024 15:56:12 +0000 Subject: [PATCH 086/114] Update smithy-aws-traits, smithy-model to 1.48.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 462d9d90..6481ddb4 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test, "com.disneystreaming.alloy" % "alloy-core" % "0.3.7" % Test, - "software.amazon.smithy" % "smithy-aws-traits" % "1.47.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.48.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index 109e7ea8..ed543caa 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.7", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16", - "software.amazon.smithy:smithy-aws-traits:1.47.0" + "software.amazon.smithy:smithy-aws-traits:1.48.0" ] } From f1a85c1f8b9690725f3adef4b7247db16ac1099e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 5 May 2024 15:49:33 +0000 Subject: [PATCH 087/114] Update jsoniter-scala-macros to 2.28.5 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3ff7ee09..d8e0d5bd 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.5", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 4a3500f148e6b08164955c812b548686794ae68e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 5 May 2024 15:49:44 +0000 Subject: [PATCH 088/114] Update http4s-ember-client, ... to 0.23.27 --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 3ff7ee09..54facb29 100644 --- a/build.sbt +++ b/build.sbt @@ -154,8 +154,8 @@ lazy val lsp = module("lsp") libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.22.0", "io.circe" %% "circe-core" % "0.14.7", - "org.http4s" %% "http4s-ember-client" % "0.23.26", - "org.http4s" %% "http4s-ember-server" % "0.23.26" % Test, + "org.http4s" %% "http4s-ember-client" % "0.23.27", + "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, "io.get-coursier" %% "coursier" % "2.1.9", "org.typelevel" %% "cats-tagless-core" % "0.16.0", ), From fea8f450f0826f4bc5821f3437264970a552e139 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 7 May 2024 21:08:01 +0000 Subject: [PATCH 089/114] Update coursier to 2.1.10 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2d3d8750..d11b58b6 100644 --- a/build.sbt +++ b/build.sbt @@ -156,7 +156,7 @@ lazy val lsp = module("lsp") "io.circe" %% "circe-core" % "0.14.7", "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, - "io.get-coursier" %% "coursier" % "2.1.9", + "io.get-coursier" %% "coursier" % "2.1.10", "org.typelevel" %% "cats-tagless-core" % "0.16.0", ), buildInfoPackage := "playground.lsp.buildinfo", From 2c5ee7668dd6a36fc7328297bd33cf2b398c1865 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 11 May 2024 15:11:24 +0000 Subject: [PATCH 090/114] Update alloy-core to 0.3.8 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index d11b58b6..3b120c04 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.7" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.8" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.48.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 9684696e..01d376b6 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.3.7", + "com.disneystreaming.alloy:alloy-core:0.3.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16" ] } diff --git a/smithy-build.json b/smithy-build.json index ed543caa..9645b971 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.7", + "com.disneystreaming.alloy:alloy-core:0.3.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16", "software.amazon.smithy:smithy-aws-traits:1.48.0" ] From c2585173af8206a2878442fd5efbbc8c0254deec Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 13 May 2024 16:08:35 +0000 Subject: [PATCH 091/114] Update smithy-aws-traits to 1.49.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 3b120c04..d995750a 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test, "com.disneystreaming.alloy" % "alloy-core" % "0.3.8" % Test, - "software.amazon.smithy" % "smithy-aws-traits" % "1.48.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.49.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index 9645b971..34ccf910 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16", - "software.amazon.smithy:smithy-aws-traits:1.48.0" + "software.amazon.smithy:smithy-aws-traits:1.49.0" ] } From a8e8cd06e11fb0680ba12486ccb3067a855dee30 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 15 May 2024 17:28:32 +0000 Subject: [PATCH 092/114] Update org.eclipse.lsp4j to 0.23.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d995750a..bca60afe 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ lazy val languageSupport = module("language-support") lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( - "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.22.0", + "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.0", "io.circe" %% "circe-core" % "0.14.7", "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, From 1766b5959508d6be8ba395ede063f04fed3e9ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Sun, 19 May 2024 14:42:14 +0200 Subject: [PATCH 093/114] Bump smithy4s: 0.18.19 (#426) --- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- project/plugins.sbt | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 01d376b6..20069145 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 @@ -2,6 +2,6 @@ "imports": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16" + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.19" ] } diff --git a/project/plugins.sbt b/project/plugins.sbt index 96b2c0a2..adc144f5 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,7 +9,7 @@ libraryDependencies ++= Seq( ) // try to keep in sync with smithy-build.json -addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.15") +addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.19") 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 34ccf910..8ebc4e54 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "imports": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.16", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.19", "software.amazon.smithy:smithy-aws-traits:1.49.0" ] } From cb186f4b0b3b46ab0a47409d85537c92d4a8fe7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Sun, 19 May 2024 23:19:12 +0200 Subject: [PATCH 094/114] Add support for `sources` (#427) --- .../core/src/main/scala/playground/PlaygroundConfig.scala | 5 +++++ modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala | 6 +++++- .../lsp/src/main/scala/playground/lsp/ServerLoader.scala | 4 +++- .../resources/test-workspaces/default/smithy-build.json | 2 +- .../lsp/LanguageServerIntegrationTestSharedServer.scala | 2 +- smithy-build.json | 2 +- 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/core/src/main/scala/playground/PlaygroundConfig.scala b/modules/core/src/main/scala/playground/PlaygroundConfig.scala index c224497d..cae84fe6 100644 --- a/modules/core/src/main/scala/playground/PlaygroundConfig.scala +++ b/modules/core/src/main/scala/playground/PlaygroundConfig.scala @@ -7,6 +7,7 @@ import com.github.plokhotnyuk.jsoniter_scala.macros.JsonCodecMaker final case class PlaygroundConfig( imports: List[String], + sources: List[String], dependencies: List[String], repositories: List[String], extensions: List[String], @@ -18,6 +19,7 @@ object PlaygroundConfig { val empty: PlaygroundConfig = PlaygroundConfig( imports = Nil, + sources = Nil, dependencies = Nil, repositories = Nil, extensions = Nil, @@ -29,12 +31,14 @@ object PlaygroundConfig { mavenDependencies: List[String] = Nil, mavenRepositories: List[String] = Nil, imports: List[String] = Nil, + sources: List[String] = Nil, maven: Option[MavenConfig] = None, smithyPlayground: Option[SmithyPlaygroundPluginConfig] = None, ) { def toPlaygroundConfig: PlaygroundConfig = PlaygroundConfig( imports = imports, + sources = sources, dependencies = mavenDependencies ++ maven.foldMap(_.dependencies), repositories = mavenRepositories ++ maven.foldMap(_.repositories).map(_.url), extensions = smithyPlayground.foldMap(_.extensions), @@ -51,6 +55,7 @@ object PlaygroundConfig { mavenDependencies = c.dependencies, mavenRepositories = c.repositories, imports = c.imports, + sources = c.sources, smithyPlayground = c.extensions.toNel.map { e => SmithyPlaygroundPluginConfig(extensions = e.toList) }, diff --git a/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala b/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala index b69bf8ee..e619f14a 100644 --- a/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala +++ b/modules/lsp/src/main/scala/playground/lsp/BuildLoader.scala @@ -95,7 +95,11 @@ object BuildLoader { .getOrElse(sys.error("impossible - no parent for " + loaded.configFilePath)) // "raw" means these can be directories etc., just like in the config file. - val rawImportPaths = loaded.config.imports.map(workspaceBase.resolve).toSet + val rawImportPaths = + ( + loaded.config.imports ++ + loaded.config.sources + ).map(workspaceBase.resolve).toSet for { specs <- filterImports(rawImportPaths) diff --git a/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala b/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala index 97fabd41..fbd8e316 100644 --- a/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala +++ b/modules/lsp/src/main/scala/playground/lsp/ServerLoader.scala @@ -34,13 +34,14 @@ object ServerLoader { ) case class WorkspaceStats( + sourceCount: Int, importCount: Int, dependencyCount: Int, pluginCount: Int, ) { def render: String = - s"$importCount imports, $dependencyCount dependencies and $pluginCount plugins" + s"$sourceCount sources, $importCount imports, $dependencyCount dependencies and $pluginCount plugins" } @@ -49,6 +50,7 @@ object ServerLoader { def fromBuildConfig( bc: PlaygroundConfig ): WorkspaceStats = WorkspaceStats( + sourceCount = bc.sources.size, importCount = bc.imports.size, dependencyCount = bc.dependencies.size, pluginCount = bc.extensions.size, 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 20069145..e9c74aff 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,5 +1,5 @@ { - "imports": ["./weather.smithy", "./no-runner.smithy"], + "sources": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.19" diff --git a/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala b/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala index bb0e2e60..a84d9973 100644 --- a/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala +++ b/modules/lsp/src/test/scala/playground/lsp/LanguageServerIntegrationTestSharedServer.scala @@ -42,7 +42,7 @@ object LanguageServerIntegrationTestSharedServer ), TestClient.MessageLog( MessageType.Info, - "Loaded Smithy Playground server with 2 imports, 2 dependencies and 0 plugins", + "Loaded Smithy Playground server with 2 sources, 0 imports, 2 dependencies and 0 plugins", ), ) diff --git a/smithy-build.json b/smithy-build.json index 8ebc4e54..ebb963bf 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,5 +1,5 @@ { - "imports": ["modules/core/src/test/smithy"], + "sources": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.19", From 19264ab370fd89d561c539efff0093e798e57589 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Tue, 21 May 2024 18:27:40 +0000 Subject: [PATCH 095/114] Update smithy4s-aws-http4s, ... to 0.18.20 --- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 e9c74aff..bb1bbc8e 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 @@ -2,6 +2,6 @@ "sources": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.19" + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20" ] } diff --git a/smithy-build.json b/smithy-build.json index ebb963bf..8063c043 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "sources": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.8", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.19", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20", "software.amazon.smithy:smithy-aws-traits:1.49.0" ] } From 0deaa0dd0a751bb65b90389ede55fa8d39121644 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 23 May 2024 16:52:38 +0000 Subject: [PATCH 096/114] Update org.eclipse.lsp4j to 0.23.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index bca60afe..04f85e93 100644 --- a/build.sbt +++ b/build.sbt @@ -152,7 +152,7 @@ lazy val languageSupport = module("language-support") lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( - "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.0", + "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1", "io.circe" %% "circe-core" % "0.14.7", "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, From 50cca27e92642ddb4dce9040d75b3883e9803a22 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 25 May 2024 15:40:52 +0000 Subject: [PATCH 097/114] Update cats-tagless-core to 0.16.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 04f85e93..48bf1119 100644 --- a/build.sbt +++ b/build.sbt @@ -157,7 +157,7 @@ lazy val lsp = module("lsp") "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, "io.get-coursier" %% "coursier" % "2.1.10", - "org.typelevel" %% "cats-tagless-core" % "0.16.0", + "org.typelevel" %% "cats-tagless-core" % "0.16.1", ), buildInfoPackage := "playground.lsp.buildinfo", buildInfoKeys ++= Seq(version, scalaBinaryVersion), From 3d6ab877f92f3df47011ffca73f888407946f852 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 29 May 2024 16:11:11 +0000 Subject: [PATCH 098/114] Update jsoniter-scala-macros to 2.29.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 48bf1119..072fb0a1 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.28.5", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.29.0", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From a1e7b67ff890d85313242c5f0f0bee2320701d20 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 29 May 2024 16:11:23 +0000 Subject: [PATCH 099/114] Update cats-core to 2.12.0 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 48bf1119..4b5b3fcb 100644 --- a/build.sbt +++ b/build.sbt @@ -43,7 +43,7 @@ ThisBuild / dynverSeparator := "-" val commonSettings = Seq( organization := "com.kubukoz.playground", libraryDependencies ++= Seq( - "org.typelevel" %% "cats-core" % "2.10.0", + "org.typelevel" %% "cats-core" % "2.12.0", "org.typelevel" %% "cats-mtl" % "1.4.0", "com.disneystreaming" %% "weaver-cats" % "0.8.4" % Test, "com.disneystreaming" %% "weaver-discipline" % "0.8.4" % Test, From 348c5e1c38594c9ceac8c581243848f99696d02e Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Fri, 31 May 2024 17:30:56 +0000 Subject: [PATCH 100/114] Update alloy-core to 0.3.9 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index afa6195d..135543c4 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.8" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.9" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.49.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 bb1bbc8e..86b315bc 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 @@ { "sources": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.8", + "com.disneystreaming.alloy:alloy-core:0.3.9", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20" ] } diff --git a/smithy-build.json b/smithy-build.json index 8063c043..b3eb1904 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "sources": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.8", + "com.disneystreaming.alloy:alloy-core:0.3.9", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20", "software.amazon.smithy:smithy-aws-traits:1.49.0" ] From 2cf1cea15512b837e25d3ebb67a4153aa13cfe24 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 2 Jun 2024 15:24:19 +0000 Subject: [PATCH 101/114] Update jsoniter-scala-macros to 2.30.1 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 135543c4..8755c201 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.29.0", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.1", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From d9edf3075fdd2f9ab804135564eba7b7da9b202a Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 24 Jun 2024 17:37:34 +0000 Subject: [PATCH 102/114] Update circe-core, circe-generic, ... to 0.14.8 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 8755c201..587bfbac 100644 --- a/build.sbt +++ b/build.sbt @@ -96,8 +96,8 @@ lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-parse" % "1.0.0", - "io.circe" %% "circe-generic" % "0.14.7" % Test, - "io.circe" %% "circe-parser" % "0.14.7" % Test, + "io.circe" %% "circe-generic" % "0.14.8" % Test, + "io.circe" %% "circe-parser" % "0.14.8" % Test, "co.fs2" %% "fs2-io" % "3.10.2" % Test, ) ) @@ -153,7 +153,7 @@ lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1", - "io.circe" %% "circe-core" % "0.14.7", + "io.circe" %% "circe-core" % "0.14.8", "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, "io.get-coursier" %% "coursier" % "2.1.10", From 927aacd27e3b5fbca05b0b9a9b3aeeaa8c5977a2 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 24 Jun 2024 17:37:45 +0000 Subject: [PATCH 103/114] Update paiges-cats to 0.4.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 8755c201..e85a3f6e 100644 --- a/build.sbt +++ b/build.sbt @@ -110,7 +110,7 @@ lazy val parser = module("parser") lazy val formatter = module("formatter") .settings( libraryDependencies ++= Seq( - "org.typelevel" %% "paiges-cats" % "0.4.3" + "org.typelevel" %% "paiges-cats" % "0.4.4" ) ) .dependsOn( From d5752d827b40bf9be1fe9763fcd37874c477fa28 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Mon, 24 Jun 2024 17:37:58 +0000 Subject: [PATCH 104/114] Update smithy-aws-traits to 1.50.0 --- build.sbt | 2 +- smithy-build.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 8755c201..c72edb7d 100644 --- a/build.sbt +++ b/build.sbt @@ -131,7 +131,7 @@ lazy val core = module("core") "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" % "smithy4s-protocol" % smithy4sVersion.value % Test, "com.disneystreaming.alloy" % "alloy-core" % "0.3.9" % Test, - "software.amazon.smithy" % "smithy-aws-traits" % "1.49.0" % Test, + "software.amazon.smithy" % "smithy-aws-traits" % "1.50.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), ) diff --git a/smithy-build.json b/smithy-build.json index b3eb1904..82043772 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -3,6 +3,6 @@ "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.9", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20", - "software.amazon.smithy:smithy-aws-traits:1.49.0" + "software.amazon.smithy:smithy-aws-traits:1.50.0" ] } From a924b40eb4762c93f3aaedd38a9fba4dc0f19392 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 4 Jul 2024 17:06:52 +0000 Subject: [PATCH 105/114] Update jsoniter-scala-macros to 2.30.3 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d7927370..7e1a538b 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.1", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.3", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 7f937c1ab880d400c119700e4dc70514b7cf04e5 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Thu, 4 Jul 2024 17:07:03 +0000 Subject: [PATCH 106/114] Update circe-core, circe-generic, ... to 0.14.9 --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index d7927370..c0b4f50d 100644 --- a/build.sbt +++ b/build.sbt @@ -96,8 +96,8 @@ lazy val parser = module("parser") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-parse" % "1.0.0", - "io.circe" %% "circe-generic" % "0.14.8" % Test, - "io.circe" %% "circe-parser" % "0.14.8" % Test, + "io.circe" %% "circe-generic" % "0.14.9" % Test, + "io.circe" %% "circe-parser" % "0.14.9" % Test, "co.fs2" %% "fs2-io" % "3.10.2" % Test, ) ) @@ -153,7 +153,7 @@ lazy val lsp = module("lsp") .settings( libraryDependencies ++= Seq( "org.eclipse.lsp4j" % "org.eclipse.lsp4j" % "0.23.1", - "io.circe" %% "circe-core" % "0.14.8", + "io.circe" %% "circe-core" % "0.14.9", "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, "io.get-coursier" %% "coursier" % "2.1.10", From d2b12cb53e5a9f4b120fcbd3cc18ec8b00d17e5c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 10 Jul 2024 16:39:50 +0000 Subject: [PATCH 107/114] Update alloy-core to 0.3.10 --- build.sbt | 2 +- .../test/resources/test-workspaces/default/smithy-build.json | 2 +- smithy-build.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 8177800c..377535f2 100644 --- a/build.sbt +++ b/build.sbt @@ -130,7 +130,7 @@ lazy val core = module("core") "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.3.9" % Test, + "com.disneystreaming.alloy" % "alloy-core" % "0.3.10" % Test, "software.amazon.smithy" % "smithy-aws-traits" % "1.50.0" % Test, ), Smithy4sCodegenPlugin.defaultSettings(Test), 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 86b315bc..ba412d27 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 @@ { "sources": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.9", + "com.disneystreaming.alloy:alloy-core:0.3.10", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20" ] } diff --git a/smithy-build.json b/smithy-build.json index 82043772..a99f32b0 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -1,7 +1,7 @@ { "sources": ["modules/core/src/test/smithy"], "mavenDependencies": [ - "com.disneystreaming.alloy:alloy-core:0.3.9", + "com.disneystreaming.alloy:alloy-core:0.3.10", "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20", "software.amazon.smithy:smithy-aws-traits:1.50.0" ] From ce482b1dd7ac2861433f53a7297aa4c0f5fe7370 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Wed, 10 Jul 2024 16:40:05 +0000 Subject: [PATCH 108/114] Update jsoniter-scala-macros to 2.30.4 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 8177800c..d7a84fb9 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.3", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.4", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 1c317c74ccecde414760f3231d620423e85ed0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Jul 2024 17:51:59 +0200 Subject: [PATCH 109/114] Move back to cats-tagless macros (#448) --- build.sbt | 2 +- .../scala/playground/lsp/LanguageClient.scala | 38 ++++----- .../scala/playground/lsp/LanguageServer.scala | 77 ++++--------------- 3 files changed, 30 insertions(+), 87 deletions(-) diff --git a/build.sbt b/build.sbt index 35e39cde..3b6d84f8 100644 --- a/build.sbt +++ b/build.sbt @@ -157,7 +157,7 @@ lazy val lsp = module("lsp") "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, "io.get-coursier" %% "coursier" % "2.1.10", - "org.typelevel" %% "cats-tagless-core" % "0.16.1", + "org.typelevel" %% "cats-tagless-macros" % "0.16.1", ), buildInfoPackage := "playground.lsp.buildinfo", buildInfoKeys ++= Seq(version, scalaBinaryVersion), diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala index 8d77a1bf..4c3a9625 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageClient.scala @@ -1,8 +1,14 @@ package playground.lsp import cats.FlatMap +import cats.data.Kleisli import cats.effect.kernel.Async import cats.syntax.all.* +import cats.tagless.Derive +import cats.tagless.FunctorK +import cats.tagless.catsTaglessApplyKForIdK +import cats.tagless.implicits.* +import cats.~> import com.google.gson.JsonElement import org.eclipse.lsp4j.ConfigurationItem import org.eclipse.lsp4j.ConfigurationParams @@ -101,33 +107,19 @@ object LanguageClient { def refreshDiagnostics: F[Unit] = withClientF(_.refreshDiagnostics()).void } - // courtesy of github copilot - // workaround for https://github.com/typelevel/cats-tagless/pull/401 + implicit val functorK: FunctorK[LanguageClient] = Derive.functorK[LanguageClient] + def defer[F[_]: FlatMap]( fa: F[LanguageClient[F]] - ): LanguageClient[F] = - new LanguageClient[F] { + ): LanguageClient[F] = Derive + .readerT[LanguageClient, F] + .mapK(new (Kleisli[F, LanguageClient[F], *] ~> F) { - override def configuration[A]( - v: ConfigurationValue[A] - ): F[A] = fa.flatMap(_.configuration(v)) - - override def showMessage( - tpe: MessageType, - msg: String, - ): F[Unit] = fa.flatMap(_.showMessage(tpe, msg)) + def apply[A]( + k: Kleisli[F, LanguageClient[F], A] + ): F[A] = fa.flatMap(k.run) - override def refreshDiagnostics: F[Unit] = fa.flatMap(_.refreshDiagnostics) - - override def refreshCodeLenses: F[Unit] = fa.flatMap(_.refreshCodeLenses) - - override def showOutputPanel: F[Unit] = fa.flatMap(_.showOutputPanel) - - override def logOutput( - msg: String - ): F[Unit] = fa.flatMap(_.logOutput(msg)) - - } + }) val NoChangeDetected: String = "No change detected, not rebuilding server" } diff --git a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala index 98931e6f..f6b4a010 100644 --- a/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala +++ b/modules/lsp/src/main/scala/playground/lsp/LanguageServer.scala @@ -3,9 +3,14 @@ package playground.lsp import cats.Applicative import cats.FlatMap import cats.MonadThrow +import cats.data.Kleisli import cats.effect.kernel.Async import cats.parse.LocationMap import cats.syntax.all.* +import cats.tagless.Derive +import cats.tagless.FunctorK +import cats.tagless.catsTaglessApplyKForIdK +import cats.tagless.implicits.* import cats.~> import com.google.gson.JsonElement import com.google.gson.JsonPrimitive @@ -351,72 +356,18 @@ object LanguageServer { def exit: F[Unit] = Applicative[F].unit } - // courtesy of github copilot - // workaround for https://github.com/typelevel/cats-tagless/pull/401 + implicit val functorK: FunctorK[LanguageServer] = Derive.functorK[LanguageServer] + def defer[F[_]: FlatMap]( fa: F[LanguageServer[F]] - ): LanguageServer[F] = - new LanguageServer[F] { - - override def initialize( - params: InitializeParams - ): F[InitializeResult] = fa.flatMap(_.initialize(params)); - - override def initialized( - params: InitializedParams - ): F[Unit] = fa.flatMap(_.initialized(params)); - - override def didChange( - params: DidChangeTextDocumentParams - ): F[Unit] = fa.flatMap(_.didChange(params)); - - override def didOpen( - params: DidOpenTextDocumentParams - ): F[Unit] = fa.flatMap(_.didOpen(params)); - - override def didSave( - params: DidSaveTextDocumentParams - ): F[Unit] = fa.flatMap(_.didSave(params)); - - override def didClose( - params: DidCloseTextDocumentParams - ): F[Unit] = fa.flatMap(_.didClose(params)); - - override def formatting( - params: DocumentFormattingParams - ): F[List[TextEdit]] = fa.flatMap(_.formatting(params)); - - override def completion( - position: CompletionParams - ): F[Either[List[CompletionItem], CompletionList]] = fa.flatMap(_.completion(position)); - - override def diagnostic( - params: DocumentDiagnosticParams - ): F[DocumentDiagnosticReport] = fa.flatMap(_.diagnostic(params)); - - override def codeLens( - params: CodeLensParams - ): F[List[CodeLens]] = fa.flatMap(_.codeLens(params)); - - override def documentSymbol( - params: DocumentSymbolParams - ): F[List[DocumentSymbol]] = fa.flatMap(_.documentSymbol(params)); - - override def didChangeWatchedFiles( - params: DidChangeWatchedFilesParams - ): F[Unit] = fa.flatMap(_.didChangeWatchedFiles(params)); - - override def executeCommand( - params: ExecuteCommandParams - ): F[Unit] = fa.flatMap(_.executeCommand(params)); - - override def runFile( - params: RunFileParams - ): F[Unit] = fa.flatMap(_.runFile(params)); + ): LanguageServer[F] = Derive + .readerT[LanguageServer, F] + .mapK(new (Kleisli[F, LanguageServer[F], *] ~> F) { - override def shutdown: F[Unit] = fa.flatMap(_.shutdown); + def apply[A]( + k: Kleisli[F, LanguageServer[F], A] + ): F[A] = fa.flatMap(k.run) - override def exit: F[Unit] = fa.flatMap(_.exit) - } + }) } From 09c5f6560eb4afdea3151f62d2454bce55c56943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Fri, 12 Jul 2024 18:12:42 +0200 Subject: [PATCH 110/114] Bump smithy4s to 0.18.23 (#449) --- .../playground/language/CompletionProviderTests.scala | 8 ++++---- .../resources/test-workspaces/default/smithy-build.json | 2 +- project/plugins.sbt | 2 +- smithy-build.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) 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 2fc87e5e..4984f05d 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionProviderTests.scala @@ -150,11 +150,9 @@ object CompletionProviderTests extends SimpleIOSuite { } locally { - // for some reason, this can't be defined within the test body. - // https://github.com/disneystreaming/smithy4s/issues/537 - val provider = CompletionProvider.forServices(List(wrapService(DeprecatedServiceGen))) - pureTest("completing empty file - one (deprecated) service exists") { + val provider = CompletionProvider.forServices(List(wrapService(DeprecatedServiceGen))) + val result = provider .provide( "", @@ -166,6 +164,8 @@ object CompletionProviderTests extends SimpleIOSuite { } pureTest("completing use clause - one (deprecated) service exists") { + val provider = CompletionProvider.forServices(List(wrapService(DeprecatedServiceGen))) + val result = provider .provide( "use service a#B\nhello {}", 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 ba412d27..5d545d7f 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 @@ -2,6 +2,6 @@ "sources": ["./weather.smithy", "./no-runner.smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.10", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20" + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.23" ] } diff --git a/project/plugins.sbt b/project/plugins.sbt index adc144f5..b619d86f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,7 +9,7 @@ libraryDependencies ++= Seq( ) // try to keep in sync with smithy-build.json -addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.19") +addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.23") 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 a99f32b0..5511f97c 100644 --- a/smithy-build.json +++ b/smithy-build.json @@ -2,7 +2,7 @@ "sources": ["modules/core/src/test/smithy"], "mavenDependencies": [ "com.disneystreaming.alloy:alloy-core:0.3.10", - "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.20", + "com.disneystreaming.smithy4s:smithy4s-protocol:0.18.23", "software.amazon.smithy:smithy-aws-traits:1.50.0" ] } From ed5be8a15de948ed468101439a0e1db673334fa8 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 14 Jul 2024 16:02:17 +0000 Subject: [PATCH 111/114] Update jsoniter-scala-macros to 2.30.7 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3b6d84f8..2e0986d2 100644 --- a/build.sbt +++ b/build.sbt @@ -125,7 +125,7 @@ lazy val core = module("core") .settings( libraryDependencies ++= Seq( "org.typelevel" %% "cats-effect" % "3.5.4", - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.4", + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "2.30.7", "com.disneystreaming.smithy4s" %% "smithy4s-dynamic" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-http4s" % smithy4sVersion.value, "com.disneystreaming.smithy4s" %% "smithy4s-aws-http4s" % smithy4sVersion.value, From 89acbf8d275bc040124a7fdac07dfad6d125c0cf Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sun, 14 Jul 2024 16:02:25 +0000 Subject: [PATCH 112/114] Update cats-tagless-macros to 0.16.2 --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3b6d84f8..04a7c39a 100644 --- a/build.sbt +++ b/build.sbt @@ -157,7 +157,7 @@ lazy val lsp = module("lsp") "org.http4s" %% "http4s-ember-client" % "0.23.27", "org.http4s" %% "http4s-ember-server" % "0.23.27" % Test, "io.get-coursier" %% "coursier" % "2.1.10", - "org.typelevel" %% "cats-tagless-macros" % "0.16.1", + "org.typelevel" %% "cats-tagless-macros" % "0.16.2", ), buildInfoPackage := "playground.lsp.buildinfo", buildInfoKeys ++= Seq(version, scalaBinaryVersion), From dc982265e2bb57ec852904081f0320018636a214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Wed, 17 Jul 2024 01:58:33 +0200 Subject: [PATCH 113/114] TransitiveCompiler has been upstreamed (#452) --- .../playground/QueryCompilerVisitor.scala | 2 +- .../smithyutil/AddDynamicRefinements.scala | 2 +- .../smithyutil/TransitiveCompiler.scala | 48 ------------------- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index 7edbdf58..e90f09fd 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -54,7 +54,7 @@ import scala.collection.immutable.ListMap object QueryCompilerVisitor { val full: Schema ~> QueryCompiler = - new TransitiveCompiler(AddDynamicRefinements) andThen QueryCompilerVisitorInternal + Schema.transformTransitivelyK(AddDynamicRefinements) andThen QueryCompilerVisitorInternal } object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { diff --git a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala index dd922977..7f4efecf 100644 --- a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala +++ b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala @@ -14,7 +14,7 @@ import smithy4s.~> /** Reifies refinement hints into the schema. * * Notably, this does NOT recurse! In order to traverse an entire schema recursively, this has to - * be wrapped in TransitiveCompiler. This is done for separation of concerns. + * be wrapped in transformTransitivelyK. This is done for separation of concerns. */ object AddDynamicRefinements extends (Schema ~> Schema) { diff --git a/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala b/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala deleted file mode 100644 index f61baf0f..00000000 --- a/modules/core/src/main/scala/playground/smithyutil/TransitiveCompiler.scala +++ /dev/null @@ -1,48 +0,0 @@ -package playground.smithyutil - -import smithy4s.schema.Alt -import smithy4s.schema.Field -import smithy4s.schema.Schema -import smithy4s.schema.Schema.BijectionSchema -import smithy4s.schema.Schema.CollectionSchema -import smithy4s.schema.Schema.EnumerationSchema -import smithy4s.schema.Schema.LazySchema -import smithy4s.schema.Schema.MapSchema -import smithy4s.schema.Schema.OptionSchema -import smithy4s.schema.Schema.PrimitiveSchema -import smithy4s.schema.Schema.RefinementSchema -import smithy4s.schema.Schema.StructSchema -import smithy4s.schema.Schema.UnionSchema -import smithy4s.~> - -/** Applies the underlying transformation on each node of the schema. */ -final class TransitiveCompiler( - underlying: Schema ~> Schema -) extends (Schema ~> Schema) { - - def apply[A]( - fa: Schema[A] - ): Schema[A] = - fa match { - case e @ EnumerationSchema(_, _, _, _, _) => underlying(e) - case p @ PrimitiveSchema(_, _, _) => underlying(p) - case u @ UnionSchema(_, _, _, _) => - underlying(u.copy(alternatives = u.alternatives.map(handleAlt(_)))) - case BijectionSchema(s, bijection) => underlying(BijectionSchema(this(s), bijection)) - case LazySchema(suspend) => underlying(LazySchema(suspend.map(this.apply))) - case RefinementSchema(s, refinement) => underlying(RefinementSchema(this(s), refinement)) - case c @ CollectionSchema(_, _, _, _) => underlying(c.copy(member = this(c.member))) - case m @ MapSchema(_, _, _, _) => underlying(m.copy(key = this(m.key), value = this(m.value))) - case s @ StructSchema(_, _, _, _) => underlying(s.copy(fields = s.fields.map(handleField(_)))) - case n @ OptionSchema(_) => underlying(n.copy(underlying = this(n.underlying))) - } - - private def handleField[S, A]( - field: Field[S, A] - ): Field[S, A] = field.copy(schema = this(field.schema)) - - private def handleAlt[S, A]( - alt: Alt[S, A] - ): Alt[S, A] = alt.copy(schema = this(alt.schema)) - -} From 3fd962db581c23368047f1ea6ad8a47d8a05e158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Koz=C5=82owski?= Date: Wed, 17 Jul 2024 22:39:43 +0200 Subject: [PATCH 114/114] Flexible collections (don't rely so much on CollectionTag) (#453) --- .scalafmt.conf | 9 ++++++++ .../scala/playground/NodeEncoderVisitor.scala | 10 +-------- .../playground/QueryCompilerVisitor.scala | 13 +++--------- .../smithyutil/AddDynamicRefinements.scala | 12 +++-------- .../language/CompletionVisitor.scala | 21 +++++++------------ .../playground/language/CompletionTests.scala | 4 ++-- .../playground/plugins/PlaygroundPlugin.scala | 2 +- 7 files changed, 27 insertions(+), 44 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 92af2b24..f10b5579 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -43,3 +43,12 @@ rewrite { sort = ascii } } + +fileOverride { + "glob:**.sbt" { + runner.dialect = sbt1 + } + "glob:**/project/**" { + runner.dialect = scala212 + } +} diff --git a/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala b/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala index 8afd771e..7eefdd8c 100644 --- a/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala +++ b/modules/core/src/main/scala/playground/NodeEncoderVisitor.scala @@ -27,10 +27,6 @@ import smithy4s.ShapeId import smithy4s.capability.EncoderK import smithy4s.schema.Alt import smithy4s.schema.CollectionTag -import smithy4s.schema.CollectionTag.IndexedSeqTag -import smithy4s.schema.CollectionTag.ListTag -import smithy4s.schema.CollectionTag.SetTag -import smithy4s.schema.CollectionTag.VectorTag import smithy4s.schema.EnumTag import smithy4s.schema.EnumValue import smithy4s.schema.Field @@ -133,11 +129,7 @@ object NodeEncoderVisitor extends SchemaVisitor[NodeEncoder] { self => hints: Hints, tag: CollectionTag[C], member: Schema[A], - ): NodeEncoder[C[A]] = - tag match { - case ListTag => listOf(member) - case IndexedSeqTag | SetTag | VectorTag => listOf(member).contramap(_.toList) - } + ): NodeEncoder[C[A]] = listOf(member).contramap(tag.iterator(_).toList) private def listOf[A]( member: Schema[A] diff --git a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala index e90f09fd..d51f811d 100644 --- a/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala +++ b/modules/core/src/main/scala/playground/QueryCompilerVisitor.scala @@ -20,10 +20,6 @@ import smithy4s.ShapeId import smithy4s.Timestamp import smithy4s.schema.Alt import smithy4s.schema.CollectionTag -import smithy4s.schema.CollectionTag.IndexedSeqTag -import smithy4s.schema.CollectionTag.ListTag -import smithy4s.schema.CollectionTag.SetTag -import smithy4s.schema.CollectionTag.VectorTag import smithy4s.schema.EnumTag import smithy4s.schema.EnumValue import smithy4s.schema.Field @@ -152,12 +148,9 @@ object QueryCompilerVisitorInternal extends SchemaVisitor[QueryCompiler] { else listOf(member) - tag match { - case ListTag => base - case SetTag => base.map(_.toSet) - case IndexedSeqTag => base.map(_.toIndexedSeq) - case VectorTag => base.map(_.toVector) - } + base + .map(_.iterator) + .map(tag.fromIterator(_)) } private def uniqueListOf[A]( diff --git a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala index 7f4efecf..cec0ab98 100644 --- a/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala +++ b/modules/core/src/main/scala/playground/smithyutil/AddDynamicRefinements.scala @@ -5,7 +5,6 @@ import smithy.api import smithy4s.Refinement import smithy4s.RefinementProvider import smithy4s.Surjection -import smithy4s.schema.CollectionTag.* import smithy4s.schema.Primitive.* import smithy4s.schema.Schema import smithy4s.schema.Schema.* @@ -39,14 +38,9 @@ object AddDynamicRefinements extends (Schema ~> Schema) { private def collection[C[_], A]( schema: Schema.CollectionSchema[C, A] - ): Schema[C[A]] = - schema.tag match { - case ListTag => schema.reifyHint(RefinementProvider.iterableLengthConstraint[List, A]) - case VectorTag => schema.reifyHint(RefinementProvider.iterableLengthConstraint[Vector, A]) - case SetTag => schema.reifyHint(RefinementProvider.iterableLengthConstraint[Set, A]) - case IndexedSeqTag => - schema.reifyHint(RefinementProvider.iterableLengthConstraint[IndexedSeq, A]) - } + ): Schema[C[A]] = schema.reifyHint( + RefinementProvider.lengthConstraint(schema.tag.iterator(_).size) + ) private def enumSchema[A]( schema: Schema.EnumerationSchema[A] 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 6135a95c..a9fbab81 100644 --- a/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala +++ b/modules/language-support/src/main/scala/playground/language/CompletionVisitor.scala @@ -228,19 +228,10 @@ object CompletionItem { private def describeCollection[C[_]]( tag: CollectionTag[C], hints: Hints, - ): String = { - import smithy4s.schema.CollectionTag.* - - val base = - tag match { - case ListTag => "list" - case SetTag => "set" - case IndexedSeqTag => "@indexedSeq list" - case VectorTag => "@vector list" - } - - sparseTraitDescription(hints).foldMap(_ + " ") + base - } + ): String = + sparseTraitDescription(hints).foldMap(_ + " ") + + uniqueItemsTraitDescription(hints).foldMap(_ + " ") + + "list" def describeService( service: DynamicSchemaIndex.ServiceWrapper @@ -293,6 +284,10 @@ object CompletionItem { hints: Hints ): Option[String] = hints.get(api.Sparse).as("@sparse") + private def uniqueItemsTraitDescription( + hints: Hints + ): Option[String] = hints.get(api.UniqueItems).as("@uniqueItems") + private def now( s: String ): ( 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 aca98573..f8db225e 100644 --- a/modules/language-support/src/test/scala/playground/language/CompletionTests.scala +++ b/modules/language-support/src/test/scala/playground/language/CompletionTests.scala @@ -300,14 +300,14 @@ object CompletionTests extends FunSuite { test("describe indexed seq") { assert.eql( CompletionItem.describeSchema(Ints.schema)(), - "@indexedSeq list Ints { member: integer Integer }", + "list Ints { member: integer Integer }", ) } test("describe set of ints") { assert.eql( CompletionItem.describeSchema(IntSet.schema)(), - "set IntSet { member: integer Integer }", + "@uniqueItems list IntSet { member: integer Integer }", ) } 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 b4da95c8..22d73a06 100644 --- a/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala +++ b/modules/plugin-core/src/main/scala/playground/plugins/PlaygroundPlugin.scala @@ -42,7 +42,7 @@ trait SimpleHttpBuilder { object SimpleHttpBuilder { def fromSimpleProtocolBuilder( - builder: SimpleProtocolBuilder[_] + builder: SimpleProtocolBuilder[?] ): SimpleHttpBuilder = new SimpleHttpBuilder {