vscode-zap
Advanced tools
Comparing version 0.0.44 to 0.0.45
@@ -34,12 +34,2 @@ import { MessageStream } from "libzap/lib/remote/client"; | ||
revertTextDocumentToBase(doc: vscode.TextDocument): Thenable<void>; | ||
/** | ||
* saveDocument saves the document. For files, it should just call | ||
* doc.save(). Implementations may provide custom handling for | ||
* documents with other URI schemes. | ||
* | ||
* It is necessary because currently vscode only allows file:/// | ||
* documents to return true from doc.save(), but we want other | ||
* documents to have that same behavior. | ||
*/ | ||
saveDocument(doc: vscode.TextDocument): Thenable<boolean>; | ||
openChannel(id: string): Thenable<MessageStream>; | ||
@@ -46,0 +36,0 @@ /** |
@@ -146,8 +146,2 @@ "use strict"; | ||
} | ||
saveDocument(doc) { | ||
if (doc.uri.scheme === "file") { | ||
return doc.save(); | ||
} | ||
throw new Error(`saveDocument called on non-file document ${doc.uri.toString()}`); | ||
} | ||
openChannel(id) { | ||
@@ -154,0 +148,0 @@ if (id !== "zap") { |
@@ -37,3 +37,3 @@ "use strict"; | ||
this.onOpListener = op => { | ||
console.log(`WARNING: Op ignored because Workspace.onOpListener is not set: ${JSON.stringify(op)}`); | ||
console.log(`WARNING: Op ignored because Workspace.onOpListener is not set: ${workspace_1.toString(op)}`); | ||
}; | ||
@@ -122,3 +122,3 @@ this.outputChannel = vscode.window.createOutputChannel("zap controller"); | ||
catch (err) { | ||
const msg = `applying op failed: ${JSON.stringify(this.applyingOp)}: ${err}`; | ||
const msg = `applying op failed: ${workspace_1.toString(this.applyingOp)}: ${err}`; | ||
console.error(msg); | ||
@@ -158,5 +158,6 @@ this.applyingOp = undefined; | ||
else { | ||
if (!(yield this.environment.saveDocument(doc))) { | ||
if (!(yield doc.save())) { | ||
throw new Error(`saving ${doc.uri.toString()} failed (current text is: ${JSON.stringify(doc.getText())})`); | ||
} | ||
this.documentIsDirty.set(doc.uri.toString(), false); | ||
} | ||
@@ -208,3 +209,3 @@ } | ||
if (!ok) { | ||
throw new Error(`applyWorkspaceEdit failed: ${JSON.stringify(op)}`); | ||
throw new Error(`applyWorkspaceEdit failed: ${workspace_1.toString(op)}`); | ||
} | ||
@@ -221,3 +222,3 @@ if (this.subtractOp) { | ||
if (fileName !== null && edit.has(doc.uri) && !op.edit[`#${fileName}`]) { | ||
if (!(yield this.environment.saveDocument(doc))) { | ||
if (!(yield doc.save())) { | ||
throw new Error(`after applying edit to ${doc.uri.toString()}, save failed - edit was: ${JSON.stringify(edit.get(doc.uri))}`); | ||
@@ -312,3 +313,3 @@ } | ||
} | ||
console.log(`Workspace.reset: going to apply composed=${JSON.stringify(composed)}`); | ||
console.log(`Workspace.reset: going to apply composed=${workspace_1.toString(composed)}`); | ||
yield this.apply(composed); | ||
@@ -367,3 +368,3 @@ } | ||
if (oldText === newText) { | ||
console.error(`unexpected: document ${doc.uri.toString()} is dirty, but its on-disk contents equal its in-memory contents`); | ||
console.error(`unexpected: document ${doc.uri.toString()} is dirty, but its on- disk contents equal its in -memory contents`); | ||
} | ||
@@ -508,3 +509,4 @@ this.onOpListener({ | ||
} | ||
const msg = `Client=${process.env.ZAP_E2E_NAME} Change ${doc.uri.toString()}: ${JSON.stringify(op)} doc.isDirty=${doc.isDirty} wasDirty=${wasDirty} contents=${JSON.stringify(doc.getText())}} changes=${JSON.stringify(contentChangesToProcess)}`; | ||
const msg = `Client= ${process.env.ZAP_E2E_NAME} Change ${doc.uri.toString()}: ${workspace_1.toString(op)} doc.isDirty = ${doc.isDirty} wasDirty = ${wasDirty} contents = ${JSON.stringify(doc.getText())} | ||
} changes= ${JSON.stringify(contentChangesToProcess)}`; | ||
if (process.env.DEV && process.env.DEV_NOISY) { | ||
@@ -511,0 +513,0 @@ console.log(msg); |
@@ -5,3 +5,3 @@ { | ||
"description": "WIP", | ||
"version": "0.0.44", | ||
"version": "0.0.45", | ||
"publisher": "sqs", | ||
@@ -42,3 +42,3 @@ "preview": true, | ||
"dependencies": { | ||
"libzap": "^0.0.44", | ||
"libzap": "^0.0.45", | ||
"open": "^0.0.5", | ||
@@ -45,0 +45,0 @@ "vscode-jsonrpc": "3.0.1-alpha.7" |
@@ -67,13 +67,2 @@ import { MessageStream } from "libzap/lib/remote/client"; | ||
/** | ||
* saveDocument saves the document. For files, it should just call | ||
* doc.save(). Implementations may provide custom handling for | ||
* documents with other URI schemes. | ||
* | ||
* It is necessary because currently vscode only allows file:/// | ||
* documents to return true from doc.save(), but we want other | ||
* documents to have that same behavior. | ||
*/ | ||
saveDocument(doc: vscode.TextDocument): Thenable<boolean>; | ||
// openChannel opens a bidirectional channel to a server | ||
@@ -80,0 +69,0 @@ // identified by id. |
@@ -149,9 +149,2 @@ import * as vscode from "vscode"; | ||
saveDocument(doc: vscode.TextDocument): Thenable<boolean> { | ||
if (doc.uri.scheme === "file") { | ||
return doc.save(); | ||
} | ||
throw new Error(`saveDocument called on non-file document ${doc.uri.toString()}`); | ||
} | ||
openChannel(id: string): Thenable<MessageStream> { | ||
@@ -158,0 +151,0 @@ if (id !== "zap") { |
import * as vscode from "vscode"; | ||
import { noop, transform as transformWorkspaceOps, composeAll as composeAllWorkspaceOps, WorkspaceOp, Sel, stripFileOrBufferPathPrefix } from "libzap/lib/ot/workspace"; | ||
import { noop, transform as transformWorkspaceOps, composeAll as composeAllWorkspaceOps, WorkspaceOp, Sel, stripFileOrBufferPathPrefix, toString as opToString } from "libzap/lib/ot/workspace"; | ||
import { Workspace as HandlerWorkspace } from "libzap/lib/remote/handler"; | ||
@@ -28,3 +28,3 @@ import { WorkspaceWillSaveFileParams } from "libzap/lib/remote/protocol"; | ||
this.onOpListener = op => { | ||
console.log(`WARNING: Op ignored because Workspace.onOpListener is not set: ${JSON.stringify(op)}`); | ||
console.log(`WARNING: Op ignored because Workspace.onOpListener is not set: ${opToString(op)}`); | ||
}; | ||
@@ -135,3 +135,3 @@ this.outputChannel = vscode.window.createOutputChannel("zap controller"); | ||
} catch (err) { | ||
const msg = `applying op failed: ${JSON.stringify(this.applyingOp)}: ${err}`; | ||
const msg = `applying op failed: ${opToString(this.applyingOp)}: ${err}`; | ||
console.error(msg); | ||
@@ -170,5 +170,6 @@ | ||
} else { | ||
if (!await this.environment.saveDocument(doc)) { | ||
if (!await doc.save()) { | ||
throw new Error(`saving ${doc.uri.toString()} failed (current text is: ${JSON.stringify(doc.getText())})`); | ||
} | ||
this.documentIsDirty.set(doc.uri.toString(), false); | ||
} | ||
@@ -225,3 +226,3 @@ } | ||
if (!ok) { | ||
throw new Error(`applyWorkspaceEdit failed: ${JSON.stringify(op)}`); | ||
throw new Error(`applyWorkspaceEdit failed: ${opToString(op)}`); | ||
} | ||
@@ -240,3 +241,3 @@ | ||
if (fileName !== null && edit.has(doc.uri) && !op.edit![`#${fileName}`]) { | ||
if (!await this.environment.saveDocument(doc)) { | ||
if (!await doc.save()) { | ||
throw new Error(`after applying edit to ${doc.uri.toString()}, save failed - edit was: ${JSON.stringify(edit.get(doc.uri))}`); | ||
@@ -335,3 +336,3 @@ } | ||
} | ||
console.log(`Workspace.reset: going to apply composed=${JSON.stringify(composed)}`); | ||
console.log(`Workspace.reset: going to apply composed=${opToString(composed)}`); | ||
await this.apply(composed); | ||
@@ -396,3 +397,3 @@ } | ||
if (oldText === newText) { | ||
console.error(`unexpected: document ${doc.uri.toString()} is dirty, but its on-disk contents equal its in-memory contents`); | ||
console.error(`unexpected: document ${doc.uri.toString()} is dirty, but its on- disk contents equal its in -memory contents`); | ||
} | ||
@@ -555,3 +556,4 @@ this.onOpListener!({ | ||
const msg = `Client=${process.env.ZAP_E2E_NAME} Change ${doc.uri.toString()}: ${JSON.stringify(op)} doc.isDirty=${doc.isDirty} wasDirty=${wasDirty} contents=${JSON.stringify(doc.getText())}} changes=${JSON.stringify(contentChangesToProcess)}`; | ||
const msg = `Client= ${process.env.ZAP_E2E_NAME} Change ${doc.uri.toString()}: ${opToString(op)} doc.isDirty = ${doc.isDirty} wasDirty = ${wasDirty} contents = ${JSON.stringify(doc.getText())} | ||
} changes= ${JSON.stringify(contentChangesToProcess)}`; | ||
if (process.env.DEV && process.env.DEV_NOISY) { | ||
@@ -558,0 +560,0 @@ console.log(msg); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
401911
5968
+ Addedlibzap@0.0.45(transitive)
- Removedlibzap@0.0.44(transitive)
Updatedlibzap@^0.0.45