ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

Semantic highlighting doesn't check client capabilities before sending tokens

Open ddickstein opened this issue 2 years ago • 4 comments

As title. Maybe a coding pattern should be adopted to enforce/encourage compatibility checking.

ddickstein avatar Jun 14 '23 18:06 ddickstein

What problems does this cause on the client?

jfeser avatar Jun 20 '23 22:06 jfeser

The displaying of semantic tokens even when a client wishes to opt out by indicating that it is not capable of displaying them.

ddickstein avatar Jun 20 '23 22:06 ddickstein

In general, it's misbehavior to send messages without checking that the client has the appropriate capability (and likewise, for the client to send the server messages without checking server capabilities).

ddickstein avatar Jun 20 '23 22:06 ddickstein

Makes sense.

We should check the following:

  • multilineTokenSupport
  • overlappingTokenSupport (I doubt we're sending overlapping tokens)
  • formats (although there's only one specified format right now)
  • tokenTypes
  • tokenModifiers

jfeser avatar Jun 20 '23 22:06 jfeser