From f12597892481804d1ca6e6272d56fbbb11b2e3ef Mon Sep 17 00:00:00 2001 From: RUSShyTwo <94763084+RUSShyTwo@users.noreply.github.com> Date: Sun, 5 Dec 2021 04:56:56 +0100 Subject: [PATCH] Also generate ctor calltips for symbols with a callTip This is needed because in an upcoming PR i have moved This: https://github.com/Pure-D/serve-d/blob/aeae249f9fdc6269c7f4963907eb5ed645d0691c/source/served/commands/complete.d#L969 Into: https://github.com/dlang-community/DCD/blob/2bfd3d004ff7eda2428353d2ab44f389dfd5b8e0/src/dcd/server/autocomplete/util.d#L756 Since it'll set the callTip for struct/class, this logic must be updated to take that into account --- src/dcd/server/autocomplete/complete.d | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/dcd/server/autocomplete/complete.d b/src/dcd/server/autocomplete/complete.d index c346e27..255cd12 100644 --- a/src/dcd/server/autocomplete/complete.d +++ b/src/dcd/server/autocomplete/complete.d @@ -619,10 +619,16 @@ void setCompletions(T)(ref AutocompleteResponse response, } } } + } + if (symbols[0].kind != CompletionKind.functionName + && (symbols[0].callTip is null)) + { if (symbols[0].kind == CompletionKind.structName || symbols[0].kind == CompletionKind.className) { + auto constructor = symbols[0].getPartsByName(CONSTRUCTOR_SYMBOL_NAME); + if (constructor.length == 0) { // Build a call tip out of the struct fields @@ -640,6 +646,7 @@ void setCompletions(T)(ref AutocompleteResponse response, } } } + setCallTips: response.completionType = CompletionType.calltips; foreach (symbol; symbols)