Also generate ctor calltips for Struct/Class symbols with a callTip

This commit is contained in:
RUSShyTwo 2021-12-05 05:10:18 +01:00 committed by WebFreak001
parent 5c529f300d
commit c2361f5c3e
No known key found for this signature in database
GPG Key ID: AEFC88D11109D1AA
1 changed files with 20 additions and 16 deletions

View File

@ -614,27 +614,31 @@ void setCompletions(T)(ref AutocompleteResponse response,
} }
} }
} }
if (symbols[0].kind == CompletionKind.structName }
|| symbols[0].kind == CompletionKind.className)
if (symbols[0].kind == CompletionKind.structName
|| symbols[0].kind == CompletionKind.className)
{
auto constructor = symbols[0].getPartsByName(CONSTRUCTOR_SYMBOL_NAME);
if (constructor.length == 0)
{ {
auto constructor = symbols[0].getPartsByName(CONSTRUCTOR_SYMBOL_NAME); // Build a call tip out of the struct fields
if (constructor.length == 0) if (symbols[0].kind == CompletionKind.structName)
{ {
// Build a call tip out of the struct fields response.completionType = CompletionType.calltips;
if (symbols[0].kind == CompletionKind.structName) response.completions = [generateStructConstructorCalltip(symbols[0])];
{ return;
response.completionType = CompletionType.calltips;
response.completions = [generateStructConstructorCalltip(symbols[0])];
return;
}
}
else
{
symbols = constructor;
goto setCallTips;
} }
} }
else
{
symbols = constructor;
goto setCallTips;
}
} }
setCallTips: setCallTips:
response.completionType = CompletionType.calltips; response.completionType = CompletionType.calltips;
foreach (symbol; symbols) foreach (symbol; symbols)