[PATCH] D148489: [clangd] Implement configs to stop clangd produce a certain semantic tokens

Qingyuan Zheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 23:56:15 PDT 2023


daiyousei-qz added a comment.

In D148489#4276634 <https://reviews.llvm.org/D148489#4276634>, @kadircet wrote:

> before you dive any deeper into the patch, could you give some reasoning about why this is needed/useful?

The discussion is at https://github.com/clangd/clangd/discussions/1598.

The original motivation is that in the latest clangd, we start to assign semantic token "operator" to all operators in the source code. Since the semantic tokens take priority over the textmate rules in vscode, now we cannot theme different operators differently anymore. For example, we cannot color "new" in blue while have "+" in white.

To address the issue, this patch adds configurable filter to the semantic token to filter out unwanted kinds and modifiers. We should have the following benefits with such filter in place.

1. Address the issue mentioned above about unwanted token kinds and modifiers so textmate rules could fallback.
2. Improve the performance of semantic tokens (if anyone is taking advantage of the config OFC) since we could strip away unwanted tokens
3. Not directly supported by this patch, but the filter could also be used to support adding semantic tokens that are disabled by default. Say if we want to support `augmentsSyntaxTokens` in the future.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148489/new/

https://reviews.llvm.org/D148489



More information about the cfe-commits mailing list