Skip to content

Commit

Permalink
Backport non-controversial changes from treesitter branch (#506)
Browse files Browse the repository at this point in the history
* Backport non-controversial changes from treesitter branch

* make build happy
  • Loading branch information
kubukoz authored Dec 24, 2024
1 parent 9e83f43 commit 3169665
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ jobs:
run: nix develop --command bash -c 'cd vscode-extension && yarn && SERVER_VERSION=$(cat ../.version) xvfb-run --auto-servernum yarn test'

- name: Show extension test logs
if: job.status == 'failure'
if: always() && job.status == 'failure'
run: cat vscode-extension/fixture/smithyql-log.txt | tail --lines 1000
23 changes: 16 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,26 @@ lazy val e2e = module("e2e")
buildInfoKeys ++=
Seq[BuildInfoKey.Entry[_]]( // do you know how to simplify this? let me know please!
Def
.task((lsp / Compile / fullClasspath).value.map(_.data).map(_.toString))
.taskValue
.named("lspClassPath"),
Def
.task(
(lsp / Compile / mainClass).value.getOrElse(sys.error("didn't find main class in lsp"))
.task {
s"""${(lsp / organization).value}::${(lsp / moduleName).value}:${(lsp / version).value}"""
}
// todo: replace with a full publishLocal before e2e in particular gets run (but not before tests run normally)
.dependsOn(
lsp / publishLocal,
languageSupport / publishLocal,
core / publishLocal,
parser / publishLocal,
pluginCore / publishLocal,
source / publishLocal,
ast / publishLocal,
formatter / publishLocal,
protocol4s / publishLocal,
)
.taskValue
.named("lspMainClass"),
.named("lspArtifact")
),
publish / skip := true,
Test / fork := true,
)
.dependsOn(lsp)

Expand Down
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { nixpkgs, flake-utils, ... }:
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (
system:
let
Expand Down
11 changes: 6 additions & 5 deletions modules/ast/src/main/scala/playground/smithyql/AST.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import cats.Applicative
import cats.Functor
import cats.Id
import cats.Show
import cats.arrow.FunctionK
import cats.data.NonEmptyList
import cats.kernel.Eq
import cats.kernel.Order
Expand Down Expand Up @@ -87,7 +88,7 @@ final case class SourceFile[F[_]](

def mapK[G[_]: Functor](
fk: F ~> G
): AST[G] = SourceFile(
): SourceFile[G] = SourceFile(
prelude = prelude.mapK(fk),
statements = fk(statements).map(_.map(_.mapK(fk))),
)
Expand Down Expand Up @@ -132,9 +133,9 @@ final case class OperationName[F[_]](
text: String
) extends AST[F] {

def mapK[G[_]: Functor](
fk: F ~> G
): OperationName[G] = copy()
def mapK[G[_]: Functor](fk: FunctionK[F, G]): OperationName[G] = retag[G]

def retag[G[_]]: OperationName[G] = copy()

}

Expand Down Expand Up @@ -189,7 +190,7 @@ final case class QueryOperationName[F[_]](
fk: F ~> G
): QueryOperationName[G] = QueryOperationName(
identifier.map(fk(_)),
fk(operationName).map(_.mapK(fk)),
fk(operationName).map(_.retag[G]),
)

}
Expand Down
2 changes: 1 addition & 1 deletion modules/ast/src/test/scala/playground/Assertions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.left("expected")}, ${conf.right("actual")})\n\n" + stringWithResets
s"Diff failed:\n${Console.RESET}(${conf.left("actual")}, ${conf.right("expected")})\n\n" + stringWithResets
)
}

Expand Down
7 changes: 3 additions & 4 deletions modules/e2e/src/test/scala/playground/e2e/E2ETests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ object E2ETests extends SimpleIOSuite {

val builder =
new ProcessBuilder(
"java",
"-cp",
BuildInfo.lspClassPath.mkString(":"),
BuildInfo.lspMainClass,
"cs",
"launch",
BuildInfo.lspArtifact,
)
// Watch process stderr in test runner
.redirectError(Redirect.INHERIT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ final case class SourceRange(
// Assuming this range corresponds to a bracket/brace/quote etc.,
// shrink it by one character on each side.
def shrink1: SourceRange = copy(
start = start.copy(index = start.index + 1),
end = end.copy(index = end.index - 1),
start = start.moveRight(1),
end = end.moveLeft(1),
)

def render: String = s"${start.index}-${end.index}"
Expand Down
2 changes: 1 addition & 1 deletion smithy-build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sources": ["modules/core/src/test/smithy"],
"sources": ["modules/examples/src/main/smithy"],
"mavenDependencies": [
"com.disneystreaming.alloy:alloy-core:0.3.14",
"com.disneystreaming.smithy4s:smithy4s-protocol:0.18.26",
Expand Down

0 comments on commit 3169665

Please sign in to comment.