This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Incorporate fuzzy-match into result rankings.
ClosedPublic

Authored by sammccall on Dec 4 2017, 5:07 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.Dec 4 2017, 5:07 AM
ioeric added inline comments.Dec 5 2017, 2:24 AM
clangd/ClangdUnit.cpp
377 ↗(On Diff #125311)

It might worth mentioning how well FilterScore * SymbolScore performs. I think it could be affected by the distribution of the filtering score and symbol scores. We might want to do some tweaks on the numbers depending on the distributions...

380 ↗(On Diff #125311)

Any reason not to use CompletionItemScores here? Maybe copy over some comments?

sammccall marked 2 inline comments as done.Jan 12 2018, 7:20 AM

Tested in this file:

#include <memory>
#include <unordered_map>
#include <vector>
int main() { std::^ }

Before this change:

u -> __has_argument_type, __has_first_argument_type...
un -> __has_argument_type, __has_first_argument_type...
u_p -> __has_argument_type, __has_first_argument_type...
um -> uintmax_t, unordered_map, unordered_multimap...

After this change

u -> u16streampos, u16string, u32streampos...
un -> unary_function, unary_negate, uncaught_exception...
u_p -> unique_ptr, undeclare_no_pointers, __has_argument_type...
um -> unordered_map, unordered_multimap, __has_argument_type...
clangd/ClangdUnit.cpp
377 ↗(On Diff #125311)

Described this sensitivity.

380 ↗(On Diff #125311)

Done. My feeling was that CompletionItemScores was an API and we shouldn't couple our internal layout to it. But it's convenient now and may remain so, we can change it later.

sammccall updated this revision to Diff 129622.Jan 12 2018, 7:25 AM
sammccall marked 2 inline comments as done.

Rebase, and address comments.

hokein accepted this revision.Jan 12 2018, 7:46 AM
hokein added a subscriber: hokein.

LGTM.

test/clangd/completion-fuzzy.test
1 ↗(On Diff #129622)

nit: any reason not using unittest CodeCompleteTests here?

This revision is now accepted and ready to land.Jan 12 2018, 7:46 AM
sammccall updated this revision to Diff 129633.Jan 12 2018, 8:16 AM
sammccall marked an inline comment as done.

Unit test instead of lit test.

test/clangd/completion-fuzzy.test
1 ↗(On Diff #129622)

Whoops, none at all! Done.
When I first wrote this, CodeCompletionTests didn't exist in a useful form.

This revision was automatically updated to reflect the committed changes.