[PATCH] D40060: [clangd] Fuzzy match scorer

2017-12-01 Thread Sam McCall via Phabricator via cfe-commits
sammccall marked an inline comment as done. sammccall added a comment. I'd broken the scoring scale with the last few tweaks: - The harsh pattern-split penalty was driving too many decent matches to 0 score - The case-insensitive change resulted in some perfect prefix matches not getting perfect

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-12-01 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. sammccall marked an inline comment as done. Closed by commit rL319557: [clangd] Fuzzy match scorer (authored by sammccall). Changed prior to commit: https://reviews.llvm.org/D40060?vs=124968&id=125159#toc Repository: rL

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-12-01 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM. Comment at: clangd/FuzzyMatch.h:53 + + int PatN, WordN; // Length of pattern and word. + char Pat[MaxPat], Word[MaxWord];

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. Thanks @ilya-biryukov, @inspirer, @klimek for the helpful comments! I've addressed hopefully the most important and added more rigorous testing. Sorry for the large delta, the most invasive change was of course adding the extra dimension to the scoring table. (Which fi

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 124968. sammccall marked 5 inline comments as done. sammccall added a comment. - added more VSCode tests, and made test assert matched characters. This uncovered algorithm problems - cache now includes "did previous character match" in the key (scoring depe

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-29 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/FuzzyMatch.cpp:118 +0x00, 0x00, 0x00, 0x00, // Control characters +0xff, 0xff, 0xff, 0xff, // Punctuation +0x55, 0x55, 0xf5, 0xff, // Numbers->Lower, more Punctuation. I'm not sure if we care, bu

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-27 Thread Evgeny Gryaznov via Phabricator via cfe-commits
inspirer added inline comments. Comment at: clangd/FuzzyMatch.cpp:254 + // Penalty: matching inside a segment (and previous char wasn't matched). + if (WordRole[W] == Tail && P && !Matched[P - 1][W - 1]) +S -= 3; You need a third boolean dimension in your D

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-23 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 124096. sammccall marked 15 inline comments as done. sammccall added a comment. Addressing review comments and generally improving comments. https://reviews.llvm.org/D40060 Files: clangd/CMakeLists.txt clangd/FuzzyMatch.cpp clangd/FuzzyMatch.h uni

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-23 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. Thanks for the review, and sorry for the subtlety of the code and sparse comments. It should be a little better now, please let me know which parts aren't clear enough. Comment at: clangd/FuzzyMatch.cpp:69 +: NPat(std::min(MaxPat, Pattern.size()

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-23 Thread Manuel Klimek via Phabricator via cfe-commits
klimek added inline comments. Comment at: clangd/FuzzyMatch.cpp:69 +: NPat(std::min(MaxPat, Pattern.size())), NWord(0), + ScoreScale(0.5f / NPat) { + memcpy(Pat, Pattern.data(), NPat); Why .5? Comment at: clangd/FuzzyMatch.cpp:88 +

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-15 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 122986. sammccall added a comment. Trim memory usage and add comments. https://reviews.llvm.org/D40060 Files: clangd/CMakeLists.txt clangd/FuzzyMatch.cpp clangd/FuzzyMatch.h unittests/clangd/CMakeLists.txt unittests/clangd/FuzzyMatchTests.cpp I

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-14 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 122956. sammccall added a comment. clang-format https://reviews.llvm.org/D40060 Files: clangd/CMakeLists.txt clangd/FuzzyMatch.cpp clangd/FuzzyMatch.h unittests/clangd/CMakeLists.txt unittests/clangd/FuzzyMatchTests.cpp Index: unittests/clangd/

[PATCH] D40060: [clangd] Fuzzy match scorer

2017-11-14 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision. Herald added a subscriber: mgorny. This will be used for rescoring code completion results based on partial identifiers. Short-term use: - we want to limit the number of code completion results returned to improve performance of global completion. The scorer will