eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.

Home Page:https://eclipse.org/lsp4j

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is `WorkspaceEditCapabilities`'s constructor setting `documentChanges` is deprecated?

ForNeVeR opened this issue · comments

See this constructor:

@Deprecated
new(Boolean documentChanges) {
this.documentChanges = documentChanges
}

It is unclear why it was deprecated. This deprecation notice has been added in commit 43a0e07, seemingly after a review in #277 and deprecation of Boolean resourceChanges member of the same type.

Perhaps @yaohaizh just mistaken resourceChanges and documentChanges while doing that? Anyway, I think it's a good idea to add an explanation to the deprecation notice (it looks like you can just safely use setDocumentChanges instead). Optionally, we may un-deprecate the constructor in question.

Although it is indeed unclear why this constructor was deprecated, I'd be inclined to just remove it now. There are as many as five properties in WorkspaceEditCapabilities -- all of them are optional, and there seems to be nothing special in the documentChanges property to justify this constructor.

@jonahgraham WDYT?

If you don't wanna to introduce a breaking change for nothing, then it would be better to maybe start by providing a description in the deprecation annotation 😅

I added some documentation based on this conversation. We can remove the deprecated code at some point, but I recommend we do that around the time we update to soon to be released (I assume?) LSP 3.18 spec.