Implemented prompt expansion, and display for errors

This commit is contained in:
2025-03-18 15:54:06 -04:00
parent d673bb692f
commit 0d286ba006
14 changed files with 1022 additions and 288 deletions

View File

@@ -3,6 +3,7 @@ use std::borrow::Cow;
use rustyline::{completion::Completer, highlight::Highlighter, hint::{Hint, Hinter}, validate::{ValidationResult, Validator}, Helper};
use crate::{libsh::term::{Style, Styled}, parse::{lex::{LexFlags, LexStream}, ParseStream}};
use crate::prelude::*;
pub struct FernReadline {
}
@@ -67,7 +68,7 @@ impl Validator for FernReadline {
fn validate(&self, ctx: &mut rustyline::validate::ValidationContext) -> rustyline::Result<rustyline::validate::ValidationResult> {
return Ok(ValidationResult::Valid(None));
let mut tokens = vec![];
let tk_stream = LexStream::new(ctx.input(), LexFlags::empty());
let tk_stream = LexStream::new(Rc::new(ctx.input().to_string()), LexFlags::empty());
for tk in tk_stream {
if tk.is_err() {
return Ok(ValidationResult::Incomplete)