Fix #250
This commit is contained in:
parent
70c78a2a10
commit
bb34e38d4f
|
@ -819,8 +819,11 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
|||
Scope* completionScope, T tokens, size_t cursorPosition,
|
||||
CompletionType completionType, bool isBracket = false, string partial = null)
|
||||
{
|
||||
static void addSymToResponse(DSymbol* s, ref AutocompleteResponse r, string p)
|
||||
static void addSymToResponse(DSymbol* s, ref AutocompleteResponse r, string p,
|
||||
size_t[] circularGuard = [])
|
||||
{
|
||||
if (circularGuard.canFind(cast(size_t) s))
|
||||
return;
|
||||
foreach (sym; s.opSlice())
|
||||
{
|
||||
if (sym.name !is null && sym.name.length > 0 && sym.kind != CompletionKind.importSymbol
|
||||
|
@ -831,7 +834,7 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
|||
r.completions ~= sym.name.dup;
|
||||
}
|
||||
if (sym.kind == CompletionKind.importSymbol && !sym.skipOver && sym.type !is null)
|
||||
addSymToResponse(sym.type, r, p);
|
||||
addSymToResponse(sym.type, r, p, circularGuard ~ (cast(size_t) s));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
module circular.a;
|
||||
public import circular.b;
|
||||
|
||||
int alpha;
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module circular.b;
|
||||
public import circular.a;
|
||||
|
||||
int bravo;
|
|
@ -0,0 +1,4 @@
|
|||
module circular.x;
|
||||
public import circular.y;
|
||||
|
||||
int x_ray;
|
|
@ -0,0 +1,4 @@
|
|||
module circular.y;
|
||||
public import circular.z;
|
||||
|
||||
int yankee;
|
|
@ -0,0 +1,4 @@
|
|||
module circular.z;
|
||||
public import circular.x;
|
||||
|
||||
int zulu;
|
|
@ -0,0 +1,3 @@
|
|||
identifiers
|
||||
alpha v
|
||||
bravo v
|
|
@ -0,0 +1,4 @@
|
|||
identifiers
|
||||
x_ray v
|
||||
yankee v
|
||||
zulu v
|
|
@ -0,0 +1,12 @@
|
|||
import circular.a;
|
||||
import circular.x;
|
||||
unittest
|
||||
{
|
||||
circular.a.
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
circular.x.
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
set -e
|
||||
set -u
|
||||
|
||||
../../bin/dcd-client file.d -c61 > actual1.txt
|
||||
diff actual1.txt expected1.txt
|
||||
|
||||
../../bin/dcd-client file.d -c88 > actual2.txt
|
||||
diff actual2.txt expected2.txt
|
Loading…
Reference in New Issue