mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-09 20:52:54 +00:00
LibLine: Unify completion hooks and adapt its users
LibLine should ultimately not care about what a "token" means in the context of its user, so force the user to split the buffer itself. This also allows the users to pick up contextual clues as well, since they have to lex the line themselves. This commit pacthes Shell and the JS repl to better handle completions, so certain wrong behaviours are now corrected as well: - JS repl can now complete "Object . getOw<tab>" - Shell can now complete "echo | ca<tab>" and paths inside strings
This commit is contained in:
parent
d18f6e82eb
commit
7fba21aefc
Notes:
sideshowbarker
2024-07-19 06:19:59 +09:00
Author: https://github.com/alimpfard
Commit: 7fba21aefc
Pull-request: https://github.com/SerenityOS/serenity/pull/2294
Reviewed-by: https://github.com/bugaevc
6 changed files with 179 additions and 171 deletions
Shell
|
@ -75,11 +75,8 @@ int main(int argc, char** argv)
|
|||
editor.strip_styles();
|
||||
shell->highlight(editor);
|
||||
};
|
||||
editor.on_tab_complete_first_token = [&](const String& token_to_complete) -> Vector<Line::CompletionSuggestion> {
|
||||
return shell->complete_first(token_to_complete);
|
||||
};
|
||||
editor.on_tab_complete_other_token = [&](const String& token_to_complete) -> Vector<Line::CompletionSuggestion> {
|
||||
return shell->complete_other(token_to_complete);
|
||||
editor.on_tab_complete = [&](const Line::Editor& editor) {
|
||||
return shell->complete(editor);
|
||||
};
|
||||
|
||||
signal(SIGINT, [](int) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue