[clang] [clang-tools-extra] [clangd] CodeCompletion surface param names if possible (PR #206716)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 7 00:17:44 PDT 2026
HighCommander4 wrote:
> * But the inconsistency between code completion and signature help is still there. Note that this inconsistency is not present upstream, so we'd be introducing a regression if we land the patch in its current form.
I think the reason for this is that signature help uses [`AddOverloadParameterChunks`](https://searchfox.org/llvm/rev/1df080a267eeda318f6abb9791f098d870e622fd/clang/lib/Sema/SemaCodeComplete.cpp#4168) rather than `AddFunctionParameterChunks`, so we want some corresponding `BetterSignature` logic around [here](https://searchfox.org/llvm/rev/1df080a267eeda318f6abb9791f098d870e622fd/clang/lib/Sema/SemaCodeComplete.cpp#4182). (A test would be nice as well.)
> Moreover, in the automated test cases (which are passing), the selected declaration is `void moon(int, int day);`, which is the _last_ one with parameter names (whereas in the tests above `(int night)` is the first one)... so I feel like there's something I'm missing still.
Ok, it seems to be "start with the first declaration, then walk backwards". Seems a bit counterintuitive as a user, but then it only makes a difference in cases where we have actually conflicting names, which is an edge case not really worth catering to, so I think this is fine.
https://github.com/llvm/llvm-project/pull/206716
More information about the cfe-commits
mailing list