mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 15:34:49 +01:00
New features: receiving buffer events
This commit is contained in:
parent
3f56943f01
commit
cf99be0059
1 changed files with 12 additions and 0 deletions
|
@ -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))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue