#66 and partial resolution to constructor completion

This commit is contained in:
Hackerpilot 2013-11-05 17:56:22 -08:00
parent 55e8577067
commit ba64604a55
2 changed files with 12 additions and 6 deletions

View File

@ -387,7 +387,7 @@ private:
void visitConstructor(size_t location, Parameters parameters, void visitConstructor(size_t location, Parameters parameters,
FunctionBody functionBody) FunctionBody functionBody)
{ {
SemanticSymbol* symbol = new SemanticSymbol("this", SemanticSymbol* symbol = new SemanticSymbol("*constructor*",
CompletionKind.functionName, symbolFile, location); CompletionKind.functionName, symbolFile, location);
processParameters(symbol, null, "this", parameters); processParameters(symbol, null, "this", parameters);
symbol.protection = protection; symbol.protection = protection;
@ -617,7 +617,11 @@ private:
currentSymbol.acSymbol.location); currentSymbol.acSymbol.location);
break; break;
case aliasName: case aliasName:
// TODO const(ACSymbol)* t = resolveType(currentSymbol.type,
currentSymbol.acSymbol.location);
while (t !is null && t.kind == CompletionKind.aliasName)
t = t.type;
currentSymbol.acSymbol.type = t;
break; break;
case enumName: case enumName:
case keyword: case keyword:

View File

@ -421,7 +421,7 @@ void setCompletions(T)(ref AutocompleteResponse response,
&& symbols[0].callTip is null) && symbols[0].callTip is null)
{ {
auto call = symbols[0].getPartsByName("opCall"); auto call = symbols[0].getPartsByName("opCall");
if (call.length == 0) if (call.length > 0)
{ {
symbols = call; symbols = call;
goto setCallTips; goto setCallTips;
@ -431,6 +431,7 @@ void setCompletions(T)(ref AutocompleteResponse response,
return; return;
else else
{ {
Log.trace("Not a function, but it has a constructor");
symbols = constructor; symbols = constructor;
goto setCallTips; goto setCallTips;
} }
@ -440,7 +441,8 @@ void setCompletions(T)(ref AutocompleteResponse response,
foreach (symbol; symbols) foreach (symbol; symbols)
{ {
Log.trace("Adding calltip ", symbol.callTip); Log.trace("Adding calltip ", symbol.callTip);
response.completions ~= symbol.callTip; if (symbol.kind != CompletionKind.aliasName)
response.completions ~= symbol.callTip;
} }
} }
} }
@ -571,8 +573,8 @@ void setImportCompletions(T)(T tokens, ref AutocompleteResponse response)
{ {
response.completions ~= name.baseName(); response.completions ~= name.baseName();
response.completionKinds ~= response.completionKinds ~=
exists(buildPath(name, "package.d")) || exists(buildPath(name, "package.di")) exists(buildPath(name, "package.d")) || exists(buildPath(name, "package.di"))
? CompletionKind.packageName : CompletionKind.moduleName; ? CompletionKind.packageName : CompletionKind.moduleName;
} }
} }
} }