From cfac7edf5a5a1098c27817aa4e5d4ea7fdfcd486 Mon Sep 17 00:00:00 2001 From: RUSshy <18348637+RUSshy@users.noreply.github.com> Date: Tue, 31 Aug 2021 15:04:02 +0200 Subject: [PATCH] Make sure the symbol's type it points to is a function to avoid messing with aliases --- src/dcd/server/autocomplete/util.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dcd/server/autocomplete/util.d b/src/dcd/server/autocomplete/util.d index 73eb545..8da8ccc 100644 --- a/src/dcd/server/autocomplete/util.d +++ b/src/dcd/server/autocomplete/util.d @@ -758,7 +758,7 @@ AutocompleteResponse.Completion makeSymbolCompletionInfo(const DSymbol* symbol, string definition; 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 // 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 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; }