lsp icon indicating copy to clipboard operation
lsp copied to clipboard

Should ServerCapabilities depend upon ClientCapabilities?

Open joyfulmantis opened this issue 1 year ago • 1 comments

Currently, inferCapabilities is passed a version of ClientCapabilities, and the passed client capabilities are used twice, once for RenameOptions and once for CodeActionKinds. That's a very small portion of the capabilities that could depend on ClientCapabilities. I'm of the position that ServerCapabilities shouldn't depend at all upon ClientCapabilities, after all, capabilities mean what we can do, not what we will do (which is to comply with the client capabilities in server code).

As long as no one objects I would like to stop passing ClientCapabilitise to inferCapabilities, and remove any code in there that refers to it.

joyfulmantis avatar Jul 08 '23 12:07 joyfulmantis

Sadly, the spec says no...

RenameOptions may only be specified if the client states that it supports prepareSupport in its initial initialize request.

and

The server provides code actions. The CodeActionOptions return type is only valid if the client signals code action literal support via the property textDocument.codeAction.codeActionLiteralSupport.

Stupid, but that's what it says. It would be super helpful to document this, though.

michaelpj avatar Jul 09 '23 13:07 michaelpj