Make sure the symbol's type it points to is a function to avoid messing with aliases

This commit is contained in:
RUSshy 2021-08-31 15:04:02 +02:00 committed by GitHub
parent c419dbe193
commit cfac7edf5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -758,7 +758,7 @@ AutocompleteResponse.Completion makeSymbolCompletionInfo(const DSymbol* symbol,
string definition; string definition;
if ((kind == CompletionKind.variableName || kind == CompletionKind.memberVariableName) && symbol.type) if ((kind == CompletionKind.variableName || kind == CompletionKind.memberVariableName) && symbol.type)
{ {
DSymbol* s = cast(DSymbol*)symbol; const(DSymbol)* s = symbol;
// if using auto as variable declaration, then the type will be the function name // if using auto as variable declaration, then the type will be the function name
// so let's get what the function symbol points to to get the actual type // so let's get what the function symbol points to to get the actual type
@ -770,7 +770,7 @@ AutocompleteResponse.Completion makeSymbolCompletionInfo(const DSymbol* symbol,
// //
// TODO: should probably move it at the call site // TODO: should probably move it at the call site
// TODO: should probably make it fully recursive, // TODO: should probably make it fully recursive,
if(s.type) s = s.type; if(s.type && s.type.kind == CompletionKind.functionName) s = s.type;
definition = s.type.name ~ ' ' ~ s.name; definition = s.type.name ~ ' ' ~ s.name;
} }