-
Notifications
You must be signed in to change notification settings - Fork 163
More options for completion filtering #786
base: master
Are you sure you want to change the base?
Conversation
For me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to merge when implementation is finalized
src/completion_matcher.h
Outdated
class CompletionMatcher { | ||
public: | ||
// virtual ~CompletionMatcher() = default; // don't know why but it crashed if I uncomment this like, investigating | ||
virtual int Match(std::string_view text) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some timing to see if the virtual function call is negatively impacting how long it takes to filter completion results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check it a bit later, no problem. I'm sure that virtual function call will not spend much more time than plain function call, especially comparing to all that fuzzy-matching stuff = )
src/config.h
Outdated
@@ -156,6 +156,9 @@ struct Config { | |||
// For example, to hide all files in a /CACHE/ folder, use ".*/CACHE/.*" | |||
std::vector<std::string> includeBlacklist; | |||
std::vector<std::string> includeWhitelist; | |||
|
|||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to document all possible options here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/completion_matcher.h
Outdated
|
||
class CompletionMatcher { | ||
public: | ||
// virtual ~CompletionMatcher() = default; // don't know why but it crashed if I uncomment this like, investigating |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange, but this should have a virtual dtor for correct behavior (also, the = default should probably go in a .cc file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The = default
part can behave differently if moved to the .cc
file.
https://accu.org/index.php/journals/2379
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea whats happened but now it works fine. Probably some weird stuff on my side
src/prefix_match.cc
Outdated
|
||
namespace { | ||
bool StartsWith(std::string_view text, std::string_view prefix) { | ||
return text.find(prefix) == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be a function in utils.h to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. And also moved StartsWithIgnoreCase
to utils
Hi guys. Sorry, was too busy all the week |
Also which version of clang-format do you use to format code? Mine is 6.0.0 and I'm getting some diff on untouched files when formatting all src directory |
If cquery is not explicitly sorting then that is almost certainly your completion client not honoring the priority. |
Damn, there're soo many packages between me and code I'm trying to edit) maybe you can help me a bit? I just need to understand who is sorting candidates (lsp-mode, emacs-cquery, company-lsp). Maybe you can point me to some elisp code which receives completion candidates from cquery and gives it to some lsp-mode functions? |
Sorry, I'm not very familiar with how emacs LSP works. |
Okay, no problem, I'll try to dig into it |
Here's the first try to add more options for completion filtering