diff options
| author | Maxime Coste <mawww@kakoune.org> | 2024-10-22 21:18:23 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2024-10-22 21:18:23 +1100 |
| commit | 50917b39ca410feac0f8dbf37b6db408aeedc2b8 (patch) | |
| tree | 7ec723bf865d5a2ab56cb7a98e64aaa5440d959f /src/command_manager.cc | |
| parent | ca7bc55cf5134b11451ca6b88d9fa0205bbaac66 (diff) | |
Remove now unused CompletionFlags
Since shell-script-completions now runs the script asynchronously
and unconditionally, there is no use for the CompletionFlags::Fast
anymore which means we can remove that type altogether.
Diffstat (limited to 'src/command_manager.cc')
| -rw-r--r-- | src/command_manager.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/command_manager.cc b/src/command_manager.cc index fd32f93c..e30f8a68 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -658,7 +658,7 @@ Completions CommandManager::complete_module_name(StringView query) const | transform(&ModuleMap::Item::key))}; } -static Completions complete_expansion(const Context& context, CompletionFlags flags, +static Completions complete_expansion(const Context& context, Token token, ByteCount start, ByteCount cursor_pos, ByteCount pos_in_token) { @@ -674,7 +674,7 @@ static Completions complete_expansion(const Context& context, CompletionFlags fl token.content, pos_in_token) }; case Token::Type::ShellExpand: - return offset_pos(shell_complete(context, flags, token.content, + return offset_pos(shell_complete(context, token.content, pos_in_token), start); case Token::Type::ValExpand: @@ -695,7 +695,7 @@ static Completions complete_expansion(const Context& context, CompletionFlags fl } } -static Completions complete_expand(const Context& context, CompletionFlags flags, +static Completions complete_expand(const Context& context, StringView prefix, ByteCount start, ByteCount cursor_pos, ByteCount pos_in_token) { @@ -713,7 +713,7 @@ static Completions complete_expand(const Context& context, CompletionFlags flags continue; if (token.type == Token::Type::Raw or token.type == Token::Type::RawQuoted) return {}; - return complete_expansion(context, flags, token, + return complete_expansion(context, token, start + token.pos, cursor_pos, pos_in_token - token.pos); } @@ -748,8 +748,7 @@ static Completions requote(Completions completions, Token::Type token_type) } Completions CommandManager::Completer::operator()( - const Context& context, CompletionFlags flags, - StringView command_line, ByteCount cursor_pos) + const Context& context, StringView command_line, ByteCount cursor_pos) { auto prefix = command_line.substr(0_byte, cursor_pos); CommandParser parser{prefix}; @@ -800,7 +799,7 @@ Completions CommandManager::Completer::operator()( case Token::Type::ShellExpand: case Token::Type::ValExpand: case Token::Type::FileExpand: - return complete_expansion(context, flags, token, start, cursor_pos, pos_in_token); + return complete_expansion(context, token, start, cursor_pos, pos_in_token); case Token::Type::Raw: case Token::Type::RawQuoted: @@ -840,7 +839,7 @@ Completions CommandManager::Completer::operator()( const auto& switch_desc = command.param_desc.switches.get(raw_params.at(raw_params.size() - 2).substr(1_byte)); if (not *switch_desc.arg_completer) return Completions{}; - return offset_pos(requote((*switch_desc.arg_completer)(context, flags, raw_params.back(), pos_in_token), token.type), start); + return offset_pos(requote((*switch_desc.arg_completer)(context, raw_params.back(), pos_in_token), token.type), start); } case ParametersParser::State::Positional: break; @@ -852,10 +851,10 @@ Completions CommandManager::Completer::operator()( Vector<String> params{parser.begin(), parser.end()}; auto index = params.size() - 1; - return offset_pos(requote(m_command_completer(context, flags, params, index, pos_in_token), token.type), start); + return offset_pos(requote(m_command_completer(context, params, index, pos_in_token), token.type), start); } case Token::Type::Expand: - return complete_expand(context, flags, token.content, start, cursor_pos, pos_in_token); + return complete_expand(context, token.content, start, cursor_pos, pos_in_token); default: break; } @@ -863,7 +862,7 @@ Completions CommandManager::Completer::operator()( } Completions CommandManager::NestedCompleter::operator()( - const Context& context, CompletionFlags flags, CommandParameters params, + const Context& context, CommandParameters params, size_t token_to_complete, ByteCount pos_in_token) { StringView prefix = params[token_to_complete].substr(0, pos_in_token); @@ -881,7 +880,7 @@ Completions CommandManager::NestedCompleter::operator()( } return m_command_completer - ? m_command_completer(context, flags, params.subrange(1), token_to_complete-1, pos_in_token) + ? m_command_completer(context, params.subrange(1), token_to_complete-1, pos_in_token) : Completions{}; } |
