(params: ApplyWorkspaceEditParams)
| 2952 | } |
| 2953 | |
| 2954 | private handleApplyWorkspaceEdit(params: ApplyWorkspaceEditParams): Thenable<ApplyWorkspaceEditResponse> { |
| 2955 | // This is some sort of workaround since the version check should be done by VS Code in the Workspace.applyEdit. |
| 2956 | // However doing it here adds some safety since the server can lag more behind then an extension. |
| 2957 | let workspaceEdit: WorkspaceEdit = params.edit; |
| 2958 | let openTextDocuments: Map<string, TextDocument> = new Map<string, TextDocument>(); |
| 2959 | Workspace.textDocuments.forEach((document) => openTextDocuments.set(document.uri.toString(), document)); |
| 2960 | let versionMismatch = false; |
| 2961 | if (workspaceEdit.documentChanges) { |
| 2962 | for (const change of workspaceEdit.documentChanges) { |
| 2963 | if (change.textDocument.version && change.textDocument.version >= 0) { |
| 2964 | let textDocument = openTextDocuments.get(change.textDocument.uri); |
| 2965 | if (textDocument && textDocument.version !== change.textDocument.version) { |
| 2966 | versionMismatch = true; |
| 2967 | break; |
| 2968 | } |
| 2969 | } |
| 2970 | } |
| 2971 | } |
| 2972 | if (versionMismatch) { |
| 2973 | return Promise.resolve({ applied: false }); |
| 2974 | } |
| 2975 | return Workspace.applyEdit(this._p2c.asWorkspaceEdit(params.edit)).then((value) => { return { applied: value }; }); |
| 2976 | }; |
| 2977 | |
| 2978 | public logFailedRequest(type: RPCMessageType, error: any): void { |
| 2979 | // If we get a request cancel don't log anything. |
nothing calls this directly
no test coverage detected