mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Add kind to Out_CqueryPublishSemanticHighlighting
This commit is contained in:
parent
c3136122ad
commit
c4935fb367
@ -1084,7 +1084,9 @@ struct Out_CqueryPublishSemanticHighlighting
|
||||
enum class SymbolType { Type = 0, Function, Variable };
|
||||
struct Symbol {
|
||||
int stableId = 0;
|
||||
// TODO Deprecate |type| in favor of fine-grained |kind|.
|
||||
SymbolType type = SymbolType::Type;
|
||||
int kind;
|
||||
bool isTypeMember = false;
|
||||
std::vector<lsRange> ranges;
|
||||
};
|
||||
@ -1098,6 +1100,7 @@ struct Out_CqueryPublishSemanticHighlighting
|
||||
MAKE_REFLECT_TYPE_PROXY(Out_CqueryPublishSemanticHighlighting::SymbolType, int);
|
||||
MAKE_REFLECT_STRUCT(Out_CqueryPublishSemanticHighlighting::Symbol,
|
||||
type,
|
||||
kind,
|
||||
isTypeMember,
|
||||
stableId,
|
||||
ranges);
|
||||
|
@ -126,6 +126,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
for (SymbolRef sym : file->def->all_symbols) {
|
||||
std::string detailed_name;
|
||||
bool is_type_member = false;
|
||||
ClangSymbolKind kind = ClangSymbolKind::Unknown;
|
||||
// This switch statement also filters out symbols that are not highlighted.
|
||||
switch (sym.idx.kind) {
|
||||
case SymbolKind::Func: {
|
||||
@ -134,6 +135,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
continue; // applies to for loop
|
||||
if (func->def->is_operator)
|
||||
continue; // applies to for loop
|
||||
kind = func->def->kind;
|
||||
is_type_member = func->def->declaring_type.has_value();
|
||||
detailed_name = func->def->short_name;
|
||||
|
||||
@ -159,19 +161,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
QueryVar* var = &db->vars[sym.idx.idx];
|
||||
if (!var->def)
|
||||
continue; // applies to for loop
|
||||
switch (var->def->kind) {
|
||||
// TODO
|
||||
case ClangSymbolKind::EnumConstant:
|
||||
case ClangSymbolKind::Field:
|
||||
case ClangSymbolKind::Macro:
|
||||
case ClangSymbolKind::Module:
|
||||
case ClangSymbolKind::Parameter:
|
||||
case ClangSymbolKind::StaticProperty:
|
||||
case ClangSymbolKind::Variable:
|
||||
break;
|
||||
default:
|
||||
continue; // applies to for loop
|
||||
}
|
||||
kind = var->def->kind;
|
||||
is_type_member = var->def->declaring_type.has_value();
|
||||
detailed_name = var->def->short_name;
|
||||
break;
|
||||
@ -180,6 +170,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
QueryType* type = &db->types[sym.idx.idx];
|
||||
if (!type->def)
|
||||
continue; // applies to for loop
|
||||
kind = type->def->kind;
|
||||
detailed_name = type->def->detailed_name;
|
||||
break;
|
||||
}
|
||||
@ -196,6 +187,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
||||
Out_CqueryPublishSemanticHighlighting::Symbol symbol;
|
||||
symbol.stableId =
|
||||
semantic_cache_for_file->GetStableId(sym.idx.kind, detailed_name);
|
||||
symbol.kind = static_cast<int>(kind);
|
||||
symbol.type = map_symbol_kind_to_symbol_type(sym.idx.kind);
|
||||
symbol.isTypeMember = is_type_member;
|
||||
symbol.ranges.push_back(*loc);
|
||||
|
Loading…
Reference in New Issue
Block a user