parent
ba64604a55
commit
4b1bc4a283
|
@ -447,6 +447,7 @@ private:
|
||||||
}
|
}
|
||||||
symbol.acSymbol.callTip = formatCallTip(returnType, functionName,
|
symbol.acSymbol.callTip = formatCallTip(returnType, functionName,
|
||||||
parameters);
|
parameters);
|
||||||
|
symbol.type = returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
static string formatCallTip(Type returnType, string name, Parameters parameters,
|
static string formatCallTip(Type returnType, string name, Parameters parameters,
|
||||||
|
@ -612,10 +613,6 @@ private:
|
||||||
case variableName:
|
case variableName:
|
||||||
case memberVariableName:
|
case memberVariableName:
|
||||||
case functionName:
|
case functionName:
|
||||||
// Log.trace("Resolving type of ", currentSymbol.acSymbol.name);
|
|
||||||
currentSymbol.acSymbol.type = resolveType(currentSymbol.type,
|
|
||||||
currentSymbol.acSymbol.location);
|
|
||||||
break;
|
|
||||||
case aliasName:
|
case aliasName:
|
||||||
const(ACSymbol)* t = resolveType(currentSymbol.type,
|
const(ACSymbol)* t = resolveType(currentSymbol.type,
|
||||||
currentSymbol.acSymbol.location);
|
currentSymbol.acSymbol.location);
|
||||||
|
|
|
@ -154,6 +154,15 @@ const(ACSymbol)*[] getSymbolsByTokenChain(T)(const(Scope)* completionScope,
|
||||||
break loop;
|
break loop;
|
||||||
break;
|
break;
|
||||||
case identifier:
|
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);
|
Log.trace("looking for ", tokens[i].value, " in ", symbols[0].name);
|
||||||
symbols = symbols[0].getPartsByName(tokens[i].value);
|
symbols = symbols[0].getPartsByName(tokens[i].value);
|
||||||
if (symbols.length == 0)
|
if (symbols.length == 0)
|
||||||
|
@ -193,7 +202,7 @@ const(ACSymbol)*[] getSymbolsByTokenChain(T)(const(Scope)* completionScope,
|
||||||
{
|
{
|
||||||
auto h = i;
|
auto h = i;
|
||||||
skip();
|
skip();
|
||||||
Parser p;
|
Parser p = new Parser();
|
||||||
p.setTokens(tokens[h .. i].array());
|
p.setTokens(tokens[h .. i].array());
|
||||||
if (!p.isSliceExpression())
|
if (!p.isSliceExpression())
|
||||||
{
|
{
|
||||||
|
@ -209,7 +218,7 @@ const(ACSymbol)*[] getSymbolsByTokenChain(T)(const(Scope)* completionScope,
|
||||||
{
|
{
|
||||||
auto h = i;
|
auto h = i;
|
||||||
skip();
|
skip();
|
||||||
Parser p;
|
Parser p = new Parser();
|
||||||
p.setTokens(tokens[h .. i].array());
|
p.setTokens(tokens[h .. i].array());
|
||||||
const(ACSymbol)*[] overloads;
|
const(ACSymbol)*[] overloads;
|
||||||
if (p.isSliceExpression())
|
if (p.isSliceExpression())
|
||||||
|
@ -403,6 +412,14 @@ void setCompletions(T)(ref AutocompleteResponse response,
|
||||||
|
|
||||||
if (completionType == CompletionType.identifiers)
|
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
|
foreach (s; symbols[0].parts.filter!(a => a.name !is null
|
||||||
&& a.name[0] != '*'
|
&& a.name[0] != '*'
|
||||||
&& (partial is null ? true : a.name.toUpper().startsWith(partial.toUpper()))
|
&& (partial is null ? true : a.name.toUpper().startsWith(partial.toUpper()))
|
||||||
|
|
Loading…
Reference in New Issue