fix issue 557 - Module name completion should not complete anything
This commit is contained in:
parent
21f273abfb
commit
292f3bae06
|
@ -77,10 +77,11 @@ public AutocompleteResponse complete(const AutocompleteRequest request,
|
||||||
if (tokenArray.length >= 3 && tokenArray[0] == tok!"module" && beforeTokens.length &&
|
if (tokenArray.length >= 3 && tokenArray[0] == tok!"module" && beforeTokens.length &&
|
||||||
(beforeTokens[$-1] == tok!"." || dotId))
|
(beforeTokens[$-1] == tok!"." || dotId))
|
||||||
{
|
{
|
||||||
const upper = tokenArray.countUntil!(a => a.type == tok!";");
|
const upper = tokenArray.countUntil!(a => a.type == tok!";" &&
|
||||||
bool isSame = true;
|
a.index < beforeTokens[$-1].index);
|
||||||
|
bool isSame = upper != -1;
|
||||||
// enough room for the module decl and the fqn...
|
// 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)
|
foreach (immutable i; 0 .. upper)
|
||||||
{
|
{
|
||||||
const j = beforeTokens.length - upper + i - 1 - ubyte(dotId);
|
const j = beforeTokens.length - upper + i - 1 - ubyte(dotId);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module foo.test; int x;
|
|
@ -5,3 +5,5 @@ set -u
|
||||||
diff actual1.txt expected1.txt
|
diff actual1.txt expected1.txt
|
||||||
../../bin/dcd-client $1 file2.d -c46 > actual2.txt
|
../../bin/dcd-client $1 file2.d -c46 > actual2.txt
|
||||||
diff actual2.txt expected2.txt
|
diff actual2.txt expected2.txt
|
||||||
|
../../bin/dcd-client $1 file3.d -c11 > actual3.txt
|
||||||
|
diff actual3.txt expected3.txt
|
||||||
|
|
Loading…
Reference in New Issue