mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 16:15:07 +00:00
Improve semantic highlight in templates
This commit is contained in:
parent
6dfe5d1c4f
commit
ceeae84662
@ -79,15 +79,19 @@ struct ScanLineEvent {
|
|||||||
Position end_pos; // Second key when there is a tie for insertion events.
|
Position end_pos; // Second key when there is a tie for insertion events.
|
||||||
int id;
|
int id;
|
||||||
CclsSemanticHighlightSymbol *symbol;
|
CclsSemanticHighlightSymbol *symbol;
|
||||||
bool operator<(const ScanLineEvent &other) const {
|
bool operator<(const ScanLineEvent &o) const {
|
||||||
// See the comments below when insertion/deletion events are inserted.
|
// See the comments below when insertion/deletion events are inserted.
|
||||||
if (!(pos == other.pos))
|
if (!(pos == o.pos))
|
||||||
return pos < other.pos;
|
return pos < o.pos;
|
||||||
if (!(other.end_pos == end_pos))
|
if (!(o.end_pos == end_pos))
|
||||||
return other.end_pos < end_pos;
|
return o.end_pos < end_pos;
|
||||||
// This comparison essentially order Macro after non-Macro,
|
// This comparison essentially order Macro after non-Macro,
|
||||||
// So that macros will not be rendered as Var/Type/...
|
// So that macros will not be rendered as Var/Type/...
|
||||||
return symbol->kind < other.symbol->kind;
|
if (symbol->kind != o.symbol->kind)
|
||||||
|
return symbol->kind < o.symbol->kind;
|
||||||
|
// If symbol A and B occupy the same place, we want one to be placed
|
||||||
|
// before the other consistantly.
|
||||||
|
return symbol->id < o.symbol->id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user