fix issue 557 - Module name completion should not complete anything

This commit is contained in:
Basile Burg 2018-12-29 14:29:37 +01:00
parent 21f273abfb
commit 292f3bae06
4 changed files with 7 additions and 3 deletions

View File

@ -77,10 +77,11 @@ public AutocompleteResponse complete(const AutocompleteRequest request,
if (tokenArray.length >= 3 && tokenArray[0] == tok!"module" && beforeTokens.length &&
(beforeTokens[$-1] == tok!"." || dotId))
{
const upper = tokenArray.countUntil!(a => a.type == tok!";");
bool isSame = true;
const upper = tokenArray.countUntil!(a => a.type == tok!";" &&
a.index < beforeTokens[$-1].index);
bool isSame = upper != -1;
// enough room for the module decl and the fqn...
if (upper != -1 && beforeTokens.length >= upper * 2)
if (isSame && beforeTokens.length >= upper * 2)
foreach (immutable i; 0 .. upper)
{
const j = beforeTokens.length - upper + i - 1 - ubyte(dotId);

View File

View File

@ -0,0 +1 @@
module foo.test; int x;

View File

@ -5,3 +5,5 @@ set -u
diff actual1.txt expected1.txt
../../bin/dcd-client $1 file2.d -c46 > actual2.txt
diff actual2.txt expected2.txt
../../bin/dcd-client $1 file3.d -c11 > actual3.txt
diff actual3.txt expected3.txt