[PATCH] D66995: [clangd] Add highlighting for macro expansions.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 30 04:31:10 PDT 2019


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:469
+  case HighlightingKind::MacroExpansion:
+    return "entity.name.function.preprocessor.expansion.cpp";
   case HighlightingKind::NumKinds:
----------------
ilya-biryukov wrote:
> Is there a place on the internet with conventional textmate scope names?
> Or do we come up with these on our own?
This is not standard TX scope names, we only have guidelines. In general, we use the names using in vscode as references (you could see the TM name via vscode's "Insepct TM Scopes" functionality)


================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:394
       #define DEF_MULTIPLE(X) namespace X { class X { int X; }; }
       #define DEF_CLASS(T) class T {};
+      $MacroExpansion[[DEF_MULTIPLE]](XYZ);
----------------
ilya-biryukov wrote:
> Similar to how we highlight everything else, we should also highlight macro declarations and usages (i.e. expansions in the same way).
> Could we add the corresponding highlightings?
> ```
> #define $Macro[[DEF_CLASS]](T) class T T{}
> $Macro[[DEF_CLASS]](A);
> ```
+1, I think we could name the HighlightingKind as `Macro` instead of `MacroExpansion`  (even through we don't highlighting the macro def yet).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66995





More information about the cfe-commits mailing list