-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WorkspaceEdit is incompatible with the protocol #173
Comments
@dbaeumer 73d3500 seems to have broken the asWorkspaceEdit. This is now a blocker for redhat-developer/vscode-java#99 since we can not move to the 3.x version of the library. |
@gorkem I will have a look. I know that we discussed this but I need to refresh my memory. |
Reading through the code I remember why we changed this for the 3.0 version of the protocol. The reason was that the old I know this is breaking but to support proper version checking when applying text edits this was the best way to go forward. Now users of the protocol have to think about this. So bottom line is that the spec is incorrect. I will fix this. Would you be able to adopt this? |
I am concerned that this will break all the existing implementations, not all clients are able to move as quick. I think we need a migration path on this. Perhaps we can leave the I think we should consider microsoft/language-server-protocol#41 before making changes to The chaps on LSP4J @svenefftinge or @akosyakov can tell how quickly they can respond to such changes. It is pretty quick for jdt.ls once LSP4J has a build with adopting changes |
I updated the documentation / spec of the protocol. |
The old clients is a fair argument. Addressing this should be done like all the new features in 3.0.x. We should have a client capability property specifying which type of work space edit the client expects together. If the new format is not supported by the client then we should return the old structure. I missed this for this change but did it for all new features for 3.0.x. Don't know why I forgot it here. Will look into this this week. |
What I will do is the following. I will declare WorkspaceEdit as follows: /**
* 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.
*/
export interface WorkspaceEdit {
/**
* Holds changes to existing resources.
*/
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[];
} and add a ClientCapability: versionedWorkspaceEdit?: boolean; If set the by the client the server is allowed to send TextDocumentEdit arrays in the property documentChanges. |
The correct client capability will look like: export interface WorkspaceClientCapabilites {
...
/**
* Capabilities specific to `WorkspaceEdit`s
*/
workspaceEdit?: {
/**
* The client supports versioned document changes in `WorkspaceEdit`s
*/
documentChanges?: boolean;
};
...
} |
A fix is available on release/3.2.0-alpha.1. Need to review tomorrow and then deliver a next release. |
@gorkem lsp4j is updated according to changes in the protocol: eclipse-lsp4j/lsp4j@46b8d7a |
I pushed a 3.2.0-alpha.x version to npm under the next tag in case you want to give it a try. |
https://github.com/Microsoft/vscode-languageserver-node/blob/master/types/src/main.ts#L366
In the protocol it described as follows:
Also asWorkspaceEdit is wrong.
This is cause of the problem in my extension.
It worked on
"vscode-languageclient": "^2.6.3"
, but it doesn't on"vscode-languageclient": "3.0.4"
.The text was updated successfully, but these errors were encountered: