mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
Shell: Allow completions to request further action from the shell
The shell now expects a JSON object of the form {"kind":<kind>,...} per line in the standard output of the completion process, where 'kind' is one of: - "plain": Just a plain suggestion. - "program": Prompts the shell to complete a program name starting with the given "name". - "proxy": Prompts the shell to act as if a completion for "argv" was requested. - "path": Prompts the shell to complete a path given the "base" and "part" (same as completing part in cwd=base).
This commit is contained in:
parent
4ede121d31
commit
4ea9ca06b4
Notes:
sideshowbarker
2024-07-17 11:42:23 +09:00
Author: https://github.com/alimpfard
Commit: 4ea9ca06b4
Pull-request: https://github.com/SerenityOS/serenity/pull/13686
2 changed files with 55 additions and 23 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <AK/CircularQueue.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/StackInfo.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <AK/StringView.h>
|
||||
|
@ -223,6 +224,7 @@ public:
|
|||
|
||||
void highlight(Line::Editor&) const;
|
||||
Vector<Line::CompletionSuggestion> complete();
|
||||
Vector<Line::CompletionSuggestion> complete(StringView);
|
||||
Vector<Line::CompletionSuggestion> complete_program_name(StringView, size_t offset, EscapeMode = EscapeMode::Bareword);
|
||||
Vector<Line::CompletionSuggestion> complete_variable(StringView, size_t offset);
|
||||
Vector<Line::CompletionSuggestion> complete_user(StringView, size_t offset);
|
||||
|
@ -419,6 +421,8 @@ private:
|
|||
mutable bool m_last_continuation_state { false }; // false == not needed.
|
||||
|
||||
Optional<size_t> m_history_autosave_time;
|
||||
|
||||
StackInfo m_completion_stack_info;
|
||||
};
|
||||
|
||||
[[maybe_unused]] static constexpr bool is_word_character(char c)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue