Skip to content

Commit

Permalink
Also generate ctor calltips for Struct/Class symbols with a callTip
Browse files Browse the repository at this point in the history
  • Loading branch information
RUSShyTwo authored and WebFreak001 committed Oct 13, 2022
1 parent 5c529f3 commit c2361f5
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/dcd/server/autocomplete/complete.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
if (constructor.length == 0)
{
// Build a call tip out of the struct fields
if (symbols[0].kind == CompletionKind.structName)
{
response.completionType = CompletionType.calltips;
response.completions = [generateStructConstructorCalltip(symbols[0])];
return;
}
}
else
// Build a call tip out of the struct fields
if (symbols[0].kind == CompletionKind.structName)
{
symbols = constructor;
goto setCallTips;
response.completionType = CompletionType.calltips;
response.completions = [generateStructConstructorCalltip(symbols[0])];
return;
}
}
else
{
symbols = constructor;
goto setCallTips;
}
}

setCallTips:
response.completionType = CompletionType.calltips;
foreach (symbol; symbols)
Expand Down

0 comments on commit c2361f5

Please sign in to comment.