microsoft / language-server-protocol

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

What's the difference about deprecated in Diagnostic and Semantic Token? #1865

Closed imbant closed 7 months ago

imbant commented 7 months ago

Hi there. There is a SemanticTokenModifiers.deprecated and a DiagnosticTag.Deprecated.

In TypeScript, a variable tagged deprecated by jsDoc(// @deprecated) will be added a strikethrough. I tried semantic one but in my VS Code, most color themes don't support adding strikethrough to a token. So I guess ts language server may use diagnostic one to implement that.

Is that the best practice to add strikethrough? If few themes add strikethrough to the deprecated semantic tokens, what is the usage of this semantic token modifier?

dbaeumer commented 7 months ago

As always LSP doesn't define detailed rendering so it is up to the client to decide how to render deprecated for both semantic tokens and tags.

We had DiagnosticTags long before semantic tokens. This is why both exists. I would actually use tags since more clients will support them that semantic tokens.

imbant commented 7 months ago

@dbaeumer I got it. Thanks for your time