Skip to content

Commit

Permalink
Complete complete-command completer type
Browse files Browse the repository at this point in the history
  • Loading branch information
mawww committed Apr 19, 2024
1 parent 3d7d0fe commit b4fbfba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,14 @@ Vector<String> params_to_shell(const ParametersParser& parser)
return vars;
}

Completions complete_completer_type(const Context&, CompletionFlags,
StringView prefix, ByteCount cursor_pos)
{
static constexpr StringView completers[] = {"file", "client", "buffer", "shell-script", "shell-script-candidates", "command", "shell"};
return { 0_byte, cursor_pos, complete(prefix, cursor_pos, completers) };
}


CommandCompleter make_command_completer(StringView type, StringView param, Completions::Flags completions_flags)
{
if (type == "file")
Expand Down Expand Up @@ -1494,7 +1502,7 @@ const CommandDesc complete_command_cmd = {
ParameterDesc::Flags::None, 2, 3},
CommandFlags::None,
CommandHelper{},
make_completer(complete_command_name),
make_completer(complete_command_name, complete_completer_type),
[](const ParametersParser& parser, Context& context, const ShellContext&)
{
const Completions::Flags flags = parser.get_switch("menu") ? Completions::Flags::Menu : Completions::Flags::None;
Expand Down

0 comments on commit b4fbfba

Please sign in to comment.