Skip to content

Commit 3169665

Browse files
authored
Backport non-controversial changes from treesitter branch (#506)
* Backport non-controversial changes from treesitter branch * make build happy
1 parent 9e83f43 commit 3169665

File tree

9 files changed

+39
-30
lines changed

9 files changed

+39
-30
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ jobs:
5555
run: nix develop --command bash -c 'cd vscode-extension && yarn && SERVER_VERSION=$(cat ../.version) xvfb-run --auto-servernum yarn test'
5656

5757
- name: Show extension test logs
58-
if: job.status == 'failure'
58+
if: always() && job.status == 'failure'
5959
run: cat vscode-extension/fixture/smithyql-log.txt | tail --lines 1000

build.sbt

+16-7
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,26 @@ lazy val e2e = module("e2e")
228228
buildInfoKeys ++=
229229
Seq[BuildInfoKey.Entry[_]]( // do you know how to simplify this? let me know please!
230230
Def
231-
.task((lsp / Compile / fullClasspath).value.map(_.data).map(_.toString))
232-
.taskValue
233-
.named("lspClassPath"),
234-
Def
235-
.task(
236-
(lsp / Compile / mainClass).value.getOrElse(sys.error("didn't find main class in lsp"))
231+
.task {
232+
s"""${(lsp / organization).value}::${(lsp / moduleName).value}:${(lsp / version).value}"""
233+
}
234+
// todo: replace with a full publishLocal before e2e in particular gets run (but not before tests run normally)
235+
.dependsOn(
236+
lsp / publishLocal,
237+
languageSupport / publishLocal,
238+
core / publishLocal,
239+
parser / publishLocal,
240+
pluginCore / publishLocal,
241+
source / publishLocal,
242+
ast / publishLocal,
243+
formatter / publishLocal,
244+
protocol4s / publishLocal,
237245
)
238246
.taskValue
239-
.named("lspMainClass"),
247+
.named("lspArtifact")
240248
),
241249
publish / skip := true,
250+
Test / fork := true,
242251
)
243252
.dependsOn(lsp)
244253

flake.lock

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
inputs = {
3-
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
3+
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
44
flake-utils.url = "github:numtide/flake-utils";
55
};
66

7-
outputs = { nixpkgs, flake-utils, ... }:
7+
outputs = { self, nixpkgs, flake-utils, ... }:
88
flake-utils.lib.eachDefaultSystem (
99
system:
1010
let

modules/ast/src/main/scala/playground/smithyql/AST.scala

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import cats.Applicative
44
import cats.Functor
55
import cats.Id
66
import cats.Show
7+
import cats.arrow.FunctionK
78
import cats.data.NonEmptyList
89
import cats.kernel.Eq
910
import cats.kernel.Order
@@ -87,7 +88,7 @@ final case class SourceFile[F[_]](
8788

8889
def mapK[G[_]: Functor](
8990
fk: F ~> G
90-
): AST[G] = SourceFile(
91+
): SourceFile[G] = SourceFile(
9192
prelude = prelude.mapK(fk),
9293
statements = fk(statements).map(_.map(_.mapK(fk))),
9394
)
@@ -132,9 +133,9 @@ final case class OperationName[F[_]](
132133
text: String
133134
) extends AST[F] {
134135

135-
def mapK[G[_]: Functor](
136-
fk: F ~> G
137-
): OperationName[G] = copy()
136+
def mapK[G[_]: Functor](fk: FunctionK[F, G]): OperationName[G] = retag[G]
137+
138+
def retag[G[_]]: OperationName[G] = copy()
138139

139140
}
140141

@@ -189,7 +190,7 @@ final case class QueryOperationName[F[_]](
189190
fk: F ~> G
190191
): QueryOperationName[G] = QueryOperationName(
191192
identifier.map(fk(_)),
192-
fk(operationName).map(_.mapK(fk)),
193+
fk(operationName).map(_.retag[G]),
193194
)
194195

195196
}

modules/ast/src/test/scala/playground/Assertions.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Assertions extends Expectations.Helpers {
2323
val stringWithResets = d.show()(conf).linesWithSeparators.map(Console.RESET + _).mkString
2424

2525
failure(
26-
s"Diff failed:\n${Console.RESET}(${conf.left("expected")}, ${conf.right("actual")})\n\n" + stringWithResets
26+
s"Diff failed:\n${Console.RESET}(${conf.left("actual")}, ${conf.right("expected")})\n\n" + stringWithResets
2727
)
2828
}
2929

modules/e2e/src/test/scala/playground/e2e/E2ETests.scala

+3-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ object E2ETests extends SimpleIOSuite {
7474

7575
val builder =
7676
new ProcessBuilder(
77-
"java",
78-
"-cp",
79-
BuildInfo.lspClassPath.mkString(":"),
80-
BuildInfo.lspMainClass,
77+
"cs",
78+
"launch",
79+
BuildInfo.lspArtifact,
8180
)
8281
// Watch process stderr in test runner
8382
.redirectError(Redirect.INHERIT)

modules/source/src/main/scala/playground/smithyql/WithSource.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ final case class SourceRange(
6464
// Assuming this range corresponds to a bracket/brace/quote etc.,
6565
// shrink it by one character on each side.
6666
def shrink1: SourceRange = copy(
67-
start = start.copy(index = start.index + 1),
68-
end = end.copy(index = end.index - 1),
67+
start = start.moveRight(1),
68+
end = end.moveLeft(1),
6969
)
7070

7171
def render: String = s"${start.index}-${end.index}"

smithy-build.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"sources": ["modules/core/src/test/smithy"],
2+
"sources": ["modules/examples/src/main/smithy"],
33
"mavenDependencies": [
44
"com.disneystreaming.alloy:alloy-core:0.3.14",
55
"com.disneystreaming.smithy4s:smithy4s-protocol:0.18.26",

0 commit comments

Comments
 (0)