Skip to content

Commit

Permalink
Add support for extended output when requesting symbol's documentation (
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuukk authored Nov 14, 2023
1 parent f15ca10 commit 5244f81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/dcd/client/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/dcd/server/autocomplete/doc.d
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request,
continue;
firstSymbol = false;

AutocompleteResponse.Completion c;
AutocompleteResponse.Completion c = makeSymbolCompletionInfo(symbol, symbol.kind);
c.documentation = symbol.doc;
response.completions ~= c;
}
Expand Down

0 comments on commit 5244f81

Please sign in to comment.