mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Don't highlight operators as functions (#104)
* Don't highlight operators as functions * address comments
This commit is contained in:
parent
63d2b5fa10
commit
c4ada3e9df
@ -171,6 +171,8 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
QueryFunc* func = &db->funcs[sym.idx.idx];
|
||||
if (!func->def)
|
||||
continue; // applies to for loop
|
||||
if (func->def->is_operator)
|
||||
continue; // applies to for loop
|
||||
is_type_member = func->def->declaring_type.has_value();
|
||||
break;
|
||||
}
|
||||
|
@ -1188,6 +1188,9 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
|
||||
if (!is_template_specialization) {
|
||||
func->def.short_name = decl->entityInfo->name;
|
||||
|
||||
// Set the |is_operator| flag to true if the function name starts with "operator"
|
||||
func->def.is_operator = func->def.short_name.compare(0, 8, "operator") == 0;
|
||||
|
||||
// Build detailed name. The type desc looks like void (void *). We
|
||||
// insert the qualified name before the first '('.
|
||||
std::string qualified_name =
|
||||
|
@ -267,6 +267,9 @@ struct FuncDefDefinitionData {
|
||||
// Functions that this function calls.
|
||||
std::vector<FuncRef> callees;
|
||||
|
||||
// Used for semantic highlighting
|
||||
bool is_operator = false;
|
||||
|
||||
FuncDefDefinitionData() {} // For reflection.
|
||||
FuncDefDefinitionData(const std::string& usr) : usr(usr) {
|
||||
// assert(usr.size() > 0);
|
||||
@ -308,6 +311,7 @@ void Reflect(
|
||||
REFLECT_MEMBER(base);
|
||||
REFLECT_MEMBER(locals);
|
||||
REFLECT_MEMBER(callees);
|
||||
REFLECT_MEMBER(is_operator);
|
||||
REFLECT_MEMBER_END();
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ optional<QueryFunc::DefUpdate> ToQuery(const IdMap& id_map,
|
||||
result.base = id_map.ToQuery(func.base);
|
||||
result.locals = id_map.ToQuery(func.locals);
|
||||
result.callees = id_map.ToQuery(func.callees);
|
||||
result.is_operator = func.is_operator;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -118,6 +118,7 @@ template <typename TVisitor>
|
||||
void Reflect(TVisitor& visitor, IndexFunc& value) {
|
||||
REFLECT_MEMBER_START();
|
||||
REFLECT_MEMBER2("id", value.id);
|
||||
REFLECT_MEMBER2("is_operator", value.def.is_operator);
|
||||
REFLECT_MEMBER2("usr", value.def.usr);
|
||||
REFLECT_MEMBER2("short_name", value.def.short_name);
|
||||
REFLECT_MEMBER2("detailed_name", value.def.detailed_name);
|
||||
|
Loading…
Reference in New Issue
Block a user