remove dittos from the results of the ddoc query, close #325

This commit is contained in:
Basile Burg 2016-09-19 16:27:33 +02:00
parent 9e39236f3c
commit dffaf8d75e
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
4 changed files with 20 additions and 1 deletions

View File

@ -73,6 +73,15 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request,
{
Appender!(char[]) app;
bool isDitto(string s)
{
import std.uni : icmp;
if (s.length > 5)
return false;
else
return s.icmp("ditto") == 0;
}
void putDDocChar(dchar c)
{
switch (c)
@ -97,7 +106,7 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request,
putDDocChar(c);
}
foreach(symbol; stuff.symbols.filter!(a => !a.doc.empty))
foreach(ref symbol; stuff.symbols.filter!(a => !a.doc.empty && !isDitto(a.doc)))
{
app.clear;
putDDocString(symbol.doc);

1
tests/tc044/expected.txt Normal file
View File

@ -0,0 +1 @@
d

1
tests/tc044/file.d Normal file
View File

@ -0,0 +1 @@
/**d*/void fun(){} /**ditto*/void fun(uint){} /** ditto */void fun(float){}

8
tests/tc044/run.sh Executable file
View File

@ -0,0 +1,8 @@
set -e
set -u
../../bin/dcd-client $1 file.d -c12 -d > actual.txt
diff actual.txt expected.txt
../../bin/dcd-client $1 file.d -c35 -d > actual.txt
diff actual.txt expected.txt