mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-26 01:21:57 +00:00
Set parentKind of Func/Var from declarations if they have no definition
This commit is contained in:
parent
57f2c325f0
commit
15ec6036e7
@ -136,14 +136,18 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
|||||||
// This switch statement also filters out symbols that are not highlighted.
|
// This switch statement also filters out symbols that are not highlighted.
|
||||||
switch (sym.kind) {
|
switch (sym.kind) {
|
||||||
case SymbolKind::Func: {
|
case SymbolKind::Func: {
|
||||||
const QueryFunc::Def* def = nullptr;
|
const QueryFunc& func = db->GetFunc(sym);
|
||||||
for (auto& i : db->GetFunc(sym).def) {
|
const QueryFunc::Def* def = func.AnyDef();
|
||||||
def = &i;
|
|
||||||
if (i.spell)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!def)
|
if (!def)
|
||||||
continue; // applies to for loop
|
continue; // applies to for loop
|
||||||
|
if (def->spell)
|
||||||
|
parent_kind = GetSymbolKind(db, *def->spell);
|
||||||
|
if (parent_kind == lsSymbolKind::Unknown) {
|
||||||
|
for (Use use: func.declarations) {
|
||||||
|
parent_kind = GetSymbolKind(db, use);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Don't highlight overloadable operators or implicit lambda ->
|
// Don't highlight overloadable operators or implicit lambda ->
|
||||||
// std::function constructor.
|
// std::function constructor.
|
||||||
std::string_view short_name = def->ShortName();
|
std::string_view short_name = def->ShortName();
|
||||||
@ -185,8 +189,9 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SymbolKind::Var:
|
case SymbolKind::Var: {
|
||||||
for (auto& def : db->GetVar(sym).def) {
|
const QueryVar& var = db->GetVar(sym);
|
||||||
|
for (auto& def : var.def) {
|
||||||
kind = def.kind;
|
kind = def.kind;
|
||||||
storage = def.storage;
|
storage = def.storage;
|
||||||
detailed_name = def.detailed_name;
|
detailed_name = def.detailed_name;
|
||||||
@ -195,7 +200,14 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (parent_kind == lsSymbolKind::Unknown) {
|
||||||
|
for (Use use : var.declarations) {
|
||||||
|
parent_kind = GetSymbolKind(db, use);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
continue; // applies to for loop
|
continue; // applies to for loop
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user