[clang] [clang-tools-extra] [clang][CodeComplete] skip explicit obj param in SignatureHelp (PR #146649)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 28 22:21:39 PDT 2025
================
@@ -4386,12 +4430,24 @@ TEST(CompletionTest, SkipExplicitObjectParameter) {
MockFS FS;
auto Inputs = TU.inputs(FS);
- auto Result = codeComplete(testPath(TU.Filename), Code.point(),
- Preamble.get(), Inputs, Opts);
-
- EXPECT_THAT(Result.Completions,
- ElementsAre(AllOf(named("foo"), signature("(int arg)"),
- snippetSuffix("(${1:int arg})"))));
+ {
+ auto Result = codeComplete(testPath(TU.Filename), Code.point("c1"),
+ Preamble.get(), Inputs, Opts);
+
+ EXPECT_THAT(Result.Completions,
+ UnorderedElementsAre(AllOf(named("foo"), signature("(int arg)"),
+ snippetSuffix("(${1:int arg})")),
+ AllOf(named("bar"), signature("(int arg)"),
+ snippetSuffix("(${1:int arg})"))));
+ }
+ {
+ auto Result = codeComplete(testPath(TU.Filename), Code.point("c2"),
+ Preamble.get(), Inputs, Opts);
+ // TODO: snippet suffix is empty for c2
+ EXPECT_THAT(Result.Completions,
+ ElementsAre(AllOf(named("bar"), signature("(int arg)"),
+ snippetSuffix(""))));
----------------
HighCommander4 wrote:
We will want `snippetSuffix` to be `(${1:A self}, ${2: int arg})`, right (since the user will need to write both arguments in this scenario)?
Given that, would it be fair to say that `signature` being `(int arg)` is also wrong (it should probably be consistent with the snippet suffix)?
(Maybe just amend the TODO comment to talk about both?)
https://github.com/llvm/llvm-project/pull/146649
More information about the cfe-commits
mailing list