[PATCH] D65856: [clangd] Added class for mapping TokenColorRules to their associated clangd TextMate scope

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 13 07:37:49 PDT 2019


jvikstrom added inline comments.


================
Comment at: clang-tools-extra/clangd/clients/clangd-vscode/src/semantic-highlighting.ts:131
+    this.rules.forEach((rule) => {
+      if (rule.scope.length <= scope.length &&
+          scope.substr(0, rule.scope.length) === rule.scope &&
----------------
hokein wrote:
> hmm, here comes the question, we need algorithm to find the best match rule. not doing it in this patch is fine, please add a FIXME.
> 
> could you also document what's the strategy using here?
But isn't the best match for a scope just the rule that is the longest prefix of the scope (or a perfect match if one exists)? (as that should be the most specific rule)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65856





More information about the cfe-commits mailing list