New features: receiving buffer events

This commit is contained in:
frelodev 2023-10-01 10:55:27 +02:00
parent 3f56943f01
commit cf99be0059

View file

@ -147,6 +147,18 @@ async function attach() {
console.log("Buffer = ", buffer, "\n"); console.log("Buffer = ", buffer, "\n");
vscode.window.showInformationMessage(`Connected to codemp workspace buffer @[${workspace}]`); vscode.window.showInformationMessage(`Connected to codemp workspace buffer @[${workspace}]`);
console.log("kiao");
buffer.callback((event:any) =>{
CACHE = `${event.span.start}${event.content}${event.span.end}`; //what's the difference between e.text and e.content like it's on lib.rs?
if (editor === undefined) { return } // TODO say something!!!!!!
let range = new vscode.Range(
editor.document.positionAt(event.span.start),
editor.document.positionAt(event.span.end)
)
editor.edit(editBuilder => editBuilder.replace(range, event.content))
});
} }