-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting completion candidates based on clang priority #519
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,6 +221,7 @@ Command *CommandParser::parse(const std::vector<std::string> &argv) { | |
case Command::Candidates: | ||
positionalArgs.push_back(StringConverter(&command_.prefix)); | ||
positionalArgs.push_back(PrefixMatchStyleConverter(&command_.style)); | ||
positionalArgs.push_back(StringConverter(&command_.sorting)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to modify Command.def as well, to change the description of the command (which I recommend below to apply to the |
||
break; | ||
case Command::CompletionDiagnostics: | ||
case Command::Diagnostics: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,7 +102,7 @@ class Irony { | |
/// Get all the completion candidates. | ||
/// | ||
/// \pre complete() was called. | ||
void candidates(const std::string &prefix, PrefixMatchStyle style) const; | ||
void candidates(const std::string &prefix, PrefixMatchStyle style, const std::string &sorting) const; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe do like PrefixMatchStyle, and make a dedicated enum to represent the possibles values instead of storing it as a string. |
||
|
||
/// Get the diagnostics produced by the last \c complete(). | ||
/// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,7 +181,7 @@ int main(int ac, const char *av[]) { | |
break; | ||
|
||
case Command::Candidates: | ||
irony.candidates(c->prefix, c->style); | ||
irony.candidates(c->prefix, c->style, c->sorting); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it could make more sense to do this in the |
||
break; | ||
|
||
case Command::CompletionDiagnostics: | ||
|
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.
In terms of vocabulary, I think I would do something like:
sorting-method:
priority
,alphabetical
.I would not allow nil, but instead produce an error.
nil
seems to imply this is the soundest default value, which I am not yet sure.A more neutral approach is to have enumeration value, and if one make more sense than the other, the defcustom will be updated accordingly.
I'm mostly thinking about a future 3rd option coming up, that would be the best default value.