This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Code completion: drop explicit injected names/operators, ignore Sema priority
ClosedPublic

Authored by sammccall on Jun 7 2018, 3:50 AM.

Details

Summary

Now we have most of Sema's code completion signals incorporated in Quality,
which will allow us to give consistent ranking to sema/index results.

Therefore we can/should stop using Sema priority as an explicit signal.
This fixes some issues like namespaces always having a terrible score.

The most important missing signals are:

  • Really dumb/rarely useful completions like: SomeStruct().^SomeStruct SomeStruct().^operator= SomeStruct().~SomeStruct() We already filter out destructors, this patch adds injected names and operators to that list.
  • type matching the expression context. Ilya has a plan to add this in a way that's compatible with indexes (design doc should be shared real soon now!)

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.Jun 7 2018, 3:50 AM

Maybe we could add the test cases that the blacklisted members still show up in completion that don't involve member qualifiers? For example,

struct X : std::vector<int> { 
  int test( ){
     // <-- 'vector' might be a useful completion here.
  }
};
ioeric accepted this revision.Jun 7 2018, 5:37 AM
ioeric added inline comments.
clangd/CodeComplete.cpp
542 ↗(On Diff #150290)

!Context.getBaseType().isNull() probably deserves a comment.

This revision is now accepted and ready to land.Jun 7 2018, 5:37 AM
sammccall marked an inline comment as done.Jun 7 2018, 5:51 AM

Added explicit tests for this feature.

sammccall updated this revision to Diff 150307.Jun 7 2018, 5:51 AM

Added tests and comments.

This revision was automatically updated to reflect the committed changes.