Browse Source

detailed_name: "{\n}" -> "{}" ; completion

pull/517/head
Fangrui Song 6 years ago
parent
commit
5c0a146ee4
  1. 2
      index_tests/enums/enum_class_decl.cc
  2. 2
      index_tests/enums/enum_decl.cc
  3. 4
      index_tests/enums/enum_inherit.cc
  4. 2
      index_tests/enums/enum_usage.cc
  5. 4
      index_tests/foobar.cc
  6. 2
      index_tests/multi_file/funky_enum.cc
  7. 2
      index_tests/multi_file/impl.cc
  8. 2
      index_tests/namespaces/function_declaration.cc
  9. 2
      index_tests/namespaces/function_definition.cc
  10. 2
      index_tests/namespaces/method_declaration.cc
  11. 2
      index_tests/namespaces/method_definition.cc
  12. 2
      index_tests/namespaces/method_inline_declaration.cc
  13. 6
      index_tests/namespaces/namespace_alias.cc
  14. 2
      index_tests/namespaces/namespace_reference.cc
  15. 4
      index_tests/outline/static_function_in_type.cc
  16. 4
      index_tests/templates/implicit_variable_instantiation.cc
  17. 2
      index_tests/templates/namespace_template_class_template_func_usage_folded_into_one.cc
  18. 2
      index_tests/templates/namespace_template_type_usage_folded_into_one.cc
  19. 2
      index_tests/templates/specialization.cc
  20. 4
      index_tests/templates/template_class_type_usage_folded_into_one.cc
  21. 4
      index_tests/templates/template_var_usage_folded_into_one.cc
  22. 2
      index_tests/usage/var_usage_cstyle_cast.cc
  23. 9
      src/clang_complete.cc
  24. 6
      src/indexer.cc

2
index_tests/enums/enum_class_decl.cc

