Merge pull request #348 from BBasile/ignore-dittos

remove dittos from the results of the ddoc query, close #325
This commit is contained in:
Brian Schott 2016-09-19 11:31:11 -07:00 committed by GitHub
commit 58da3c7e8c
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