From 81674583557cad1961afea53e29f4d11665e0001 Mon Sep 17 00:00:00 2001 From: ryuukk <44361234+ryuukk@users.noreply.github.com> Date: Mon, 13 Nov 2023 20:42:31 +0100 Subject: [PATCH] Add the symbol definition to the doc response if 'extended' is passed to the client --- src/dcd/client/client.d | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/dcd/client/client.d b/src/dcd/client/client.d index e0be61d..d97ad8d 100644 --- a/src/dcd/client/client.d +++ b/src/dcd/client/client.d @@ -250,7 +250,7 @@ int runClient(string[] args) else if (getIdentifier) printIdentifierResponse(response); else if (doc) - printDocResponse(response); + printDocResponse(response, fullOutput); else if (search !is null) printSearchResponse(response); else if (localUse) @@ -359,10 +359,14 @@ Socket createSocket(string socketFile, ushort port) return socket; } -void printDocResponse(ref const AutocompleteResponse response) +void printDocResponse(ref const AutocompleteResponse response, bool extended) { - import std.algorithm : each; - response.completions.each!(a => a.documentation.escapeConsoleOutputString(true).writeln); + foreach (ref completion; response.completions) + { + if (extended) + writeln(completion.definition); + writeln(completion.documentation.escapeConsoleOutputString(true)); + } } void printIdentifierResponse(ref const AutocompleteResponse response)