[PATCH] D124637: [clangd][ObjC] Filter ObjC method completions on the remaining selector
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 19 00:00:12 PDT 2022
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.
Sorry about the delay :-(
================
Comment at: clang-tools-extra/clangd/CodeComplete.cpp:1989
CodeCompletion Item;
Item.Name = Name.str() + "=";
Item.Kind = CompletionItemKind::Text;
----------------
also here
================
Comment at: clang/include/clang/Sema/CodeCompleteConsumer.h:612
+ /// methods, can have multiple.
+ bool hasMultipleTypedTextChunks() const;
+
----------------
I'm not sure we should add this new API.
Our only use case so far is an optimization (over getAllTypedText) and it's not a great fit for this (it requires us to do two traversals of the CCS in the common case).
On the other hand an interface that avoids this is specialized.
Instead maybe just place the loop at the callsite in getName()?
```
const Chunk *OnlyText = nullptr;
for (Chunk &C : CCS) {
if (!C is TypedText) continue;
if (OnlyText) return CCS.getAllTypedText()
OnlyText = &C;
}
return C ? C->Text : nullptr;
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124637/new/
https://reviews.llvm.org/D124637
More information about the cfe-commits
mailing list