================
@@ -1029,7 +1031,9 @@ struct CompletionRecorder : public CodeCompleteConsumer {
     // CodeCompletionResult doesn't seem to be const-correct. We own it, 
anyway.
     return const_cast<CodeCompletionResult &>(R).CreateCodeCompletionString(
         *CCSema, CCContext, *CCAllocator, CCTUInfo,
-        /*IncludeBriefComments=*/false);
+        /*IncludeBriefComments=*/false,
+        /*SuppressFuncParamType=*/Opts.ArgumentLists ==
----------------
HighCommander4 wrote:

I think I understand why: clangd derives two different things from the 
`CodeCompletionString`: a "signature" and a "snippet suffix". The "signature" 
is used to render the completion item in the completion popup, while the 
"snippet suffix" is used as part of the inserted code snippet if the completion 
is accepted.

Currently, both of these contain the parameter types, and to respect the 
existing values of `ArgumentListsPolicy`, we just ignore the "snippet suffix" 
for values of the setting other than `FullPlaceholders`.

But now, if we build the `CodeCompletionString` with 
`SuppressFuncParmType=true`, the "signature" will be missing the types too, 
which is undesirable (the user is still interested in seeing the types when 
viewing the completion item in the popup).

To address this, I think we'll need to build two `CodeCompletionString`s, one 
for the "signature" with `SuppressFuncParmType=false`, and one for the "snippet 
suffix" with `SuppressFuncParmType=(ArgumentListsPolicy==NamePlaceholders)`.

(A more principled solution may be to alter the `CodeCompletionString` 
structure to put the parameter types and parameter names into different chunks, 
but that seems like a bigger lift that we may not want to undertake now.)

https://github.com/llvm/llvm-project/pull/200103
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to