mirror of
https://github.com/dlang-community/DCD.git
synced 2025-04-26 21:29:58 +03:00
Fix #250
This commit is contained in:
parent
70c78a2a10
commit
bb34e38d4f
10 changed files with 53 additions and 2 deletions
|
@ -819,8 +819,11 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
||||||
Scope* completionScope, T tokens, size_t cursorPosition,
|
Scope* completionScope, T tokens, size_t cursorPosition,
|
||||||
CompletionType completionType, bool isBracket = false, string partial = null)
|
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())
|
foreach (sym; s.opSlice())
|
||||||
{
|
{
|
||||||
if (sym.name !is null && sym.name.length > 0 && sym.kind != CompletionKind.importSymbol
|
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;
|
r.completions ~= sym.name.dup;
|
||||||
}
|
}
|
||||||
if (sym.kind == CompletionKind.importSymbol && !sym.skipOver && sym.type !is null)
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
tests/imports/circular/a.d
Normal file
5
tests/imports/circular/a.d
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
module circular.a;
|
||||||
|
public import circular.b;
|
||||||
|
|
||||||
|
int alpha;
|
||||||
|
|
4
tests/imports/circular/b.d
Normal file
4
tests/imports/circular/b.d
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module circular.b;
|
||||||
|
public import circular.a;
|
||||||
|
|
||||||
|
int bravo;
|
4
tests/imports/circular/x.d
Normal file
4
tests/imports/circular/x.d
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module circular.x;
|
||||||
|
public import circular.y;
|
||||||
|
|
||||||
|
int x_ray;
|
4
tests/imports/circular/y.d
Normal file
4
tests/imports/circular/y.d
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module circular.y;
|
||||||
|
public import circular.z;
|
||||||
|
|
||||||
|
int yankee;
|
4
tests/imports/circular/z.d
Normal file
4
tests/imports/circular/z.d
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
module circular.z;
|
||||||
|
public import circular.x;
|
||||||
|
|
||||||
|
int zulu;
|
3
tests/tc018/expected1.txt
Normal file
3
tests/tc018/expected1.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
identifiers
|
||||||
|
alpha v
|
||||||
|
bravo v
|
4
tests/tc018/expected2.txt
Normal file
4
tests/tc018/expected2.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
identifiers
|
||||||
|
x_ray v
|
||||||
|
yankee v
|
||||||
|
zulu v
|
12
tests/tc018/file.d
Normal file
12
tests/tc018/file.d
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import circular.a;
|
||||||
|
import circular.x;
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
circular.a.
|
||||||
|
}
|
||||||
|
|
||||||
|
unittest
|
||||||
|
{
|
||||||
|
circular.x.
|
||||||
|
}
|
||||||
|
|
8
tests/tc018/run.sh
Executable file
8
tests/tc018/run.sh
Executable file
|
@ -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…
Add table
Add a link
Reference in a new issue