commit c9ad7497def70b7edcb99514dacd3c3336377c7c parent f18bb3147ba55358c4aa2dc48699f85890e464e2 Author: Sylvia Ivory <git@sivory.net> Date: Sat, 21 Jun 2025 23:09:14 -0700 Add syntax errors to hinter Diffstat:
| M | src/validator.rs | | | 13 | +++++++++---- |
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/validator.rs b/src/validator.rs @@ -62,10 +62,15 @@ impl Hinter for LuaValidator { ) -> String { let lua = Self::burner_lua(); - let value: LuaValue = if let Ok(value) = lua.load(line).eval() { - value - } else { - return String::new(); + let value: LuaValue = match lua.load(line).set_name("=").eval() { + Ok(value) => value, + Err(LuaError::SyntaxError { message, incomplete_input: _ }) => { + let message = message.split(":").last().unwrap().trim(); + let style = Style::new().fg(Color::Red).dimmed(); + + return style.paint(format!(" ({message})")).to_string() + }, + Err(_) => return String::new() }; if value.is_nil() {