Skip to content

Commit

Permalink
[ new ] Store Agda version information for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
banacorn committed Nov 13, 2024
1 parent 6746c5a commit ea033d8
Show file tree
Hide file tree
Showing 7 changed files with 227 additions and 93 deletions.
5 changes: 4 additions & 1 deletion lib/js/src/State.bs.js

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

12 changes: 7 additions & 5 deletions lib/js/src/State/State__Command.bs.js

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

159 changes: 123 additions & 36 deletions lib/js/test/tests/Test__Auto.bs.js

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

10 changes: 9 additions & 1 deletion src/State.res
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ let sendRequest = (
)->Promise.then(async result => {
switch result {
| Error(error) => await View.Panel.displayConnectionError(state, error)
| Ok(status) => await View.Panel.displayConnectionStatus(state, status)
| Ok(status) =>
// display the connection status
await View.Panel.displayConnectionStatus(state, status)
// update the Agda version
switch status {
| Emacs(version, _) => state.agdaVersion = Some(version)
| LSP(version, _) => state.agdaVersion = Some(version)
}
}
await responseHandlerPromise
})
Expand All @@ -89,6 +96,7 @@ let destroy = (state, alsoRemoveFromRegistry) => {
}

let make = (channels, globalStoragePath, extensionPath, editor) => {
agdaVersion: None,
editor,
document: VSCode.TextEditor.document(editor),
panelCache: ViewCache.make(),
Expand Down
2 changes: 2 additions & 0 deletions src/State/State__Command.res
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ let rec dispatchCommand = async (state: State.t, command): unit => {
View.Header.Success("Switched to version '" ++ version ++ "'"),
[Item.plainText("Found '" ++ newAgdaVersion ++ "' at: " ++ path)],
)
// update the state.agdaVersion to the new version
state.agdaVersion = Some(version)
| Ok(LSP(version, _)) =>
// should not happen
await State.View.Panel.display(
Expand Down
1 change: 1 addition & 0 deletions src/State/State__Type.res
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ type channels = {
}

type t = {
mutable agdaVersion: option<string>, // Agda version is set when connection is established
mutable editor: VSCode.TextEditor.t,
mutable document: VSCode.TextDocument.t,
panelCache: ViewCache.t,
Expand Down
Loading

0 comments on commit ea033d8

Please sign in to comment.