This is an archive of the discontinued LLVM Phabricator instance.

[clangd][ObjC] Filter ObjC method completions on the remaining selector
ClosedPublic

Authored by dgoldman on Apr 28 2022, 1:26 PM.

Details

Summary

Previously, clangd would filter completions only on the first part of
the selector (first typed chunk) instead of all remaining selector
fragments (all typed chunks).

Diff Detail

Event Timeline

dgoldman created this revision.Apr 28 2022, 1:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 28 2022, 1:26 PM
dgoldman requested review of this revision.Apr 28 2022, 1:26 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 28 2022, 1:26 PM

Friendly ping

sammccall accepted this revision.May 19 2022, 12:00 AM

Sorry about the delay :-(

clang-tools-extra/clangd/CodeComplete.cpp
1994–1995

also here

clang/include/clang/Sema/CodeCompleteConsumer.h
612

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;
This revision is now accepted and ready to land.May 19 2022, 12:00 AM
dgoldman updated this revision to Diff 430974.May 20 2022, 7:54 AM
dgoldman marked an inline comment as done.

Go through chunks in getName and add missed FilterText place

dgoldman marked an inline comment as done.May 20 2022, 7:54 AM
This revision was landed with ongoing or failed builds.May 20 2022, 8:50 AM
This revision was automatically updated to reflect the committed changes.