mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:47:43 +00:00
Shell: Take whitespace into account when suggesting tokens
Prior to this, we did not care if there was any whitespace after the last token in the prompt, and this caused a regression: ``` > lsp <tab> > lsp ci ```
This commit is contained in:
parent
e2886aabcd
commit
2b3e9c28b2
1 changed files with 8 additions and 2 deletions
|
@ -1501,8 +1501,14 @@ Vector<Line::CompletionSuggestion> Shell::complete(const Line::Editor& editor)
|
||||||
if (args.last().type == Token::Comment) // we cannot complete comments
|
if (args.last().type == Token::Comment) // we cannot complete comments
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
is_first_in_subcommand = args.size() == 1;
|
if (args.last().end != line.length()) {
|
||||||
token = last_command.args.last().text;
|
// There was a token separator at the end
|
||||||
|
is_first_in_subcommand = false;
|
||||||
|
token = "";
|
||||||
|
} else {
|
||||||
|
is_first_in_subcommand = args.size() == 1;
|
||||||
|
token = last_command.args.last().text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue