Extended mode ditto comment support (#562)
Extended mode ditto comment support merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
parent
80be02adb3
commit
6ae1b6f890
2
dsymbol
2
dsymbol
|
|
@ -1 +1 @@
|
||||||
Subproject commit 211a3cf8c8a22f4329aabacbde4251cedbccdf8c
|
Subproject commit 913e1f1207f2488400e383d9e74219eb706fdb05
|
||||||
2
dub.json
2
dub.json
|
|
@ -7,7 +7,7 @@
|
||||||
],
|
],
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dsymbol": "~>0.5.5",
|
"dsymbol": "~>0.5.6",
|
||||||
"libdparse": "~>0.10.10",
|
"libdparse": "~>0.10.10",
|
||||||
"msgpack-d": "~>1.0.0-beta.7",
|
"msgpack-d": "~>1.0.0-beta.7",
|
||||||
"stdx-allocator": "~>2.77.5"
|
"stdx-allocator": "~>2.77.5"
|
||||||
|
|
|
||||||
|
|
@ -53,17 +53,16 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request,
|
||||||
warning("Could not find symbol");
|
warning("Could not find symbol");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool isDitto(string s)
|
// first symbol allows ditto if it's the first documentation,
|
||||||
|
// because then it takes documentation from a symbol with different name
|
||||||
|
// which isn't inside the stuff.symbols range.
|
||||||
|
bool firstSymbol = true;
|
||||||
|
foreach(ref symbol; stuff.symbols.filter!(a => !a.doc.empty))
|
||||||
{
|
{
|
||||||
import std.uni : icmp;
|
if (!firstSymbol && symbol.doc.ditto)
|
||||||
if (s.length > 5)
|
continue;
|
||||||
return false;
|
firstSymbol = false;
|
||||||
else
|
|
||||||
return s.icmp("ditto") == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(ref symbol; stuff.symbols.filter!(a => !a.doc.empty && !isDitto(a.doc)))
|
|
||||||
{
|
|
||||||
AutocompleteResponse.Completion c;
|
AutocompleteResponse.Completion c;
|
||||||
c.documentation = symbol.doc;
|
c.documentation = symbol.doc;
|
||||||
response.completions ~= c;
|
response.completions ~= c;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for a; b has no documentation
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for c and d\nmore documentation for c and d
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for c and d\nmore documentation for c and d
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for e and f
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for e and f
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for g\nmore documentation for g
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for C.x
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for C.y and C.z
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for C.y and C.z
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for C and D
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
documentation for C and D
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
int a; /// documentation for a; b has no documentation
|
||||||
|
int b;
|
||||||
|
|
||||||
|
/** documentation for c and d */
|
||||||
|
/** more documentation for c and d */
|
||||||
|
int c;
|
||||||
|
/** ditto */
|
||||||
|
int d;
|
||||||
|
|
||||||
|
/** documentation for e and f */ int e;
|
||||||
|
int f; /// ditto
|
||||||
|
|
||||||
|
/** documentation for g */
|
||||||
|
int g; /// more documentation for g
|
||||||
|
|
||||||
|
/// documentation for C and D
|
||||||
|
class C
|
||||||
|
{
|
||||||
|
int x; /// documentation for C.x
|
||||||
|
|
||||||
|
/** documentation for C.y and C.z */
|
||||||
|
int y;
|
||||||
|
int z; /// ditto
|
||||||
|
}
|
||||||
|
|
||||||
|
/// ditto
|
||||||
|
class D { }
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c5 > actual1.txt
|
||||||
|
diff actual1.txt expected1.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c61 > actual2.txt
|
||||||
|
diff actual2.txt expected2.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c140 > actual3.txt
|
||||||
|
diff actual3.txt expected3.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c160 > actual4.txt
|
||||||
|
diff actual4.txt expected4.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c201 > actual5.txt
|
||||||
|
diff actual5.txt expected5.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c208 > actual6.txt
|
||||||
|
diff actual6.txt expected6.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c254 > actual7.txt
|
||||||
|
diff actual7.txt expected7.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c323 > actual8.txt
|
||||||
|
diff actual8.txt expected8.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c335 > actual8.1.txt
|
||||||
|
diff actual8.1.txt expected8.1.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c414 > actual8.2.txt
|
||||||
|
diff actual8.2.txt expected8.2.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c425 > actual8.3.txt
|
||||||
|
diff actual8.3.txt expected8.3.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -d -c457 > actual9.txt
|
||||||
|
diff actual9.txt expected9.txt
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
identifiers
|
||||||
|
foo f void foo() stdin 26 my documentation
|
||||||
|
foo f void foo(int i) stdin 49 my documentation
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
/// my documentation
|
||||||
|
void foo(){}
|
||||||
|
/// ditto
|
||||||
|
void foo(int i){}
|
||||||
|
|
||||||
|
void test()
|
||||||
|
{
|
||||||
|
fo
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file.d -x -c80 > actual1.txt
|
||||||
|
diff actual1.txt expected1.txt
|
||||||
Loading…
Reference in New Issue