mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 09:05:10 +00:00
parentKind in semantic highlighting: SymbolKind -> lsSymbolKind
This commit is contained in:
parent
6815f1312f
commit
57f2c325f0
@ -130,7 +130,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
grouped_symbols;
|
||||
for (SymbolRef sym : file->def->all_symbols) {
|
||||
std::string_view detailed_name;
|
||||
SymbolKind parent_kind = SymbolKind::Invalid;
|
||||
lsSymbolKind parent_kind = lsSymbolKind::Unknown;
|
||||
lsSymbolKind kind = lsSymbolKind::Unknown;
|
||||
StorageClass storage = StorageClass::Invalid;
|
||||
// This switch statement also filters out symbols that are not highlighted.
|
||||
@ -151,7 +151,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
short_name.compare(0, 27, "function<type-parameter-0-0") == 0)
|
||||
continue; // applies to for loop
|
||||
if (def->spell)
|
||||
parent_kind = def->spell->kind;
|
||||
parent_kind = GetSymbolKind(db, *def->spell);
|
||||
kind = def->kind;
|
||||
storage = def->storage;
|
||||
detailed_name = short_name;
|
||||
@ -180,7 +180,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
kind = def.kind;
|
||||
detailed_name = def.detailed_name;
|
||||
if (def.spell) {
|
||||
parent_kind = def.spell->kind;
|
||||
parent_kind = GetSymbolKind(db, *def.spell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -191,7 +191,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
storage = def.storage;
|
||||
detailed_name = def.detailed_name;
|
||||
if (def.spell) {
|
||||
parent_kind = def.spell->kind;
|
||||
parent_kind = GetSymbolKind(db, *def.spell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ struct Out_CqueryPublishSemanticHighlighting
|
||||
: public lsOutMessage<Out_CqueryPublishSemanticHighlighting> {
|
||||
struct Symbol {
|
||||
int stableId = 0;
|
||||
SymbolKind parentKind;
|
||||
lsSymbolKind parentKind;
|
||||
lsSymbolKind kind;
|
||||
StorageClass storage;
|
||||
std::vector<lsRange> ranges;
|
||||
|
@ -266,6 +266,22 @@ std::vector<lsLocationEx> GetLsLocationExs(QueryDatabase* db,
|
||||
return ret;
|
||||
}
|
||||
|
||||
lsSymbolKind GetSymbolKind(QueryDatabase* db, SymbolIdx sym) {
|
||||
lsSymbolKind ret;
|
||||
if (sym.kind == SymbolKind::File)
|
||||
ret = lsSymbolKind::File;
|
||||
else {
|
||||
ret = lsSymbolKind::Unknown;
|
||||
WithEntity(db, sym, [&](const auto& entity) {
|
||||
for (auto& def : entity.def) {
|
||||
ret = def.kind;
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Returns a symbol. The symbol will have *NOT* have a location assigned.
|
||||
optional<lsSymbolInformation> GetSymbolInfo(QueryDatabase* db,
|
||||
WorkingFiles* working_files,
|
||||
|
@ -92,6 +92,8 @@ void EachOccurrence(QueryDatabase* db, SymbolIdx sym, bool include_decl, Fn&& fn
|
||||
});
|
||||
}
|
||||
|
||||
lsSymbolKind GetSymbolKind(QueryDatabase* db, SymbolIdx sym);
|
||||
|
||||
template <typename Fn>
|
||||
void EachOccurrenceWithParent(QueryDatabase* db,
|
||||
SymbolIdx sym,
|
||||
@ -101,12 +103,7 @@ void EachOccurrenceWithParent(QueryDatabase* db,
|
||||
lsSymbolKind parent_kind = lsSymbolKind::Unknown;
|
||||
for (auto& def : entity.def)
|
||||
if (def.spell) {
|
||||
WithEntity(db, *def.spell, [&](const auto& entity) {
|
||||
for (auto& def : entity.def) {
|
||||
parent_kind = def.kind;
|
||||
break;
|
||||
}
|
||||
});
|
||||
parent_kind = GetSymbolKind(db, sym);
|
||||
break;
|
||||
}
|
||||
for (Use use : entity.uses)
|
||||
|
Loading…
Reference in New Issue
Block a user