-
-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Description
Calva currently has an API for getting access to REPL output messages, but for some use cases it makes more sense to get direct access to the nrepl messages themselves. For example, this would allow for writing a Joyride script to send a notification when a repl command that has run for more than 5 seconds completes.
Here's a strawman proposal for the new API to get a conversation started:
function onNreplMessage(
callback: (msg: NreplMessage) => void
) => vscode.Disposable
interface BaseNreplMessage {
"id": string
"session": string
}
interface SentNreplMessage extends BaseNreplMessage {
"calva.type": "sent"
"op": string
...
}
interface ReceivedNreplMessage extends BaseNreplMessage {
"calva.type": "received"
...
}
type NreplMessage: SentNreplMessage | ReceivedNreplMessageConsiderations:
- Should this be one API or two? (one for sent messages and one for received messages)
- It's going to be impossible to fully ts-type the messages without enumerating all the ops, but that should be fine from an API consumer perspective since it's easy to introspect the messages. Will it cause any internal issues for Calva?
- The callback probably shouldn't be allowed to block or disrupt Calva's processing of an nrepl message.
Metadata
Metadata
Assignees
Labels
No labels