add warning and error

pull/8675/merge^2
Matt Paras 2025-06-21 14:44:15 -07:00
parent ef7ea0f519
commit 557aa9cc19
1 changed files with 28 additions and 1 deletions

View File

@ -3669,10 +3669,23 @@ callback : (-> any?)
```
"#
);
register_1!(
"set-status!",
set_status,
"Sets the content of the status line"
"Sets the content of the status line, with the info severity"
);
register_1!(
"set-warning!",
set_warning,
"Sets the content of the status line, with the warning severity"
);
register_1!(
"set-error!",
set_error,
"Sets the content of the status line, with the error severity"
);
module.register_fn("send-lsp-command", send_arbitrary_lsp_command);
@ -4706,6 +4719,20 @@ fn set_status(cx: &mut Context, value: SteelVal) {
}
}
fn set_warning(cx: &mut Context, value: SteelVal) {
match value {
SteelVal::StringV(s) => cx.editor.set_warning(s.as_ref().to_owned()),
_ => cx.editor.set_warning(value.to_string()),
}
}
fn set_error(cx: &mut Context, value: SteelVal) {
match value {
SteelVal::StringV(s) => cx.editor.set_error(s.as_ref().to_owned()),
_ => cx.editor.set_error(value.to_string()),
}
}
fn enqueue_command(cx: &mut Context, callback_fn: SteelVal) {
let rooted = callback_fn.as_rooted();