Fix up console tab-completion again.

This commit is contained in:
Andrew Steinborn
2018-10-25 01:42:57 -04:00
parent 6c27ac9576
commit a98fcc28fe

View File

@@ -52,10 +52,15 @@ public final class VelocityConsole extends SimpleTerminalConsole implements Comm
.appName("Velocity")
.completer((reader, parsedLine, list) -> {
try {
boolean isCommand = parsedLine.line().indexOf(' ') == -1;
Optional<List<String>> o = this.server.getCommandManager().offerSuggestions(this, parsedLine.line());
o.ifPresent(offers -> {
for (String offer : offers) {
if (isCommand) {
list.add(new Candidate(offer.substring(1)));
} else {
list.add(new Candidate(offer));
}
}
});
} catch (Exception e) {