Status, Logging & Translation
Show messages in the status bar, write to the log, and translate your plugin's text.
Status Bar
setStatus
Display a transient message in the editor's status bar. The message stays until the next status update replaces it. An empty message clears it. Use for feedback on completed operations (e.g. "File saved", "2 matches found").
setStatus(msg: string): void;| Parameter | Description |
|---|---|
msg | Text to display; keep short (status bar has limited width) |
registerStatusBarElement
Register a custom statusbar token. Token will be named "plugin_name:token_name" where plugin_name is the current plugin. Returns true if registration succeeded, false if invalid or already registered.
registerStatusBarElement(tokenName: string, title: string): boolean;setStatusBarValue
Set the value of a status-bar token for a specific buffer. The full token key sent to the editor is "plugin_name:token_name".
setStatusBarValue(bufferId: number, tokenName: string, value: string): boolean;Logging
debug
Log a debug message from a plugin. The message goes to the editor's log file at debug level, prefixed with "Plugin:". It is written only when the log filter (RUST_LOG) allows that level. Useful for plugin development and troubleshooting.
debug(msg: string): void;| Parameter | Description |
|---|---|
msg | Debug message; include context like function name and relevant values |
info
Log an info message from a plugin. The message goes to the editor's log file at info level, prefixed with "Plugin:". It is written only when the log filter (RUST_LOG) allows that level. Use for important operational messages.
info(msg: string): void;warn
Log a warning message from a plugin. The message goes to the editor's log file at warn level, prefixed with "Plugin:". It is written only when the log filter (RUST_LOG) allows that level. Use for warnings that don't prevent operation but indicate issues.
warn(msg: string): void;error
Log an error message from a plugin. The message goes to the editor's log file at error level, prefixed with "Plugin:". It is written only when the log filter (RUST_LOG) allows that level. Use for critical errors that need attention.
error(msg: string): void;Translation
t
Translate a string - reads plugin name from pluginName global Args is optional - can be omitted, undefined, null, or an object
t(key: string, ...args: unknown[]): string;pluginTranslate
Translate a key for a specific plugin
pluginTranslate(pluginName: string, key: string, args?: Record<string, unknown>): string;getCurrentLocale
Get the current locale
getCurrentLocale(): string;