mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00: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:
committed by
Ali Mohammad Pur
parent
4ede121d31
commit
4ea9ca06b4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user