eclipse-lsp4j / lsp4j

A Java implementation of the language server protocol intended to be consumed by tools and language servers implemented in Java.
https://eclipse.org/lsp4j
Other
582 stars 141 forks source link

Name optional in WorkspaceFolder? #741

Closed cdietrich closed 10 months ago

cdietrich commented 1 year ago

Name is optional in WorkspaceFolder constructor, but not in the spec. is this intentional or an oversight?

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspaceFolder

pisv commented 1 year ago

It does not seem to be intentional.

It got introduced via #133 when this feature was still a proposal.

Perhaps at that stage the name was optional.

But since the time this feature was added to the spec (LSP 3.6), the name was required: https://github.com/microsoft/language-server-protocol/commit/39b118153e7f9ecada27a01a1837edd1823ccfcd

jnt0r commented 10 months ago

@pisv would you like to add the name to the constructor, or what solution would you prefer? Would it be an incompatible change or not, as it throws errors if not set?

pisv commented 10 months ago

@jnt0r Thanks for the reminder.

I think that the name should be made required, its javadoc changed to match the current wording in the spec, and the constructor WorkspaceFolder(String uri) removed. Also, the breaking change should be mentioned in the change log.

Would you like to submit a PR for this? Otherwise, I'll handle it, no problem at all.

jnt0r commented 10 months ago

Alright. Yes, I can submit a PR for that.