fixup #369, completion after calltip broke other features
This commit is contained in:
parent
cb2074a152
commit
cc481193c8
|
@ -175,8 +175,12 @@ public AutocompleteResponse complete(const AutocompleteRequest request,
|
||||||
{
|
{
|
||||||
ImportKind kind = determineImportKind(beforeTokens);
|
ImportKind kind = determineImportKind(beforeTokens);
|
||||||
if (kind == ImportKind.neither)
|
if (kind == ImportKind.neither)
|
||||||
|
{
|
||||||
|
if (beforeTokens.isUdaExpression)
|
||||||
|
beforeTokens = beforeTokens[$-1 .. $];
|
||||||
return dotCompletion(beforeTokens, tokenArray, request.cursorPosition,
|
return dotCompletion(beforeTokens, tokenArray, request.cursorPosition,
|
||||||
moduleCache);
|
moduleCache);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return importCompletion(beforeTokens, kind, moduleCache);
|
return importCompletion(beforeTokens, kind, moduleCache);
|
||||||
}
|
}
|
||||||
|
@ -1195,6 +1199,29 @@ private enum TYPE_IDENT_AND_LITERAL_CASES = q{
|
||||||
case tok!"dstringLiteral":
|
case tok!"dstringLiteral":
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool isUdaExpression(T)(ref T tokens)
|
||||||
|
{
|
||||||
|
bool result;
|
||||||
|
ptrdiff_t skip;
|
||||||
|
ptrdiff_t i = tokens.length - 2;
|
||||||
|
|
||||||
|
while (i >= 2)
|
||||||
|
{
|
||||||
|
if (skip == 0 && tokens[i].type == tok!"identifier" && tokens[i-1].type == tok!"@")
|
||||||
|
{
|
||||||
|
result = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
skip += tokens[i].type == tok!")";
|
||||||
|
skip -= tokens[i].type == tok!"(";
|
||||||
|
|
||||||
|
--i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -1222,13 +1249,6 @@ T getExpression(T)(T beforeTokens)
|
||||||
|
|
||||||
expressionLoop: while (true)
|
expressionLoop: while (true)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (i > 0 && beforeTokens[i].type == tok!"identifier" &&
|
|
||||||
beforeTokens[i-1].type == tok!"@" )
|
|
||||||
{
|
|
||||||
return beforeTokens[0 .. 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (beforeTokens[i].type)
|
switch (beforeTokens[i].type)
|
||||||
{
|
{
|
||||||
case tok!"import":
|
case tok!"import":
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
calltips
|
||||||
|
this(int a)
|
|
@ -0,0 +1 @@
|
||||||
|
struct UDA{int a;} @UDA(
|
|
@ -3,3 +3,6 @@ set -u
|
||||||
|
|
||||||
../../bin/dcd-client $1 file.d -c29 > actual.txt
|
../../bin/dcd-client $1 file.d -c29 > actual.txt
|
||||||
diff actual.txt expected.txt
|
diff actual.txt expected.txt
|
||||||
|
|
||||||
|
../../bin/dcd-client $1 file1.d -c25 > actual1.txt
|
||||||
|
diff actual1.txt expected1.txt
|
||||||
|
|
Loading…
Reference in New Issue