Skip to main content

Crate oo_api

Crate oo_api 

Source
Expand description

oo extension API — link this into your WASM extension.

§Minimal extension

#[no_mangle]
pub extern "C" fn oo_init() {}

#[no_mangle]
pub extern "C" fn detect_project() -> i32 { 1 }

#[no_mangle]
pub extern "C" fn oo_event(ptr: i32, len: i32) {
    oo_api::show_notification("Hello from WASM!", "info");
}

Structs§

ResponseFuture
Future returned by send_request.

Functions§

block_on
Spin-polls f until it resolves. Safe for single-threaded WASM where the host drives re-entry via oo_on_message from within __oo_host_call.
create_terminal
Create a terminal panel running command.
get_config
Read a config value for this extension. Returns None if not found.
has_language
Returns true when the host has detected at least one file of lang_id in the project. The host exposes these via a dedicated HasLanguage request; this helper sends that request and interprets a “true” string response.
log
Write a message to the IDE log.
oo_alloc
oo_alloc for use in a wasm extension
oo_free
oo_free for use in a wasm extension
oo_on_message
Called by the host to deliver a response. The payload is a MessagePack-encoded Message::Response in WASM linear memory.
open_file
Ask the host to open a file in the editor.
run_command
Trigger an IDE command by its dotted ID string (e.g. "editor.save").
send_request
Send a request to the host and return a future that resolves when the host calls back via oo_on_message.
show_notification
Show a user-visible notification. level is "info", "warn", or "error".
update_status_bar
Update the status bar text. slot is "left", "center", or "right".