mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-27 01:51:57 +00:00
detailed_name: "{\n}" -> "{}" ; completion
This commit is contained in:
parent
74790e2421
commit
1ae97c64ed
@ -29,7 +29,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 16985894625255407295,
|
"usr": 16985894625255407295,
|
||||||
"detailed_name": "enum class Foo : uint8_t {\n}",
|
"detailed_name": "enum class Foo : uint8_t {}",
|
||||||
"qual_name_offset": 11,
|
"qual_name_offset": 11,
|
||||||
"short_name": "Foo",
|
"short_name": "Foo",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -11,7 +11,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 16985894625255407295,
|
"usr": 16985894625255407295,
|
||||||
"detailed_name": "enum Foo {\n}",
|
"detailed_name": "enum Foo {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "Foo",
|
"short_name": "Foo",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -18,7 +18,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 2986879766914123941,
|
"usr": 2986879766914123941,
|
||||||
"detailed_name": "enum class E : int32_t {\n}",
|
"detailed_name": "enum class E : int32_t {}",
|
||||||
"qual_name_offset": 11,
|
"qual_name_offset": 11,
|
||||||
"short_name": "E",
|
"short_name": "E",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
@ -52,7 +52,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 16985894625255407295,
|
"usr": 16985894625255407295,
|
||||||
"detailed_name": "enum Foo : int {\n}",
|
"detailed_name": "enum Foo : int {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "Foo",
|
"short_name": "Foo",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -13,7 +13,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 16985894625255407295,
|
"usr": 16985894625255407295,
|
||||||
"detailed_name": "enum class Foo : int {\n}",
|
"detailed_name": "enum class Foo : int {}",
|
||||||
"qual_name_offset": 11,
|
"qual_name_offset": 11,
|
||||||
"short_name": "Foo",
|
"short_name": "Foo",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -16,7 +16,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 6697181287623958829,
|
"usr": 6697181287623958829,
|
||||||
"detailed_name": "enum A {\n}",
|
"detailed_name": "enum A {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "A",
|
"short_name": "A",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
@ -84,7 +84,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 13892793056005362145,
|
"usr": 13892793056005362145,
|
||||||
"detailed_name": "enum B {\n}",
|
"detailed_name": "enum B {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -81,7 +81,7 @@ OUTPUT: funky_enum.cc
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 16985894625255407295,
|
"usr": 16985894625255407295,
|
||||||
"detailed_name": "enum Foo {\n}",
|
"detailed_name": "enum Foo {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "Foo",
|
"short_name": "Foo",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -76,7 +76,7 @@ OUTPUT: header.h
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 4481210672785600703,
|
"usr": 4481210672785600703,
|
||||||
"detailed_name": "enum Foo3 {\n}",
|
"detailed_name": "enum Foo3 {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "Foo3",
|
"short_name": "Foo3",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -23,7 +23,7 @@ OUTPUT:
|
|||||||
}],
|
}],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 2029211996748007610,
|
"usr": 2029211996748007610,
|
||||||
"detailed_name": "namespace hello {\n}",
|
"detailed_name": "namespace hello {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "hello",
|
"short_name": "hello",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -25,7 +25,7 @@ OUTPUT:
|
|||||||
}],
|
}],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 2029211996748007610,
|
"usr": 2029211996748007610,
|
||||||
"detailed_name": "namespace hello {\n}",
|
"detailed_name": "namespace hello {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "hello",
|
"short_name": "hello",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -25,7 +25,7 @@ OUTPUT:
|
|||||||
}],
|
}],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 2029211996748007610,
|
"usr": 2029211996748007610,
|
||||||
"detailed_name": "namespace hello {\n}",
|
"detailed_name": "namespace hello {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "hello",
|
"short_name": "hello",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -29,7 +29,7 @@ OUTPUT:
|
|||||||
}],
|
}],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 2029211996748007610,
|
"usr": 2029211996748007610,
|
||||||
"detailed_name": "namespace hello {\n}",
|
"detailed_name": "namespace hello {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "hello",
|
"short_name": "hello",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -27,7 +27,7 @@ OUTPUT:
|
|||||||
}],
|
}],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 2029211996748007610,
|
"usr": 2029211996748007610,
|
||||||
"detailed_name": "namespace hello {\n}",
|
"detailed_name": "namespace hello {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "hello",
|
"short_name": "hello",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -51,7 +51,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 926793467007732869,
|
"usr": 926793467007732869,
|
||||||
"detailed_name": "namespace foo {\n}",
|
"detailed_name": "namespace foo {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "foo",
|
"short_name": "foo",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
@ -81,7 +81,7 @@ OUTPUT:
|
|||||||
"uses": ["13:11-13:14|10818727483146447186|3|4"]
|
"uses": ["13:11-13:14|10818727483146447186|3|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 14450849931009540802,
|
"usr": 14450849931009540802,
|
||||||
"detailed_name": "namespace foo::bar::baz {\n}",
|
"detailed_name": "namespace foo::bar::baz {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "baz",
|
"short_name": "baz",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
@ -99,7 +99,7 @@ OUTPUT:
|
|||||||
"uses": ["9:27-9:30|0|1|4", "12:21-12:24|10818727483146447186|3|4"]
|
"uses": ["9:27-9:30|0|1|4", "12:21-12:24|10818727483146447186|3|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 17805385787823406700,
|
"usr": 17805385787823406700,
|
||||||
"detailed_name": "namespace foo::bar {\n}",
|
"detailed_name": "namespace foo::bar {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "bar",
|
"short_name": "bar",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -62,7 +62,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 11072669167287398027,
|
"usr": 11072669167287398027,
|
||||||
"detailed_name": "namespace ns {\n}",
|
"detailed_name": "namespace ns {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "ns",
|
"short_name": "ns",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -42,7 +42,7 @@ OUTPUT: static_function_in_type.h
|
|||||||
"uses": ["6:24-6:31|17262466801709381811|2|4"]
|
"uses": ["6:24-6:31|17262466801709381811|2|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 11072669167287398027,
|
"usr": 11072669167287398027,
|
||||||
"detailed_name": "namespace ns {\n}",
|
"detailed_name": "namespace ns {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "ns",
|
"short_name": "ns",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
@ -116,7 +116,7 @@ OUTPUT: static_function_in_type.cc
|
|||||||
"uses": ["5:20-5:27|11072669167287398027|2|4"]
|
"uses": ["5:20-5:27|11072669167287398027|2|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 11072669167287398027,
|
"usr": 11072669167287398027,
|
||||||
"detailed_name": "namespace ns {\n}",
|
"detailed_name": "namespace ns {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "ns",
|
"short_name": "ns",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -37,7 +37,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 1532099849728741556,
|
"usr": 1532099849728741556,
|
||||||
"detailed_name": "enum ns::VarType {\n}",
|
"detailed_name": "enum ns::VarType {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "VarType",
|
"short_name": "VarType",
|
||||||
"kind": 10,
|
"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"]
|
"uses": ["6:22-6:29|12688716854043726585|2|4", "6:44-6:51|12688716854043726585|2|4", "10:18-10:25|11072669167287398027|2|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 11072669167287398027,
|
"usr": 11072669167287398027,
|
||||||
"detailed_name": "namespace ns {\n}",
|
"detailed_name": "namespace ns {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "ns",
|
"short_name": "ns",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -49,7 +49,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 11072669167287398027,
|
"usr": 11072669167287398027,
|
||||||
"detailed_name": "namespace ns {\n}",
|
"detailed_name": "namespace ns {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "ns",
|
"short_name": "ns",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -48,7 +48,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 11072669167287398027,
|
"usr": 11072669167287398027,
|
||||||
"detailed_name": "namespace ns {\n}",
|
"detailed_name": "namespace ns {}",
|
||||||
"qual_name_offset": 10,
|
"qual_name_offset": 10,
|
||||||
"short_name": "ns",
|
"short_name": "ns",
|
||||||
"kind": 3,
|
"kind": 3,
|
||||||
|
@ -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"]
|
"uses": ["21:16-21:22|0|1|4", "30:1-30:7|0|1|4", "32:1-32:7|0|1|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 9201299975592934124,
|
"usr": 9201299975592934124,
|
||||||
"detailed_name": "enum Enum {\n}",
|
"detailed_name": "enum Enum {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "Enum",
|
"short_name": "Enum",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -35,7 +35,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 6697181287623958829,
|
"usr": 6697181287623958829,
|
||||||
"detailed_name": "enum A {\n}",
|
"detailed_name": "enum A {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "A",
|
"short_name": "A",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
@ -86,7 +86,7 @@ OUTPUT:
|
|||||||
"uses": ["9:1-9:4|0|1|4", "10:1-10:4|0|1|4"]
|
"uses": ["9:1-9:4|0|1|4", "10:1-10:4|0|1|4"]
|
||||||
}, {
|
}, {
|
||||||
"usr": 13892793056005362145,
|
"usr": 13892793056005362145,
|
||||||
"detailed_name": "enum B {\n}",
|
"detailed_name": "enum B {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -38,7 +38,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 6697181287623958829,
|
"usr": 6697181287623958829,
|
||||||
"detailed_name": "enum A {\n}",
|
"detailed_name": "enum A {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "A",
|
"short_name": "A",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
@ -72,7 +72,7 @@ OUTPUT:
|
|||||||
"uses": []
|
"uses": []
|
||||||
}, {
|
}, {
|
||||||
"usr": 13892793056005362145,
|
"usr": 13892793056005362145,
|
||||||
"detailed_name": "enum B {\n}",
|
"detailed_name": "enum B {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "B",
|
"short_name": "B",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -15,7 +15,7 @@ OUTPUT:
|
|||||||
"usr2func": [],
|
"usr2func": [],
|
||||||
"usr2type": [{
|
"usr2type": [{
|
||||||
"usr": 5792006888140599735,
|
"usr": 5792006888140599735,
|
||||||
"detailed_name": "enum VarType {\n}",
|
"detailed_name": "enum VarType {}",
|
||||||
"qual_name_offset": 5,
|
"qual_name_offset": 5,
|
||||||
"short_name": "VarType",
|
"short_name": "VarType",
|
||||||
"kind": 10,
|
"kind": 10,
|
||||||
|
@ -354,14 +354,15 @@ public:
|
|||||||
unsigned NumResults) override {
|
unsigned NumResults) override {
|
||||||
ls_items.reserve(NumResults);
|
ls_items.reserve(NumResults);
|
||||||
for (unsigned i = 0; i != NumResults; i++) {
|
for (unsigned i = 0; i != NumResults; i++) {
|
||||||
if (Results[i].Availability == CXAvailability_NotAccessible ||
|
auto &R = Results[i];
|
||||||
Results[i].Availability == CXAvailability_NotAvailable)
|
if (R.Availability == CXAvailability_NotAccessible ||
|
||||||
|
R.Availability == CXAvailability_NotAvailable)
|
||||||
continue;
|
continue;
|
||||||
CodeCompletionString *CCS = Results[i].CreateCodeCompletionString(
|
CodeCompletionString *CCS = R.CreateCodeCompletionString(
|
||||||
S, Context, getAllocator(), getCodeCompletionTUInfo(),
|
S, Context, getAllocator(), getCodeCompletionTUInfo(),
|
||||||
includeBriefComments());
|
includeBriefComments());
|
||||||
lsCompletionItem ls_item;
|
lsCompletionItem ls_item;
|
||||||
ls_item.kind = GetCompletionKind(Results[i].CursorKind);
|
ls_item.kind = GetCompletionKind(R.CursorKind);
|
||||||
if (const char *brief = CCS->getBriefComment())
|
if (const char *brief = CCS->getBriefComment())
|
||||||
ls_item.documentation = brief;
|
ls_item.documentation = brief;
|
||||||
|
|
||||||
|
@ -462,6 +462,12 @@ public:
|
|||||||
|
|
||||||
std::string name = OS.str();
|
std::string name = OS.str();
|
||||||
SimplifyAnonymous(name);
|
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);
|
auto i = name.find(short_name);
|
||||||
if (short_name.size())
|
if (short_name.size())
|
||||||
while (i != std::string::npos && ((i && isalnum(name[i - 1])) ||
|
while (i != std::string::npos && ((i && isalnum(name[i - 1])) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user