Do not include path in lambda detail/hover string

This commit is contained in:
Jacob Dufault 2017-12-22 08:59:37 -08:00
parent 36ea900258
commit fd7c01796c
2 changed files with 7 additions and 2 deletions

View File

@ -1027,6 +1027,11 @@ void OnIndexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
std::string type_name =
ToString(clang_getTypeSpelling(clang_getCursorType(decl->cursor)));
// clang may report "(lambda at foo.cc)" which end up being a very long
// string. Shorten it to just "lambda".
if (type_name.find("(lambda at") != std::string::npos)
type_name = "lambda";
var->def.detailed_name =
type_name + " " +
ns->QualifiedName(decl->semanticContainer, var->def.short_name);

View File

@ -74,8 +74,8 @@ OUTPUT:
"id": 1,
"usr": "c:lambda.cc@28@F@foo#@dosomething",
"short_name": "dosomething",
"detailed_name": "(lambda at C:/Users/jacob/Desktop/cquery/tests/lambdas/lambda.cc:4:22) dosomething",
"hover": "(lambda at C:/Users/jacob/Desktop/cquery/tests/lambdas/lambda.cc:4:22)",
"detailed_name": "lambda dosomething",
"hover": "lambda",
"definition_spelling": "4:8-4:19",
"definition_extent": "4:3-7:4",
"variable_type": 0,