-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support auto completion of keywords in console #455
Support auto completion of keywords in console #455
Conversation
Unit testing passed. |
3 similar comments
Unit testing passed. |
Unit testing passed. |
Unit testing passed. |
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.
Well done
Unit testing passed. |
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.
Well done
Unit testing passed. |
Unit testing passed. |
|
||
void CliManager::initAutoCompletion() { | ||
// The completion function | ||
::rl_attempted_completion_function = completer; |
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.
Is there no default auto-complete module in readline? This is a very common feature.
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.
Yes, the default one is to complete filenames.
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.
If you mean whether readline has builtin support to all these functions here(Given a collection of keywords, readline does all completion works for you). I'm afraid the answer seems no. I had been following up the official documents.
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 module is useless if not allow users to pass custom keywords.
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.
Yes it is. Actually, you could infer from the completer
function, that if we don't have to support sub-keywords completion, all we need is to retrieve the longest common prefix of all completion candidates.
Unit testing passed. |
* Support auto completion of keywords in console * Omit completion in quotes * Use a resource file as completion rule * Addressed @laura-ding's comments * Address comments
* Support auto completion of keywords in console * Omit completion in quotes * Use a resource file as completion rule * Addressed @laura-ding's comments * Address comments
* snowflake id * fix bug * fix review * remove redundant * tmp * tmp * finish * fix * fix * fix header * fix header * fix format * fix test * fix review * fix bench * add 64 * fix review * fix review * fix viarable Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> Co-authored-by: jakevin <30525741+jackwener@users.noreply.github.com> Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com>
For now, we only support simple completions based on the keywords. In future, we may add support to sub-command, or we could even combine readline and our lexer and parser.
This will close #448