@ -29,7 +29,7 @@ OUTPUT:
"uses": []
}, {
"usr": 16985894625255407295,
"detailed_name": "enum class Foo : uint8_t {\n}",
"detailed_name": "enum class Foo : uint8_t {}",
"qual_name_offset": 11,
"short_name": "Foo",
"kind": 10,

2
index_tests/enums/enum_decl.cc

@ -11,7 +11,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 16985894625255407295,
"detailed_name": "enum Foo {\n}",
"detailed_name": "enum Foo {}",
"qual_name_offset": 5,
"short_name": "Foo",
"kind": 10,

4
index_tests/enums/enum_inherit.cc

@ -18,7 +18,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 2986879766914123941,
"detailed_name": "enum class E : int32_t {\n}",
"detailed_name": "enum class E : int32_t {}",
"qual_name_offset": 11,
"short_name": "E",
"kind": 10,
@ -52,7 +52,7 @@ OUTPUT:
"uses": []
}, {
"usr": 16985894625255407295,
"detailed_name": "enum Foo : int {\n}",
"detailed_name": "enum Foo : int {}",
"qual_name_offset": 5,
"short_name": "Foo",
"kind": 10,

2
index_tests/enums/enum_usage.cc

@ -13,7 +13,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 16985894625255407295,
"detailed_name": "enum class Foo : int {\n}",
"detailed_name": "enum class Foo : int {}",
"qual_name_offset": 11,
"short_name": "Foo",
"kind": 10,

4
index_tests/foobar.cc

@ -16,7 +16,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 6697181287623958829,
"detailed_name": "enum A {\n}",
"detailed_name": "enum A {}",
"qual_name_offset": 5,
"short_name": "A",
"kind": 10,
@ -84,7 +84,7 @@ OUTPUT:
"uses": []
}, {
"usr": 13892793056005362145,
"detailed_name": "enum B {\n}",
"detailed_name": "enum B {}",
"qual_name_offset": 5,
"short_name": "B",
"kind": 10,

2
index_tests/multi_file/funky_enum.cc

@ -81,7 +81,7 @@ OUTPUT: funky_enum.cc
"usr2func": [],
"usr2type": [{
"usr": 16985894625255407295,
"detailed_name": "enum Foo {\n}",
"detailed_name": "enum Foo {}",
"qual_name_offset": 5,
"short_name": "Foo",
"kind": 10,

2
index_tests/multi_file/impl.cc

@ -76,7 +76,7 @@ OUTPUT: header.h
"uses": []
}, {
"usr": 4481210672785600703,
"detailed_name": "enum Foo3 {\n}",
"detailed_name": "enum Foo3 {}",
"qual_name_offset": 5,
"short_name": "Foo3",
"kind": 10,

2
index_tests/namespaces/function_declaration.cc

@ -23,7 +23,7 @@ OUTPUT:
}],
"usr2type": [{
"usr": 2029211996748007610,
"detailed_name": "namespace hello {\n}",
"detailed_name": "namespace hello {}",
"qual_name_offset": 10,
"short_name": "hello",
"kind": 3,

2
index_tests/namespaces/function_definition.cc

@ -25,7 +25,7 @@ OUTPUT:
}],
"usr2type": [{
"usr": 2029211996748007610,
"detailed_name": "namespace hello {\n}",
"detailed_name": "namespace hello {}",
"qual_name_offset": 10,
"short_name": "hello",
"kind": 3,

2
index_tests/namespaces/method_declaration.cc

@ -25,7 +25,7 @@ OUTPUT:
}],
"usr2type": [{
"usr": 2029211996748007610,
"detailed_name": "namespace hello {\n}",
"detailed_name": "namespace hello {}",
"qual_name_offset": 10,
"short_name": "hello",
"kind": 3,

2
index_tests/namespaces/method_definition.cc

@ -29,7 +29,7 @@ OUTPUT:
}],
"usr2type": [{
"usr": 2029211996748007610,
"detailed_name": "namespace hello {\n}",
"detailed_name": "namespace hello {}",
"qual_name_offset": 10,
"short_name": "hello",
"kind": 3,

2
index_tests/namespaces/method_inline_declaration.cc

@ -27,7 +27,7 @@ OUTPUT:
}],
"usr2type": [{
"usr": 2029211996748007610,
"detailed_name": "namespace hello {\n}",
"detailed_name": "namespace hello {}",
"qual_name_offset": 10,
"short_name": "hello",
"kind": 3,

6
index_tests/namespaces/namespace_alias.cc

@ -51,7 +51,7 @@ OUTPUT:
"uses": []
}, {
"usr": 926793467007732869,
"detailed_name": "namespace foo {\n}",
"detailed_name": "namespace foo {}",
"qual_name_offset": 10,
"short_name": "foo",
"kind": 3,
@ -81,7 +81,7 @@ OUTPUT:
"uses": ["13:11-13:14|10818727483146447186|3|4"]
}, {
"usr": 14450849931009540802,
"detailed_name": "namespace foo::bar::baz {\n}",
"detailed_name": "namespace foo::bar::baz {}",
"qual_name_offset": 10,
"short_name": "baz",
"kind": 3,
@ -99,7 +99,7 @@ OUTPUT:
"uses": ["9:27-9:30|0|1|4", "12:21-12:24|10818727483146447186|3|4"]
}, {
"usr": 17805385787823406700,
"detailed_name": "namespace foo::bar {\n}",
"detailed_name": "namespace foo::bar {}",
"qual_name_offset": 10,
"short_name": "bar",
"kind": 3,

2
index_tests/namespaces/namespace_reference.cc

@ -62,7 +62,7 @@ OUTPUT:
"uses": []
}, {
"usr": 11072669167287398027,
"detailed_name": "namespace ns {\n}",
"detailed_name": "namespace ns {}",
"qual_name_offset": 10,
"short_name": "ns",
"kind": 3,

4
index_tests/outline/static_function_in_type.cc

@ -42,7 +42,7 @@ OUTPUT: static_function_in_type.h
"uses": ["6:24-6:31|17262466801709381811|2|4"]
}, {
"usr": 11072669167287398027,
"detailed_name": "namespace ns {\n}",
"detailed_name": "namespace ns {}",
"qual_name_offset": 10,
"short_name": "ns",
"kind": 3,
@ -116,7 +116,7 @@ OUTPUT: static_function_in_type.cc
"uses": ["5:20-5:27|11072669167287398027|2|4"]
}, {
"usr": 11072669167287398027,
"detailed_name": "namespace ns {\n}",
"detailed_name": "namespace ns {}",
"qual_name_offset": 10,
"short_name": "ns",
"kind": 3,

4
index_tests/templates/implicit_variable_instantiation.cc

@ -37,7 +37,7 @@ OUTPUT:
"uses": []
}, {
"usr": 1532099849728741556,
"detailed_name": "enum ns::VarType {\n}",
"detailed_name": "enum ns::VarType {}",
"qual_name_offset": 5,
"short_name": "VarType",
"kind": 10,
@ -54,7 +54,7 @@ OUTPUT:
"uses": ["6:22-6:29|12688716854043726585|2|4", "6:44-6:51|12688716854043726585|2|4", "10:18-10:25|11072669167287398027|2|4"]
}, {
"usr": 11072669167287398027,
"detailed_name": "namespace ns {\n}",
"detailed_name": "namespace ns {}",
"qual_name_offset": 10,
"short_name": "ns",
"kind": 3,

2
index_tests/templates/namespace_template_class_template_func_usage_folded_into_one.cc

@ -49,7 +49,7 @@ OUTPUT:
"uses": []
}, {
"usr": 11072669167287398027,
"detailed_name": "namespace ns {\n}",
"detailed_name": "namespace ns {}",
"qual_name_offset": 10,
"short_name": "ns",
"kind": 3,

2
index_tests/templates/namespace_template_type_usage_folded_into_one.cc

@ -48,7 +48,7 @@ OUTPUT:
"uses": []
}, {
"usr": 11072669167287398027,
"detailed_name": "namespace ns {\n}",
"detailed_name": "namespace ns {}",
"qual_name_offset": 10,
"short_name": "ns",
"kind": 3,

2
index_tests/templates/specialization.cc

@ -204,7 +204,7 @@ OUTPUT:
"uses": ["21:16-21:22|0|1|4", "30:1-30:7|0|1|4", "32:1-32:7|0|1|4"]
}, {
"usr": 9201299975592934124,
"detailed_name": "enum Enum {\n}",
"detailed_name": "enum Enum {}",
"qual_name_offset": 5,
"short_name": "Enum",
"kind": 10,

4
index_tests/templates/template_class_type_usage_folded_into_one.cc

@ -35,7 +35,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 6697181287623958829,
"detailed_name": "enum A {\n}",
"detailed_name": "enum A {}",
"qual_name_offset": 5,
"short_name": "A",
"kind": 10,
@ -86,7 +86,7 @@ OUTPUT:
"uses": ["9:1-9:4|0|1|4", "10:1-10:4|0|1|4"]
}, {
"usr": 13892793056005362145,
"detailed_name": "enum B {\n}",
"detailed_name": "enum B {}",
"qual_name_offset": 5,
"short_name": "B",
"kind": 10,

4
index_tests/templates/template_var_usage_folded_into_one.cc

@ -38,7 +38,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 6697181287623958829,
"detailed_name": "enum A {\n}",
"detailed_name": "enum A {}",
"qual_name_offset": 5,
"short_name": "A",
"kind": 10,
@ -72,7 +72,7 @@ OUTPUT:
"uses": []
}, {
"usr": 13892793056005362145,
"detailed_name": "enum B {\n}",
"detailed_name": "enum B {}",
"qual_name_offset": 5,
"short_name": "B",
"kind": 10,

2
index_tests/usage/var_usage_cstyle_cast.cc

@ -15,7 +15,7 @@ OUTPUT:
"usr2func": [],
"usr2type": [{
"usr": 5792006888140599735,
"detailed_name": "enum VarType {\n}",
"detailed_name": "enum VarType {}",
"qual_name_offset": 5,
"short_name": "VarType",
"kind": 10,

9
src/clang_complete.cc

@ -342,14 +342,15 @@ public:
unsigned NumResults) override {
ls_items.reserve(NumResults);
for (unsigned i = 0; i != NumResults; i++) {
if (Results[i].Availability == CXAvailability_NotAccessible ||
Results[i].Availability == CXAvailability_NotAvailable)
auto &R = Results[i];
if (R.Availability == CXAvailability_NotAccessible ||
R.Availability == CXAvailability_NotAvailable)
continue;
CodeCompletionString *CCS = Results[i].CreateCodeCompletionString(
CodeCompletionString *CCS = R.CreateCodeCompletionString(
S, Context, getAllocator(), getCodeCompletionTUInfo(),
includeBriefComments());
lsCompletionItem ls_item;
ls_item.kind = GetCompletionKind(Results[i].CursorKind);
ls_item.kind = GetCompletionKind(R.CursorKind);
if (const char *brief = CCS->getBriefComment())
ls_item.documentation = brief;

6
src/indexer.cc

@ -447,6 +447,12 @@ public:
std::string name = OS.str();
SimplifyAnonymous(name);
// Remove \n in DeclPrinter.cpp "{\n" + if(!TerseOutput)something + "}"
for (std::string::size_type i = 0;;) {
if ((i = name.find("{\n}", i)) == std::string::npos)
break;
name.replace(i, 3, "{}");
}
auto i = name.find(short_name);
if (short_name.size())
while (i != std::string::npos && ((i && isalnum(name[i - 1])) ||

Loading…
Cancel
Save