From f4d7732e9ccd152912d2df1592e24221e6d2f098 Mon Sep 17 00:00:00 2001 From: Dirk Baeumer Date: Tue, 28 Feb 2017 22:15:56 +0100 Subject: [PATCH] Make WorkspaceEdit backwards compatible --- protocol.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/protocol.md b/protocol.md index 2b57cb3..58b8409 100644 --- a/protocol.md +++ b/protocol.md @@ -18,7 +18,8 @@ The 1.x version of this document can be found [here](https://github.com/Microsof ### 02/28/2017 -Updated the specification to correctly describe the breaking changes from 2.x to 3.x around `WorkspaceEdit`and `TextDocumentEdit`. +* Make the `WorkspaceEdit` changes backwards compatible. +* Updated the specification to correctly describe the breaking changes from 2.x to 3.x around `WorkspaceEdit`and `TextDocumentEdit`. ## Messages overview @@ -449,14 +450,21 @@ export interface TextDocumentEdit { #### WorkspaceEdit -> **Breaking** A workspace edit represents changes to many resources managed in the workspace. A workspace edit now consists of an array of `TextDocumentEdit`s each describing a change to a single text document. +> **Changed** A workspace edit represents changes to many resources managed in the workspace. The edit should either provide `changes` or `documentChanges`. If documentChanges are present they are preferred over `changes` if the client can handle versioned document edits. ```typescript -interface WorkspaceEdit { +export interface WorkspaceEdit { /** * Holds changes to existing resources. */ - changes: TextDocumentEdit[]; + changes?: { [uri: string]: TextEdit[]; }; + + /** + * An array of `TextDocumentEdit`s to express changes to specific a specific + * version of a text document. Whether a client supports versioned document + * edits is expressed via `WorkspaceClientCapabilites.versionedWorkspaceEdit`. + */ + documentChanges?: TextDocumentEdit[]; } ```