This is an archive of the discontinued LLVM Phabricator instance.

Code completion should not ignore default parameters in functions.
ClosedPublic

Authored by usaxena95 on Aug 7 2019, 6:32 AM.

Details

Summary

Inorder to display the default arguments we must process the
CK_Optional chunks of CodeCompletionString while creating the Signature.

We do not create placeholders for default arguments.

Event Timeline

usaxena95 created this revision.Aug 7 2019, 6:32 AM
usaxena95 updated this revision to Diff 213871.Aug 7 2019, 7:01 AM

Removed unused include of logger.

sammccall accepted this revision.Aug 7 2019, 7:45 AM
sammccall added inline comments.
clang-tools-extra/clangd/CodeCompletionStrings.cpp
35

maybe appendOptionalChunk? if in doubt, better to describe the semantics of the param than its type, since the type appears in the signature

156

please drop the extra message from the assert unless there's something additional to say (it just echoes the expression here)

(I don't have a strong opinion on this assert - I'm fine with keeping it but you could also drop it as we're enforcing someone else's clearly documented invariant)

clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
944

for completeness, could you also add a unit test to CodeCompletionStringsTests.cpp?

This revision is now accepted and ready to land.Aug 7 2019, 7:45 AM
usaxena95 updated this revision to Diff 213926.Aug 7 2019, 9:24 AM
usaxena95 marked 3 inline comments as done.

Added tests in CodeCompletionStringsTests.cpp
Resolved comments.

usaxena95 updated this revision to Diff 213927.Aug 7 2019, 9:28 AM

Formatted new test.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2019, 9:51 AM