Add template parameters to the autocomplete response for struct/class

This commit is contained in:
ryuukk 2024-01-04 23:23:05 +01:00 committed by GitHub
parent 57794ca875
commit 33611175fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 0 deletions

View File

@ -539,6 +539,31 @@ AutocompleteResponse.Completion makeSymbolCompletionInfo(const DSymbol* symbol,
} }
else if (kind == CompletionKind.enumMember) else if (kind == CompletionKind.enumMember)
ret.definition = symbol.name; // TODO: add enum value to definition string ret.definition = symbol.name; // TODO: add enum value to definition string
else if (kind == CompletionKind.structName || kind == CompletionKind.className)
{
string newName;
istring[] t_type;
foreach(part; symbol.opSlice())
{
if (part.kind == CompletionKind.typeTmpParam)
t_type ~= part.name;
}
auto tcount = t_type.length;
if (tcount > 0)
{
newName = symbol.name ~ "(";
foreach(i, part; t_type)
{
newName ~= part;
if (i < tcount - 1)
newName ~= ", ";
}
newName ~= ")";
}
else
newName = symbol.callTip;
ret.definition = newName;
}
else else
ret.definition = symbol.callTip; ret.definition = symbol.callTip;