clang: Improve argument hint code completion
ClosedPublic

Authored by mwolff on Jan 8 2018, 12:02 AM.

Details

Summary

Previously, the overload candidates never got an DUChain Declaration
associated, meaning we could not inspect the API documentation in-line
from the code completion. The reason was that most of the time the
hinted declaration is also a valid "normal" completion item, and thus
was found a second time. The findDeclaration call then returned null
for the second call, since we added the declaration to the exclusion
set after the first call. Instead, use a separate set for overload
candidates to fix this. Note that the expanded argument hint item
is still not showing any documentation in-line... Apparently there's
more to fix to get this done properly.

While at it, also use the ArgumentHintItem for the situations where
we (now) find a Declaration, to get proper current-argument
highlighting.

Then fix the unit test to expect the default arguments. Though
potentially this is clang-version dependent? Anyhow, this makes the
test pass for me on my machine with libclang from LLVM 5.0.0.

Diff Detail

Repository
R32 KDevelop
Lint
No Linters Available
Unit
No Unit Test Coverage
mwolff created this revision.Jan 8 2018, 12:02 AM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptJan 8 2018, 12:02 AM
mwolff requested review of this revision.Jan 8 2018, 12:02 AM
kfunk accepted this revision.Jan 9 2018, 8:26 AM
kfunk added a subscriber: kfunk.

Nice changes!

This revision is now accepted and ready to land.Jan 9 2018, 8:26 AM
This revision was automatically updated to reflect the committed changes.