mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
feat(repl): show list completion (#11001)
This commit is contained in:
parent
9105892ec8
commit
68c519d061
1 changed files with 7 additions and 1 deletions
|
@ -19,6 +19,8 @@ use rustyline::highlight::Highlighter;
|
||||||
use rustyline::validate::ValidationContext;
|
use rustyline::validate::ValidationContext;
|
||||||
use rustyline::validate::ValidationResult;
|
use rustyline::validate::ValidationResult;
|
||||||
use rustyline::validate::Validator;
|
use rustyline::validate::Validator;
|
||||||
|
use rustyline::CompletionType;
|
||||||
|
use rustyline::Config;
|
||||||
use rustyline::Context;
|
use rustyline::Context;
|
||||||
use rustyline::Editor;
|
use rustyline::Editor;
|
||||||
use rustyline_derive::{Helper, Hinter};
|
use rustyline_derive::{Helper, Hinter};
|
||||||
|
@ -304,7 +306,11 @@ struct ReplEditor {
|
||||||
|
|
||||||
impl ReplEditor {
|
impl ReplEditor {
|
||||||
pub fn new(helper: EditorHelper, history_file_path: PathBuf) -> Self {
|
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.set_helper(Some(helper));
|
||||||
editor.load_history(&history_file_path).unwrap_or(());
|
editor.load_history(&history_file_path).unwrap_or(());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue