mirror of
https://github.com/hexedtech/codemp-vscode.git
synced 2024-11-22 07:24:49 +01:00
feat: check hash to warn when out of sync
This commit is contained in:
parent
2b68c0d102
commit
03baabfae6
1 changed files with 7 additions and 1 deletions
|
@ -190,6 +190,9 @@ export async function share(selected: vscode.TreeItem | undefined) {
|
|||
editBuilder
|
||||
.replace(range, event.content)
|
||||
});
|
||||
if(event.hash !== undefined){
|
||||
if(codemp.hash(editor.document.getText()) !== event.hash) vscode.window.showWarningMessage("Client out of sync");
|
||||
}
|
||||
locks.set(buffer_name, false);
|
||||
|
||||
}
|
||||
|
@ -284,8 +287,10 @@ export async function attach(selected: vscode.TreeItem | undefined) {
|
|||
editBuilder
|
||||
.replace(range, event.content)
|
||||
});
|
||||
if(event.hash !== undefined){
|
||||
if(codemp.hash(editor.document.getText()) !== event.hash) vscode.window.showWarningMessage("Client out of sync");
|
||||
}
|
||||
locks.set(buffer_name, false);
|
||||
|
||||
}
|
||||
consuming = false;
|
||||
});
|
||||
|
@ -322,6 +327,7 @@ export async function sync(selected: vscode.TreeItem | undefined) {
|
|||
|
||||
locks.set(buffer_name, true);
|
||||
await editor.edit(editBuilder => editBuilder.replace(range, content));
|
||||
|
||||
locks.set(buffer_name, false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue