haskell / lsp

Haskell library for the Microsoft Language Server Protocol
360 stars 89 forks source link

Should ServerCapabilities depend upon ClientCapabilities? #503

Open joyfulmantis opened 1 year ago

joyfulmantis commented 1 year ago

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.

michaelpj commented 1 year ago

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.