Skip to content

Commit e3c37bd

Browse files
committed
[ fix ] Timeout on Auto on Windows
1 parent 3640dec commit e3c37bd

File tree

6 files changed

+138
-51
lines changed

6 files changed

+138
-51
lines changed

lib/js/src/Main/Main.bs.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Auto.bs.js

Lines changed: 60 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/js/test/tests/Test__Util.bs.js

Lines changed: 25 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Main/Main.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ let activateWithoutContext = (
213213
log: Chan.make(),
214214
}
215215
// subscribe to the logging channel when in debug mode
216-
let debug = false
216+
let debug = true
217217
if debug {
218218
// log the event
219219
channels.log

test/tests/Test__Auto.res

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,41 @@ open Test__Util
33

44
let run = normalization => {
55
Async.it("should be responded with correct responses 1", async () => {
6+
Js.Console.log("Test__Auto: Starting makeAndLoad")
67
let ctx = await AgdaMode.makeAndLoad("Auto.agda")
8+
Js.Console.log("Test__Auto: makeAndLoad completed")
9+
switch ctx.state.agdaVersion {
10+
| Some(version) => Js.Console.log2("Test__Auto: Agda version:", version)
11+
| None => Js.Console.log("Test__Auto: No Agda version found")
12+
}
713

14+
Js.Console.log("Test__Auto: Looking for goal at index 0")
815
let responses = switch Goals.getGoalByIndex(ctx.state.goals, 0) {
916
| Some(goal) =>
17+
Js.Console.log("Test__Auto: Found goal, sending Auto request")
1018
await ctx.state->State__Connection.sendRequestAndCollectResponses(
1119
Request.Auto(normalization, goal),
1220
)
13-
| None => []
21+
| None =>
22+
Js.Console.log("Test__Auto: No goal found at index 0")
23+
[]
1424
}
25+
Js.Console.log("Test__Auto: Auto request completed")
1526

1627
let filteredResponses = responses->Array.filter(filteredResponse)
28+
Js.Console.log2("Test__Auto: Filtered response count:", Array.length(filteredResponses))
1729

1830
switch ctx.state.agdaVersion {
1931
| Some(version) =>
32+
Js.Console.log2("Test__Auto: Checking version >= 2.7.0 for version:", version)
2033
if Util.Version.gte(version, "2.7.0") {
34+
Js.Console.log("Test__Auto: Using >= 2.7.0 assertion")
2135
Assert.deepStrictEqual(
2236
filteredResponses,
2337
[GiveAction(0, GiveString("n")), InteractionPoints([1])],
2438
)
2539
} else {
40+
Js.Console.log("Test__Auto: Using < 2.7.0 assertion")
2641
Assert.deepStrictEqual(
2742
filteredResponses,
2843
[
@@ -34,6 +49,7 @@ let run = normalization => {
3449
}
3550
| None => Assert.fail("No Agda version found")
3651
}
52+
Js.Console.log("Test__Auto: Assertion completed successfully")
3753
})
3854

3955
Async.it("should be responded with correct responses 2", async () => {
@@ -71,7 +87,7 @@ let run = normalization => {
7187
})
7288
}
7389

74-
describe("agda-mode.auto", () => {
90+
describe_only("agda-mode.auto", () => {
7591
This.timeout(4000)
7692

7793
describe("AsIs", () => {

test/tests/Test__Util.res

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,36 +391,66 @@ module AgdaMode = {
391391
}
392392

393393
let makeAndLoad = async filepath => {
394+
Js.Console.log2("Test__Util: makeAndLoad starting with filepath:", filepath)
394395
let rawFilepath =
395396
VSCode.Uri.joinPath(Path.extensionUri, ["test/tests/assets", filepath])->VSCode.Uri.fsPath
397+
Js.Console.log2("Test__Util: rawFilepath resolved to:", rawFilepath)
398+
396399
// set name for searching Agda
400+
Js.Console.log("Test__Util: Setting Agda version to 'agda'")
397401
await Config.Connection.setAgdaVersion("agda")
402+
Js.Console.log("Test__Util: Agda version set successfully")
403+
398404
// make sure that "agda" exists in PATH
405+
Js.Console.log("Test__Util: Checking if 'agda' command exists")
399406
await commandExists("agda")
407+
Js.Console.log("Test__Util: 'agda' command exists, proceeding")
408+
400409
//
401410
let load = async (channels: State.channels, filepath) => {
411+
Js.Console.log2("Test__Util: load function starting with filepath:", filepath)
402412
let (promise, resolve, _) = Util.Promise_.pending()
413+
Js.Console.log("Test__Util: Created pending promise")
403414

404415
let disposable = channels.commandHandled->Chan.on(command => {
416+
Js.Console.log2("Test__Util: Received command:", command)
405417
if command == Command.Load {
418+
Js.Console.log("Test__Util: Command matches Load, resolving promise")
406419
resolve()
420+
} else {
421+
Js.Console.log("Test__Util: Command does not match Load")
407422
}
408423
})
424+
Js.Console.log("Test__Util: Set up commandHandled listener")
425+
426+
Js.Console.log("Test__Util: Opening file...")
409427
let _ = await File.open_(filepath) // need to open the file first somehow
428+
Js.Console.log("Test__Util: File opened successfully")
429+
430+
Js.Console.log("Test__Util: Executing 'agda-mode.load' command...")
410431
switch await executeCommand("agda-mode.load") {
411-
| None => raise(Failure("Cannot load " ++ filepath))
432+
| None =>
433+
Js.Console.log("Test__Util: executeCommand returned None")
434+
raise(Failure("Cannot load " ++ filepath))
412435
| Some(Ok(state)) =>
436+
Js.Console.log("Test__Util: executeCommand returned Ok, waiting for promise...")
413437
await promise
438+
Js.Console.log("Test__Util: Promise resolved, cleaning up...")
414439
disposable() // stop listening to responses
440+
Js.Console.log("Test__Util: load function completed successfully")
415441
state
416442
| Some(Error(error)) =>
443+
Js.Console.log("Test__Util: executeCommand returned Error")
417444
let (header, body) = Connection.Error.toString(error)
418445
raise(Failure(header ++ "\n" ++ body))
419446
}
420447
}
421448

449+
Js.Console.log("Test__Util: Activating extension...")
422450
let channels = activateExtension()
451+
Js.Console.log("Test__Util: Extension activated, calling load function...")
423452
let state = await load(channels, rawFilepath)
453+
Js.Console.log("Test__Util: load function returned, continuing with makeAndLoad...")
424454

425455
state.channels.log->Chan.emit(AgdaModeOperation("makeAndLoad", rawFilepath))
426456

0 commit comments

Comments
 (0)