1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 01:29:14 -05:00

feat(repl): show list completion (#11001)

This commit is contained in:
Casper Beyer 2021-06-22 08:07:26 +08:00 committed by GitHub
parent 9105892ec8
commit 68c519d061
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,8 @@ use rustyline::highlight::Highlighter;
use rustyline::validate::ValidationContext;
use rustyline::validate::ValidationResult;
use rustyline::validate::Validator;
use rustyline::CompletionType;
use rustyline::Config;
use rustyline::Context;
use rustyline::Editor;
use rustyline_derive::{Helper, Hinter};
@ -304,7 +306,11 @@ struct ReplEditor {
impl ReplEditor {
pub fn new(helper: EditorHelper, history_file_path: PathBuf) -> Self {
let mut editor = Editor::new();
let editor_config = Config::builder()
.completion_type(CompletionType::List)
.build();
let mut editor = Editor::with_config(editor_config);
editor.set_helper(Some(helper));
editor.load_history(&history_file_path).unwrap_or(());