Add lsSymbolKind::StaticMethod (extension) and set parentKind

This commit is contained in:
Fangrui Song 2018-02-18 19:01:22 -08:00
parent 9217393a78
commit 488f6cc962
3 changed files with 9 additions and 2 deletions

View File

@ -125,9 +125,9 @@ lsSymbolKind GetSymbolKind(CXIdxEntityKind kind) {
case CXIdxEntity_ObjCInstanceMethod: case CXIdxEntity_ObjCInstanceMethod:
return lsSymbolKind::Method; return lsSymbolKind::Method;
case CXIdxEntity_ObjCClassMethod: case CXIdxEntity_ObjCClassMethod:
return lsSymbolKind::Method; return lsSymbolKind::StaticMethod;
case CXIdxEntity_CXXStaticMethod: case CXIdxEntity_CXXStaticMethod:
return lsSymbolKind::Method; return lsSymbolKind::StaticMethod;
case CXIdxEntity_ObjCProperty: case CXIdxEntity_ObjCProperty:
return lsSymbolKind::Property; return lsSymbolKind::Property;
case CXIdxEntity_CXXStaticVariable: case CXIdxEntity_CXXStaticVariable:

View File

@ -126,6 +126,8 @@ void EmitSemanticHighlighting(QueryDatabase* db,
if (short_name.compare(0, 8, "operator") == 0 || if (short_name.compare(0, 8, "operator") == 0 ||
short_name.compare(0, 27, "function<type-parameter-0-0") == 0) short_name.compare(0, 27, "function<type-parameter-0-0") == 0)
continue; // applies to for loop continue; // applies to for loop
if (def->spell)
parent_kind = def->spell->kind;
kind = def->kind; kind = def->kind;
detailed_name = short_name; detailed_name = short_name;
@ -149,6 +151,8 @@ void EmitSemanticHighlighting(QueryDatabase* db,
} }
case SymbolKind::Var: { case SymbolKind::Var: {
if (const QueryVar::Def* def = db->GetVar(sym).AnyDef()) { if (const QueryVar::Def* def = db->GetVar(sym).AnyDef()) {
if (def->spell)
parent_kind = def->spell->kind;
kind = def->kind; kind = def->kind;
storage = def->storage; storage = def->storage;
detailed_name = def->ShortName(); detailed_name = def->ShortName();
@ -157,6 +161,8 @@ void EmitSemanticHighlighting(QueryDatabase* db,
} }
case SymbolKind::Type: { case SymbolKind::Type: {
if (const QueryType::Def* def = db->GetType(sym).AnyDef()) { if (const QueryType::Def* def = db->GetType(sym).AnyDef()) {
if (def->spell)
parent_kind = def->spell->kind;
kind = def->kind; kind = def->kind;
detailed_name = def->detailed_name; detailed_name = def->detailed_name;
} }

View File

@ -112,6 +112,7 @@ enum class lsSymbolKind : uint8_t {
// See also https://github.com/Microsoft/language-server-protocol/issues/344 for new SymbolKind // See also https://github.com/Microsoft/language-server-protocol/issues/344 for new SymbolKind
// clang/Index/IndexSymbol.h clang::index::SymbolKind // clang/Index/IndexSymbol.h clang::index::SymbolKind
Parameter = 13, Parameter = 13,
StaticMethod = 254,
Macro = 255, Macro = 255,
}; };
MAKE_REFLECT_TYPE_PROXY(lsSymbolKind); MAKE_REFLECT_TYPE_PROXY(lsSymbolKind);