From d2bc73706882211d868e546183d1eaa7975fb0a8 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 22 Feb 2018 09:43:53 -0800 Subject: [PATCH] Semantic highlighting of macros --- src/message_handler.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/message_handler.cc b/src/message_handler.cc index c14228c3..16b04b67 100644 --- a/src/message_handler.cc +++ b/src/message_handler.cc @@ -18,7 +18,13 @@ struct ScanLineEvent { Out_CqueryPublishSemanticHighlighting::Symbol* symbol; bool operator<(const ScanLineEvent& other) const { // See the comments below when insertion/deletion events are inserted. - return !(pos == other.pos) ? pos < other.pos : other.end_pos < end_pos; + if (!(pos == other.pos)) + return pos < other.pos; + if (!(other.end_pos == end_pos)) + return other.end_pos < end_pos; + // This comparison essentially order Macro after non-Macro, + // So that macros will not be rendered as Var/Type/... + return symbol->kind < other.symbol->kind; } }; } // namespace