Page MenuHomePhabricator

[clangd] Improve code completion for ObjC methods
ClosedPublic

Authored by dgoldman on Oct 31 2018, 7:57 AM.

Details

Summary

Previously code completion did not work well for Objective-C methods
which contained multiple arguments as clangd did not expect to see
multiple typed-text chunks when handling code completion.

Note that even with this change, we do not consider selector fragments
from previous arguments to be part of the signature (although we
could in the future).

Diff Detail

Event Timeline

dgoldman created this revision.Oct 31 2018, 7:57 AM
sammccall accepted this revision.Nov 8 2018, 6:02 AM

Thanks for fixing this!

unittests/clangd/CodeCompleteTests.cpp
2213

"Context" is an odd name for this.

2220

this will crash if there aren't any completions, and do something unpredictable if there are multiple.
either grab the completions and then ASSERT_THAT(completions, ElementsAre(_)) or write a getOnlyCompletion() helper that does the needed logging.
(Note an assertion on size isn't as good, as it only prints the size on failure)

This revision is now accepted and ready to land.Nov 8 2018, 6:02 AM
dgoldman updated this revision to Diff 173737.Nov 12 2018, 12:55 PM

CodeCompleteTests fixes

dgoldman marked 2 inline comments as done.Nov 12 2018, 12:56 PM

Since I don't have commit access, @sammccall will land this.

This revision was automatically updated to reflect the committed changes.