Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kubukoz committed Oct 28, 2024
1 parent cbf81eb commit 70c42f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,6 @@ object LanguageServerIntegrationTestSharedServer

def sharedResource: Resource[IO, Res] = makeServer(testWorkspacesBase / "default")

test("server init produces logs consistent with the workspace folder") { f =>
val initLogs = List(
TestClient
.MessageLog(
MessageType.Info,
s"Hello from Smithy Playground v${BuildInfo.version}",
),
TestClient.MessageLog(
MessageType.Info,
"Loaded Smithy Playground server with 2 sources, 0 imports, 2 dependencies and 0 plugins",
),
)

// logs produced during an implicit initialization in the resource setup
f.client.getEvents.map { events =>
assert.same(
events,
initLogs,
)
}
}

test("completions").apply { f =>
f.server
.completion(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import playground.language.Uri
import playground.lsp.LanguageServer
import playground.lsp.MainServer
import playground.lsp.buildinfo.BuildInfo
import weaver.SourceLocation

import scala.jdk.CollectionConverters.*
import scala.util.chaining.*
Expand Down Expand Up @@ -74,7 +75,7 @@ trait LanguageServerIntegrationTests {
),
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",
),
)
IO {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package playground.smithyql.parser

import io.circe.Codec
import io.circe.Decoder
import io.circe.Encoder
import playground.smithyql.Binding
import playground.smithyql.Comment
import playground.smithyql.Diffs.given
Expand Down Expand Up @@ -31,9 +33,16 @@ object Codecs {

given Codec[UseClause[WithSource]] = Codec.AsObject.derived

// why list though? recursion limit?
given Codec[List[WithSource[InputNode[WithSource]]]] = Codec.AsObject.derived
given Codec[WithSource[InputNode[WithSource]]] = Codec.AsObject.derived

given Codec[InputNode[WithSource]] = Codec.AsObject.derived

// strange thing - somehow doesn't get picked up automatically.
given Codec[List[WithSource[InputNode[WithSource]]]] = Codec.from(
Decoder.decodeList,
Encoder.encodeList,
)

given Codec[Listed[WithSource]] = Codec.AsObject.derived

given Codec[Binding[WithSource]] = Codec.AsObject.derived
Expand Down

0 comments on commit 70c42f5

Please sign in to comment.