microsoft / language-server-protocol

Defines a common protocol for language servers.
https://microsoft.github.io/language-server-protocol/
Creative Commons Attribution 4.0 International
11.17k stars 788 forks source link

Clarify docs: deltaLine and deltaStart fields of semantic tokens relate to the _start_ of the previous token #1855

Closed StachuDotNet closed 3 months ago

StachuDotNet commented 10 months ago

In writing an LSP-based language server, I've recently fumbled for a while assuming that these fields related to the end of any previous token. The highlighting just wasn't working the way I expected to, because of this assumption.

I now understand why the format is the way it is - to support overlapping tokens, in the languages those are relevant, but this wasn't obvious to me.

I'd be happy to update relevant pieces of docs via PRs.

I know of 2 relevant places to update:

any other places that would be useful to clarify in?

dbaeumer commented 10 months ago

Looks good to me.

StachuDotNet commented 10 months ago

Thanks for the response, I'll get to it tonight.

StachuDotNet commented 3 months ago

Finally got around to this in #1966 - I thought there'd be mention of deltaLine and such in vscode-languageserver-node as well, but seems not.