mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Simplify repl tips
This commit is contained in:
parent
2bf6dd9b18
commit
1f396871f9
4 changed files with 18 additions and 15 deletions
|
@ -1,21 +1,20 @@
|
||||||
//! Command Line Interface (CLI) functionality for the Read-Evaluate-Print-Loop (REPL).
|
//! Command Line Interface (CLI) functionality for the Read-Evaluate-Print-Loop (REPL).
|
||||||
mod cli_gen;
|
mod cli_gen;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
|
||||||
|
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
|
use const_format::concatcp;
|
||||||
use roc_load::MonomorphizedModule;
|
use roc_load::MonomorphizedModule;
|
||||||
use roc_mono::ir::OptLevel;
|
use roc_mono::ir::OptLevel;
|
||||||
use roc_repl_eval::gen::Problems;
|
use roc_repl_eval::gen::Problems;
|
||||||
|
use roc_repl_ui::colors::{BLUE, END_COL, PINK};
|
||||||
use roc_repl_ui::repl_state::{ReplAction, ReplState};
|
use roc_repl_ui::repl_state::{ReplAction, ReplState};
|
||||||
use roc_repl_ui::{
|
use roc_repl_ui::{format_output, is_incomplete, CONT_PROMPT, PROMPT, SHORT_INSTRUCTIONS, TIPS};
|
||||||
format_output, is_incomplete, CONT_PROMPT, PROMPT, SHORT_INSTRUCTIONS, TIPS, WELCOME_MESSAGE,
|
|
||||||
};
|
|
||||||
use roc_reporting::report::{ANSI_STYLE_CODES, DEFAULT_PALETTE};
|
use roc_reporting::report::{ANSI_STYLE_CODES, DEFAULT_PALETTE};
|
||||||
use roc_target::TargetInfo;
|
use roc_target::TargetInfo;
|
||||||
use rustyline::highlight::{Highlighter, PromptInfo};
|
use rustyline::highlight::{Highlighter, PromptInfo};
|
||||||
use rustyline::validate::{self, ValidationContext, ValidationResult, Validator};
|
use rustyline::validate::{self, ValidationContext, ValidationResult, Validator};
|
||||||
use rustyline_derive::{Completer, Helper, Hinter};
|
use rustyline_derive::{Completer, Helper, Hinter};
|
||||||
|
use std::borrow::Cow;
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
|
|
||||||
use crate::cli_gen::eval_llvm;
|
use crate::cli_gen::eval_llvm;
|
||||||
|
|
|
@ -1408,10 +1408,8 @@ fn interpolation_with_nested_interpolation() {
|
||||||
Tips:
|
Tips:
|
||||||
|
|
||||||
- ctrl-v + ctrl-j makes a newline
|
- ctrl-v + ctrl-j makes a newline
|
||||||
|
|
||||||
- :q to quit
|
- :q to quit
|
||||||
|
- :help shows this text again"#
|
||||||
- :help"#
|
|
||||||
),
|
),
|
||||||
// TODO figure out why the tests prints the repl help text at the end, but only after syntax errors or something?
|
// TODO figure out why the tests prints the repl help text at the end, but only after syntax errors or something?
|
||||||
// In the actual repl this doesn't happen, only in the test.
|
// In the actual repl this doesn't happen, only in the test.
|
||||||
|
|
|
@ -11,13 +11,15 @@ use roc_parse::ast::{Expr, ValueDef};
|
||||||
use roc_repl_eval::gen::{Problems, ReplOutput};
|
use roc_repl_eval::gen::{Problems, ReplOutput};
|
||||||
use roc_reporting::report::StyleCodes;
|
use roc_reporting::report::StyleCodes;
|
||||||
|
|
||||||
|
use crate::colors::GREEN;
|
||||||
|
|
||||||
// TODO add link to repl tutorial(does not yet exist).
|
// TODO add link to repl tutorial(does not yet exist).
|
||||||
pub const TIPS: &str = concatcp!(
|
pub const TIPS: &str = concatcp!(
|
||||||
"\nEnter an expression to evaluate, or a definition (like ",
|
"\nEnter an expression to evaluate, or a definition (like ",
|
||||||
BLUE,
|
BLUE,
|
||||||
"x = 1",
|
"x = 1",
|
||||||
END_COL,
|
END_COL,
|
||||||
") to use later.\n\nTips:\n\n",
|
") to use later.\n\n",
|
||||||
if cfg!(target_family = "wasm") {
|
if cfg!(target_family = "wasm") {
|
||||||
// In the web REPL, the :quit command doesn't make sense. Just close the browser tab!
|
// In the web REPL, the :quit command doesn't make sense. Just close the browser tab!
|
||||||
// We use Shift-Enter for newlines because it's nicer than our workaround for Unix terminals (see below)
|
// We use Shift-Enter for newlines because it's nicer than our workaround for Unix terminals (see below)
|
||||||
|
@ -51,15 +53,21 @@ pub const TIPS: &str = concatcp!(
|
||||||
PINK,
|
PINK,
|
||||||
"ctrl-j",
|
"ctrl-j",
|
||||||
END_COL,
|
END_COL,
|
||||||
" makes a newline\n\n",
|
" makes a newline\n",
|
||||||
BLUE,
|
BLUE,
|
||||||
" - ",
|
" - ",
|
||||||
END_COL,
|
END_COL,
|
||||||
":q to quit\n\n",
|
GREEN,
|
||||||
|
":q",
|
||||||
|
END_COL,
|
||||||
|
" quits\n",
|
||||||
BLUE,
|
BLUE,
|
||||||
" - ",
|
" - ",
|
||||||
END_COL,
|
END_COL,
|
||||||
":help"
|
GREEN,
|
||||||
|
":help",
|
||||||
|
END_COL,
|
||||||
|
" shows this text again\n",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -72,9 +72,7 @@ li {
|
||||||
}
|
}
|
||||||
|
|
||||||
#history-text {
|
#history-text {
|
||||||
margin: 16px 0;
|
margin-top: 16px;
|
||||||
padding: 8px;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#loading-message {
|
#loading-message {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue