This commit is contained in:
Hackerpilot 2013-11-06 15:40:28 -08:00
parent ba64604a55
commit 4b1bc4a283
2 changed files with 20 additions and 6 deletions

View File

@ -447,6 +447,7 @@ private:
}
symbol.acSymbol.callTip = formatCallTip(returnType, functionName,
parameters);
symbol.type = returnType;
}
static string formatCallTip(Type returnType, string name, Parameters parameters,
@ -612,10 +613,6 @@ private:
case variableName:
case memberVariableName:
case functionName:
// Log.trace("Resolving type of ", currentSymbol.acSymbol.name);
currentSymbol.acSymbol.type = resolveType(currentSymbol.type,
currentSymbol.acSymbol.location);
break;
case aliasName:
const(ACSymbol)* t = resolveType(currentSymbol.type,
currentSymbol.acSymbol.location);

View File

@ -154,6 +154,15 @@ const(ACSymbol)*[] getSymbolsByTokenChain(T)(const(Scope)* completionScope,
break loop;
break;
case identifier:
// Use function return type instead of the function itself
if (symbols[0].qualifier == SymbolQualifier.func
|| symbols[0].kind == CompletionKind.functionName)
{
symbols = symbols[0].type is null ? [] :[symbols[0].type];
if (symbols.length == 0)
break loop;
}
Log.trace("looking for ", tokens[i].value, " in ", symbols[0].name);
symbols = symbols[0].getPartsByName(tokens[i].value);
if (symbols.length == 0)
@ -193,7 +202,7 @@ const(ACSymbol)*[] getSymbolsByTokenChain(T)(const(Scope)* completionScope,
{
auto h = i;
skip();
Parser p;
Parser p = new Parser();
p.setTokens(tokens[h .. i].array());
if (!p.isSliceExpression())
{
@ -209,7 +218,7 @@ const(ACSymbol)*[] getSymbolsByTokenChain(T)(const(Scope)* completionScope,
{
auto h = i;
skip();
Parser p;
Parser p = new Parser();
p.setTokens(tokens[h .. i].array());
const(ACSymbol)*[] overloads;
if (p.isSliceExpression())
@ -403,6 +412,14 @@ void setCompletions(T)(ref AutocompleteResponse response,
if (completionType == CompletionType.identifiers)
{
if (symbols[0].qualifier == SymbolQualifier.func
|| symbols[0].kind == CompletionKind.functionName)
{
Log.trace("Completion list for return type of function ", symbols[0].name);
symbols = symbols[0].type is null ? [] : [symbols[0].type];
if (symbols.length == 0)
return;
}
foreach (s; symbols[0].parts.filter!(a => a.name !is null
&& a.name[0] != '*'
&& (partial is null ? true : a.name.toUpper().startsWith(partial.toUpper()))