[PATCH] D52276: [clangd] Add type boosting in code completion

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 23 04:53:31 PST 2018


ilya-biryukov added inline comments.


================
Comment at: clangd/Quality.cpp:373
+  if (TypeMatchesPreferred)
+    Score *= 2.0;
+
----------------
sammccall wrote:
> is 2 really enough?
Changed to 5. We can tweak it later if that turns out to be too big.


================
Comment at: clangd/Quality.h:98
+  /// Whether the item matches the type expected in the completion context.
+  bool TypeMatchesPreferred = false;
   /// FIXME: unify with index proximity score - signals should be
----------------
sammccall wrote:
> sammccall wrote:
> > you've inserted in the middle of the file proximity stuff :-)
> Generally we'd put both context/symbol types as the signal here, rather than just whether they match, unless it's prohibitive. They'd get populated manually, and by merge() overloads, respectively.
I did it to avoid inefficiencies of:
1. copying the context type for each completion item,
2. copying the symbol type for each of the indexed items.

My understanding is that (1) can be avoided by storing a reference to a type, since it outlives the signals.
But we'll still have to do a copy for (2), right?

That's probably not a bottleneck anyway, but keeping it a bool flag for now and happy to change it  to your liking.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52276





More information about the cfe-commits mailing list