Skip to main content

JsEditorApi

Struct JsEditorApi 

Source
pub struct JsEditorApi {
    pub plugin_name: String,
    /* private fields */
}
Expand description

JavaScript-exposed Editor API using rquickjs class system This allows proper lifetime handling for methods returning JS values

Fields§

§plugin_name: String

Implementations§

Source§

impl JsEditorApi

Source

pub const js_get_active_buffer_id: __impl_get_active_buffer_id = __impl_get_active_buffer_id

Source

pub const js_get_active_split_id: __impl_get_active_split_id = __impl_get_active_split_id

Source

pub const js_list_buffers: __impl_list_buffers = __impl_list_buffers

Source

pub const js_debug: __impl_debug = __impl_debug

Source

pub const js_info: __impl_info = __impl_info

Source

pub const js_warn: __impl_warn = __impl_warn

Source

pub const js_error: __impl_error = __impl_error

Source

pub const js_set_status: __impl_set_status = __impl_set_status

Source

pub const js_copy_to_clipboard: __impl_copy_to_clipboard = __impl_copy_to_clipboard

Source

pub const js_set_clipboard: __impl_set_clipboard = __impl_set_clipboard

Source

pub const js_register_command: __impl_register_command = __impl_register_command

Source

pub const js_unregister_command: __impl_unregister_command = __impl_unregister_command

Source

pub const js_set_context: __impl_set_context = __impl_set_context

Source

pub const js_execute_action: __impl_execute_action = __impl_execute_action

Source

pub const js_t: __impl_t = __impl_t

Source

pub const js_get_cursor_position: __impl_get_cursor_position = __impl_get_cursor_position

Source

pub const js_get_buffer_path: __impl_get_buffer_path = __impl_get_buffer_path

Source

pub const js_get_buffer_length: __impl_get_buffer_length = __impl_get_buffer_length

Source

pub const js_is_buffer_modified: __impl_is_buffer_modified = __impl_is_buffer_modified

Source

pub const js_save_buffer_to_path: __impl_save_buffer_to_path = __impl_save_buffer_to_path

Source

pub const js_get_buffer_info: __impl_get_buffer_info = __impl_get_buffer_info

Source

pub const js_get_primary_cursor: __impl_get_primary_cursor = __impl_get_primary_cursor

Source

pub const js_get_all_cursors: __impl_get_all_cursors = __impl_get_all_cursors

Source

pub const js_get_all_cursor_positions: __impl_get_all_cursor_positions = __impl_get_all_cursor_positions

Source

pub const js_get_viewport: __impl_get_viewport = __impl_get_viewport

Source

pub const js_get_cursor_line: __impl_get_cursor_line = __impl_get_cursor_line

Source

pub const js_get_line_start_position_start: __impl_get_line_start_position_start = __impl_get_line_start_position_start

Source

pub const js_get_line_end_position_start: __impl_get_line_end_position_start = __impl_get_line_end_position_start

Source

pub const js_get_buffer_line_count_start: __impl_get_buffer_line_count_start = __impl_get_buffer_line_count_start

Source

pub const js_scroll_to_line_center: __impl_scroll_to_line_center = __impl_scroll_to_line_center

Source

pub const js_find_buffer_by_path: __impl_find_buffer_by_path = __impl_find_buffer_by_path

Source

pub const js_get_buffer_saved_diff: __impl_get_buffer_saved_diff = __impl_get_buffer_saved_diff

Source

pub const js_insert_text: __impl_insert_text = __impl_insert_text

Source

pub const js_delete_range: __impl_delete_range = __impl_delete_range

Source

pub const js_insert_at_cursor: __impl_insert_at_cursor = __impl_insert_at_cursor

Source

pub const js_open_file: __impl_open_file = __impl_open_file

Source

pub const js_open_file_in_split: __impl_open_file_in_split = __impl_open_file_in_split

Source

pub const js_show_buffer: __impl_show_buffer = __impl_show_buffer

Source

pub const js_close_buffer: __impl_close_buffer = __impl_close_buffer

Source

pub const js_on: __impl_on = __impl_on

Source

pub const js_off: __impl_off = __impl_off

Source

pub const js_get_env: __impl_get_env = __impl_get_env

Source

pub const js_get_cwd: __impl_get_cwd = __impl_get_cwd

Source

pub const js_path_join: __impl_path_join = __impl_path_join

Source

pub const js_path_dirname: __impl_path_dirname = __impl_path_dirname

Source

pub const js_path_basename: __impl_path_basename = __impl_path_basename

Source

pub const js_path_extname: __impl_path_extname = __impl_path_extname

Source

pub const js_path_is_absolute: __impl_path_is_absolute = __impl_path_is_absolute

Source

pub const js_file_exists: __impl_file_exists = __impl_file_exists

Source

pub const js_read_file: __impl_read_file = __impl_read_file

Source

pub const js_write_file: __impl_write_file = __impl_write_file

Source

pub const js_read_dir: __impl_read_dir = __impl_read_dir

Source

pub const js_get_config: __impl_get_config = __impl_get_config

Source

pub const js_get_user_config: __impl_get_user_config = __impl_get_user_config

Source

pub const js_reload_config: __impl_reload_config = __impl_reload_config

Source

pub const js_reload_themes: __impl_reload_themes = __impl_reload_themes

Source

pub const js_register_grammar: __impl_register_grammar = __impl_register_grammar

Source

pub const js_register_language_config: __impl_register_language_config = __impl_register_language_config

Source

pub const js_register_lsp_server: __impl_register_lsp_server = __impl_register_lsp_server

Source

pub const js_reload_grammars: __impl_reload_grammars = __impl_reload_grammars

Source

pub const js_get_config_dir: __impl_get_config_dir = __impl_get_config_dir

Source

pub const js_get_themes_dir: __impl_get_themes_dir = __impl_get_themes_dir

Source

pub const js_apply_theme: __impl_apply_theme = __impl_apply_theme

Source

pub const js_get_theme_schema: __impl_get_theme_schema = __impl_get_theme_schema

Source

pub const js_get_builtin_themes: __impl_get_builtin_themes = __impl_get_builtin_themes

Source

pub const js_delete_theme_sync: __impl_delete_theme_sync = __impl_delete_theme_sync

Source

pub const js_delete_theme: __impl_delete_theme = __impl_delete_theme

Source

pub const js_file_stat: __impl_file_stat = __impl_file_stat

Source

pub const js_is_process_running: __impl_is_process_running = __impl_is_process_running

Source

pub const js_kill_process: __impl_kill_process = __impl_kill_process

Source

pub const js_plugin_translate: __impl_plugin_translate = __impl_plugin_translate

Source

pub const js_create_composite_buffer_start: __impl_create_composite_buffer_start = __impl_create_composite_buffer_start

Source

pub const js_update_composite_alignment: __impl_update_composite_alignment = __impl_update_composite_alignment

Source

pub const js_close_composite_buffer: __impl_close_composite_buffer = __impl_close_composite_buffer

Source

pub const js_get_highlights_start: __impl_get_highlights_start = __impl_get_highlights_start

Source

pub const js_add_overlay: __impl_add_overlay = __impl_add_overlay

Source

pub const js_clear_namespace: __impl_clear_namespace = __impl_clear_namespace

Source

pub const js_clear_all_overlays: __impl_clear_all_overlays = __impl_clear_all_overlays

Source

pub const js_clear_overlays_in_range: __impl_clear_overlays_in_range = __impl_clear_overlays_in_range

Source

pub const js_remove_overlay: __impl_remove_overlay = __impl_remove_overlay

Source

pub const js_submit_view_transform: __impl_submit_view_transform = __impl_submit_view_transform

Source

pub const js_clear_view_transform: __impl_clear_view_transform = __impl_clear_view_transform

Source

pub const js_set_file_explorer_decorations: __impl_set_file_explorer_decorations = __impl_set_file_explorer_decorations

Source

pub const js_clear_file_explorer_decorations: __impl_clear_file_explorer_decorations = __impl_clear_file_explorer_decorations

Source

pub const js_add_virtual_text: __impl_add_virtual_text = __impl_add_virtual_text

Source

pub const js_remove_virtual_text: __impl_remove_virtual_text = __impl_remove_virtual_text

Source

pub const js_remove_virtual_texts_by_prefix: __impl_remove_virtual_texts_by_prefix = __impl_remove_virtual_texts_by_prefix

Source

pub const js_clear_virtual_texts: __impl_clear_virtual_texts = __impl_clear_virtual_texts

Source

pub const js_clear_virtual_text_namespace: __impl_clear_virtual_text_namespace = __impl_clear_virtual_text_namespace

Source

pub const js_add_virtual_line: __impl_add_virtual_line = __impl_add_virtual_line

Source

pub const js_prompt_start: __impl_prompt_start = __impl_prompt_start

Source

pub const js_start_prompt: __impl_start_prompt = __impl_start_prompt

Source

pub const js_start_prompt_with_initial: __impl_start_prompt_with_initial = __impl_start_prompt_with_initial

Source

pub const js_set_prompt_suggestions: __impl_set_prompt_suggestions = __impl_set_prompt_suggestions

Source

pub const js_define_mode: __impl_define_mode = __impl_define_mode

Source

pub const js_set_editor_mode: __impl_set_editor_mode = __impl_set_editor_mode

Source

pub const js_get_editor_mode: __impl_get_editor_mode = __impl_get_editor_mode

Source

pub const js_close_split: __impl_close_split = __impl_close_split

Source

pub const js_set_split_buffer: __impl_set_split_buffer = __impl_set_split_buffer

Source

pub const js_focus_split: __impl_focus_split = __impl_focus_split

Source

pub const js_set_split_scroll: __impl_set_split_scroll = __impl_set_split_scroll

Source

pub const js_set_split_ratio: __impl_set_split_ratio = __impl_set_split_ratio

Source

pub const js_distribute_splits_evenly: __impl_distribute_splits_evenly = __impl_distribute_splits_evenly

Source

pub const js_set_buffer_cursor: __impl_set_buffer_cursor = __impl_set_buffer_cursor

Source

pub const js_set_line_indicator: __impl_set_line_indicator = __impl_set_line_indicator

Source

pub const js_clear_line_indicators: __impl_clear_line_indicators = __impl_clear_line_indicators

Source

pub const js_set_line_numbers: __impl_set_line_numbers = __impl_set_line_numbers

Source

pub const js_set_line_wrap: __impl_set_line_wrap = __impl_set_line_wrap

Source

pub const js_create_scroll_sync_group: __impl_create_scroll_sync_group = __impl_create_scroll_sync_group

Source

pub const js_set_scroll_sync_anchors: __impl_set_scroll_sync_anchors = __impl_set_scroll_sync_anchors

Source

pub const js_remove_scroll_sync_group: __impl_remove_scroll_sync_group = __impl_remove_scroll_sync_group

Source

pub const js_execute_actions: __impl_execute_actions = __impl_execute_actions

Source

pub const js_show_action_popup: __impl_show_action_popup = __impl_show_action_popup

Source

pub const js_disable_lsp_for_language: __impl_disable_lsp_for_language = __impl_disable_lsp_for_language

Source

pub const js_set_lsp_root_uri: __impl_set_lsp_root_uri = __impl_set_lsp_root_uri

Source

pub const js_get_all_diagnostics: __impl_get_all_diagnostics = __impl_get_all_diagnostics

Source

pub const js_get_handlers: __impl_get_handlers = __impl_get_handlers

Source

pub const js_create_virtual_buffer_start: __impl_create_virtual_buffer_start = __impl_create_virtual_buffer_start

Source

pub const js_create_virtual_buffer_in_split_start: __impl_create_virtual_buffer_in_split_start = __impl_create_virtual_buffer_in_split_start

Source

pub const js_create_virtual_buffer_in_existing_split_start: __impl_create_virtual_buffer_in_existing_split_start = __impl_create_virtual_buffer_in_existing_split_start

Source

pub const js_set_virtual_buffer_content: __impl_set_virtual_buffer_content = __impl_set_virtual_buffer_content

Source

pub const js_get_text_properties_at_cursor: __impl_get_text_properties_at_cursor = __impl_get_text_properties_at_cursor

Source

pub const js_spawn_process_start: __impl_spawn_process_start = __impl_spawn_process_start

Source

pub const js_spawn_process_wait_start: __impl_spawn_process_wait_start = __impl_spawn_process_wait_start

Source

pub const js_get_buffer_text_start: __impl_get_buffer_text_start = __impl_get_buffer_text_start

Source

pub const js_delay_start: __impl_delay_start = __impl_delay_start

Source

pub const js_send_lsp_request_start: __impl_send_lsp_request_start = __impl_send_lsp_request_start

Source

pub const js_spawn_background_process_start: __impl_spawn_background_process_start = __impl_spawn_background_process_start

Source

pub const js_kill_background_process: __impl_kill_background_process = __impl_kill_background_process

Source

pub const js_refresh_lines: __impl_refresh_lines = __impl_refresh_lines

Source

pub const js_get_current_locale: __impl_get_current_locale = __impl_get_current_locale

Source

pub const js_load_plugin_start: __impl_load_plugin_start = __impl_load_plugin_start

Source

pub const js_unload_plugin_start: __impl_unload_plugin_start = __impl_unload_plugin_start

Source

pub const js_reload_plugin_start: __impl_reload_plugin_start = __impl_reload_plugin_start

Source

pub const js_list_plugins_start: __impl_list_plugins_start = __impl_list_plugins_start

Source§

impl JsEditorApi

Source

pub fn get_active_buffer_id(&self) -> u32

Get the active buffer ID (0 if none)

Source

pub fn get_active_split_id(&self) -> u32

Get the active split ID

Source

pub fn list_buffers<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

List all open buffers - returns array of BufferInfo objects

Source

pub fn debug(&self, msg: String)

Source

pub fn info(&self, msg: String)

Source

pub fn warn(&self, msg: String)

Source

pub fn error(&self, msg: String)

Source

pub fn set_status(&self, msg: String)

Source

pub fn copy_to_clipboard(&self, text: String)

Source

pub fn set_clipboard(&self, text: String)

Source

pub fn register_command<'js>( &self, _ctx: Ctx<'js>, name: String, description: String, handler_name: String, context: Opt<Value<'js>>, ) -> Result<bool>

Register a command - reads plugin name from pluginName global context is optional - can be omitted, null, undefined, or a string

Source

pub fn unregister_command(&self, name: String) -> bool

Unregister a command by name

Source

pub fn set_context(&self, name: String, active: bool) -> bool

Set a context (for keybinding conditions)

Source

pub fn execute_action(&self, action_name: String) -> bool

Execute a built-in action

Source

pub fn t<'js>( &self, _ctx: Ctx<'js>, key: String, args: Rest<Value<'js>>, ) -> String

Translate a string - reads plugin name from pluginName global Args is optional - can be omitted, undefined, null, or an object

Source

pub fn get_cursor_position(&self) -> u32

Get cursor position in active buffer

Source

pub fn get_buffer_path(&self, buffer_id: u32) -> String

Get file path for a buffer

Source

pub fn get_buffer_length(&self, buffer_id: u32) -> u32

Get buffer length in bytes

Source

pub fn is_buffer_modified(&self, buffer_id: u32) -> bool

Check if buffer has unsaved changes

Source

pub fn save_buffer_to_path(&self, buffer_id: u32, path: String) -> bool

Save a buffer to a specific file path Used by :w filename to save unnamed buffers or save-as

Source

pub fn get_buffer_info<'js>( &self, ctx: Ctx<'js>, buffer_id: u32, ) -> Result<Value<'js>>

Get buffer info by ID

Source

pub fn get_primary_cursor<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get primary cursor info for active buffer

Source

pub fn get_all_cursors<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get all cursors for active buffer

Source

pub fn get_all_cursor_positions<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get all cursor positions as byte offsets

Source

pub fn get_viewport<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get viewport info for active buffer

Source

pub fn get_cursor_line(&self) -> u32

Get the line number (0-indexed) of the primary cursor

Source

pub fn get_line_start_position_start(&self, _ctx: Ctx<'_>, line: u32) -> u64

Get the byte offset of the start of a line (0-indexed line number) Returns null if the line number is out of range

Source

pub fn get_line_end_position_start(&self, _ctx: Ctx<'_>, line: u32) -> u64

Get the byte offset of the end of a line (0-indexed line number) Returns the position after the last character of the line (before newline) Returns null if the line number is out of range

Source

pub fn get_buffer_line_count_start(&self, _ctx: Ctx<'_>) -> u64

Get the total number of lines in the active buffer Returns null if buffer not found

Source

pub fn scroll_to_line_center( &self, split_id: u32, buffer_id: u32, line: u32, ) -> bool

Scroll a split to center a specific line in the viewport Line is 0-indexed (0 = first line)

Source

pub fn find_buffer_by_path(&self, path: String) -> u32

Find buffer by file path, returns buffer ID or 0 if not found

Source

pub fn get_buffer_saved_diff<'js>( &self, ctx: Ctx<'js>, buffer_id: u32, ) -> Result<Value<'js>>

Get diff between buffer content and last saved version

Source

pub fn insert_text(&self, buffer_id: u32, position: u32, text: String) -> bool

Insert text at a position in a buffer

Source

pub fn delete_range(&self, buffer_id: u32, start: u32, end: u32) -> bool

Delete a range from a buffer

Source

pub fn insert_at_cursor(&self, text: String) -> bool

Insert text at cursor position in active buffer

Source

pub fn open_file( &self, path: String, line: Option<u32>, column: Option<u32>, ) -> bool

Open a file, optionally at a specific line/column

Source

pub fn open_file_in_split( &self, split_id: u32, path: String, line: u32, column: u32, ) -> bool

Open a file in a specific split

Source

pub fn show_buffer(&self, buffer_id: u32) -> bool

Show a buffer in the current split

Source

pub fn close_buffer(&self, buffer_id: u32) -> bool

Close a buffer

Source

pub fn on<'js>(&self, _ctx: Ctx<'js>, event_name: String, handler_name: String)

Subscribe to an editor event

Source

pub fn off(&self, event_name: String, handler_name: String)

Unsubscribe from an event

Source

pub fn get_env(&self, name: String) -> Option<String>

Get an environment variable

Source

pub fn get_cwd(&self) -> String

Get current working directory

Source

pub fn path_join(&self, parts: Rest<String>) -> String

Join path components (variadic - accepts multiple string arguments) Always uses forward slashes for cross-platform consistency (like Node.js path.posix.join)

Source

pub fn path_dirname(&self, path: String) -> String

Get directory name from path

Source

pub fn path_basename(&self, path: String) -> String

Get file name from path

Source

pub fn path_extname(&self, path: String) -> String

Get file extension

Source

pub fn path_is_absolute(&self, path: String) -> bool

Check if path is absolute

Source

pub fn file_exists(&self, path: String) -> bool

Check if file exists

Source

pub fn read_file(&self, path: String) -> Option<String>

Read file contents

Source

pub fn write_file(&self, path: String, content: String) -> bool

Write file contents

Source

pub fn read_dir<'js>(&self, ctx: Ctx<'js>, path: String) -> Result<Value<'js>>

Read directory contents (returns array of {name, is_file, is_dir})

Source

pub fn get_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get current config as JS object

Source

pub fn get_user_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get user config as JS object

Source

pub fn reload_config(&self)

Reload configuration from file

Source

pub fn reload_themes(&self)

Reload theme registry from disk Call this after installing theme packages or saving new themes

Source

pub fn register_grammar( &self, language: String, grammar_path: String, extensions: Vec<String>, ) -> bool

Register a TextMate grammar file for a language The grammar will be pending until reload_grammars() is called

Source

pub fn register_language_config( &self, language: String, config: LanguagePackConfig, ) -> bool

Register language configuration (comment prefix, indentation, formatter)

Source

pub fn register_lsp_server( &self, language: String, config: LspServerPackConfig, ) -> bool

Register an LSP server for a language

Source

pub fn reload_grammars(&self)

Reload the grammar registry to apply registered grammars Call this after registering one or more grammars

Source

pub fn get_config_dir(&self) -> String

Get config directory path

Source

pub fn get_themes_dir(&self) -> String

Get themes directory path

Source

pub fn apply_theme(&self, theme_name: String) -> bool

Apply a theme by name

Source

pub fn get_theme_schema<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get theme schema as JS object

Source

pub fn get_builtin_themes<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get list of builtin themes as JS object

Source

pub fn delete_theme_sync(&self, name: String) -> bool

Delete a custom theme file (sync)

Source

pub fn delete_theme(&self, name: String) -> bool

Delete a custom theme (alias for deleteThemeSync)

Source

pub fn file_stat<'js>(&self, ctx: Ctx<'js>, path: String) -> Result<Value<'js>>

Get file stat information

Source

pub fn is_process_running(&self, _process_id: u64) -> bool

Check if a background process is still running

Source

pub fn kill_process(&self, process_id: u64) -> bool

Kill a process by ID (alias for killBackgroundProcess)

Source

pub fn plugin_translate<'js>( &self, _ctx: Ctx<'js>, plugin_name: String, key: String, args: Opt<Object<'js>>, ) -> String

Translate a key for a specific plugin

Source

pub fn create_composite_buffer_start( &self, opts: CreateCompositeBufferOptions, ) -> u64

Create a composite buffer (async)

Uses typed CreateCompositeBufferOptions - serde validates field names at runtime via deny_unknown_fields attribute

Source

pub fn update_composite_alignment( &self, buffer_id: u32, hunks: Vec<CompositeHunk>, ) -> bool

Update alignment hunks for a composite buffer

Uses typed Vec - serde validates field names at runtime

Source

pub fn close_composite_buffer(&self, buffer_id: u32) -> bool

Close a composite buffer

Source

pub fn get_highlights_start<'js>( &self, _ctx: Ctx<'js>, buffer_id: u32, start: u32, end: u32, ) -> Result<u64>

Request syntax highlights for a buffer range (async)

Source

pub fn add_overlay<'js>( &self, _ctx: Ctx<'js>, buffer_id: u32, namespace: String, start: u32, end: u32, options: Object<'js>, ) -> Result<bool>

Add an overlay with styling options

Colors can be specified as RGB arrays [r, g, b] or theme key strings. Theme keys are resolved at render time, so overlays update with theme changes.

Theme key examples: “ui.status_bar_fg”, “editor.selection_bg”, “syntax.keyword”

Example usage in TypeScript:

editor.addOverlay(bufferId, "my-namespace", 0, 10, {
  fg: "syntax.keyword",           // theme key
  bg: [40, 40, 50],               // RGB array
  bold: true,
});
Source

pub fn clear_namespace(&self, buffer_id: u32, namespace: String) -> bool

Clear all overlays in a namespace

Source

pub fn clear_all_overlays(&self, buffer_id: u32) -> bool

Clear all overlays from a buffer

Source

pub fn clear_overlays_in_range( &self, buffer_id: u32, start: u32, end: u32, ) -> bool

Clear all overlays that overlap with a byte range

Source

pub fn remove_overlay(&self, buffer_id: u32, handle: String) -> bool

Remove an overlay by its handle

Source

pub fn submit_view_transform<'js>( &self, _ctx: Ctx<'js>, buffer_id: u32, split_id: Option<u32>, start: u32, end: u32, tokens: Vec<Object<'js>>, layout_hints: Opt<Object<'js>>, ) -> Result<bool>

Submit a view transform for a buffer/split

Accepts tokens in the simple format: {kind: “text”|“newline”|“space”|“break”, text: “…”, sourceOffset: N, style?: {…}}

Also accepts the TypeScript-defined format for backwards compatibility: {kind: {Text: “…”} | “Newline” | “Space” | “Break”, source_offset: N, style?: {…}}

Source

pub fn clear_view_transform( &self, buffer_id: u32, split_id: Option<u32>, ) -> bool

Clear view transform for a buffer/split

Source

pub fn set_file_explorer_decorations<'js>( &self, _ctx: Ctx<'js>, namespace: String, decorations: Vec<Object<'js>>, ) -> Result<bool>

Set file explorer decorations for a namespace

Source

pub fn clear_file_explorer_decorations(&self, namespace: String) -> bool

Clear file explorer decorations for a namespace

Source

pub fn add_virtual_text( &self, buffer_id: u32, virtual_text_id: String, position: u32, text: String, r: u8, g: u8, b: u8, before: bool, use_bg: bool, ) -> bool

Add virtual text (inline text that doesn’t exist in the buffer)

Source

pub fn remove_virtual_text( &self, buffer_id: u32, virtual_text_id: String, ) -> bool

Remove a virtual text by ID

Source

pub fn remove_virtual_texts_by_prefix( &self, buffer_id: u32, prefix: String, ) -> bool

Remove virtual texts whose ID starts with the given prefix

Source

pub fn clear_virtual_texts(&self, buffer_id: u32) -> bool

Clear all virtual texts from a buffer

Source

pub fn clear_virtual_text_namespace( &self, buffer_id: u32, namespace: String, ) -> bool

Clear all virtual texts in a namespace

Source

pub fn add_virtual_line( &self, buffer_id: u32, position: u32, text: String, fg_r: u8, fg_g: u8, fg_b: u8, bg_r: u8, bg_g: u8, bg_b: u8, above: bool, namespace: String, priority: i32, ) -> bool

Add a virtual line (full line above/below a position)

Source

pub fn prompt_start( &self, _ctx: Ctx<'_>, label: String, initial_value: String, ) -> u64

Show a prompt and wait for user input (async) Returns the user input or null if cancelled

Source

pub fn start_prompt(&self, label: String, prompt_type: String) -> bool

Start an interactive prompt

Source

pub fn start_prompt_with_initial( &self, label: String, prompt_type: String, initial_value: String, ) -> bool

Start a prompt with initial value

Source

pub fn set_prompt_suggestions(&self, suggestions: Vec<Suggestion>) -> bool

Set suggestions for the current prompt

Uses typed Vec - serde validates field names at runtime

Source

pub fn define_mode( &self, name: String, parent: Option<String>, bindings_arr: Vec<Vec<String>>, read_only: Opt<bool>, ) -> bool

Define a buffer mode (takes bindings as array of [key, command] pairs)

Source

pub fn set_editor_mode(&self, mode: Option<String>) -> bool

Set the global editor mode

Source

pub fn get_editor_mode(&self) -> Option<String>

Get the current editor mode

Source

pub fn close_split(&self, split_id: u32) -> bool

Close a split

Source

pub fn set_split_buffer(&self, split_id: u32, buffer_id: u32) -> bool

Set the buffer displayed in a split

Source

pub fn focus_split(&self, split_id: u32) -> bool

Focus a specific split

Source

pub fn set_split_scroll(&self, split_id: u32, top_byte: u32) -> bool

Set scroll position of a split

Source

pub fn set_split_ratio(&self, split_id: u32, ratio: f32) -> bool

Set the ratio of a split (0.0 to 1.0, 0.5 = equal)

Source

pub fn distribute_splits_evenly(&self) -> bool

Distribute all splits evenly

Source

pub fn set_buffer_cursor(&self, buffer_id: u32, position: u32) -> bool

Set cursor position in a buffer

Source

pub fn set_line_indicator( &self, buffer_id: u32, line: u32, namespace: String, symbol: String, r: u8, g: u8, b: u8, priority: i32, ) -> bool

Set a line indicator in the gutter

Source

pub fn clear_line_indicators(&self, buffer_id: u32, namespace: String) -> bool

Clear line indicators in a namespace

Source

pub fn set_line_numbers(&self, buffer_id: u32, enabled: bool) -> bool

Enable or disable line numbers for a buffer

Source

pub fn set_line_wrap( &self, buffer_id: u32, split_id: Option<u32>, enabled: bool, ) -> bool

Enable or disable line wrapping for a buffer/split

Source

pub fn create_scroll_sync_group( &self, group_id: u32, left_split: u32, right_split: u32, ) -> bool

Create a scroll sync group for anchor-based synchronized scrolling

Source

pub fn set_scroll_sync_anchors<'js>( &self, _ctx: Ctx<'js>, group_id: u32, anchors: Vec<Vec<u32>>, ) -> bool

Set sync anchors for a scroll sync group

Source

pub fn remove_scroll_sync_group(&self, group_id: u32) -> bool

Remove a scroll sync group

Source

pub fn execute_actions(&self, actions: Vec<ActionSpec>) -> bool

Execute multiple actions in sequence

Takes typed ActionSpec array - serde validates field names at runtime

Source

pub fn show_action_popup(&self, opts: ActionPopupOptions) -> bool

Show an action popup

Takes a typed ActionPopupOptions struct - serde validates field names at runtime

Source

pub fn disable_lsp_for_language(&self, language: String) -> bool

Disable LSP for a specific language

Source

pub fn set_lsp_root_uri(&self, language: String, uri: String) -> bool

Set the workspace root URI for a specific language’s LSP server This allows plugins to specify project roots (e.g., directory containing .csproj)

Source

pub fn get_all_diagnostics<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>

Get all diagnostics from LSP

Source

pub fn get_handlers(&self, event_name: String) -> Vec<String>

Get registered event handlers for an event

Source

pub fn create_virtual_buffer_start( &self, _ctx: Ctx<'_>, opts: CreateVirtualBufferOptions, ) -> Result<u64>

Create a virtual buffer in current split (async, returns buffer and split IDs)

Source

pub fn create_virtual_buffer_in_split_start( &self, _ctx: Ctx<'_>, opts: CreateVirtualBufferInSplitOptions, ) -> Result<u64>

Create a virtual buffer in a new split (async, returns buffer and split IDs)

Source

pub fn create_virtual_buffer_in_existing_split_start( &self, _ctx: Ctx<'_>, opts: CreateVirtualBufferInExistingSplitOptions, ) -> Result<u64>

Create a virtual buffer in an existing split (async, returns buffer and split IDs)

Source

pub fn set_virtual_buffer_content<'js>( &self, ctx: Ctx<'js>, buffer_id: u32, entries_arr: Vec<Object<'js>>, ) -> Result<bool>

Set virtual buffer content (takes array of entry objects)

Note: entries should be TextPropertyEntry[] - uses manual parsing for HashMap support

Source

pub fn get_text_properties_at_cursor( &self, buffer_id: u32, ) -> TextPropertiesAtCursor

Get text properties at cursor position (returns JS array)

Source

pub fn spawn_process_start( &self, _ctx: Ctx<'_>, command: String, args: Vec<String>, cwd: Opt<String>, ) -> u64

Spawn a process (async, returns request_id)

Source

pub fn spawn_process_wait_start(&self, _ctx: Ctx<'_>, process_id: u64) -> u64

Wait for a process to complete and get its result (async)

Source

pub fn get_buffer_text_start( &self, _ctx: Ctx<'_>, buffer_id: u32, start: u32, end: u32, ) -> u64

Get buffer text range (async, returns request_id)

Source

pub fn delay_start(&self, _ctx: Ctx<'_>, duration_ms: u64) -> u64

Delay/sleep (async, returns request_id)

Source

pub fn send_lsp_request_start<'js>( &self, ctx: Ctx<'js>, language: String, method: String, params: Option<Object<'js>>, ) -> Result<u64>

Send LSP request (async, returns request_id)

Source

pub fn spawn_background_process_start( &self, _ctx: Ctx<'_>, command: String, args: Vec<String>, cwd: Opt<String>, ) -> u64

Spawn a background process (async, returns request_id which is also process_id)

Source

pub fn kill_background_process(&self, process_id: u64) -> bool

Kill a background process

Source

pub fn refresh_lines(&self, buffer_id: u32) -> bool

Force refresh of line display

Source

pub fn get_current_locale(&self) -> String

Get the current locale

Source

pub fn load_plugin_start(&self, _ctx: Ctx<'_>, path: String) -> u64

Load a plugin from a file path (async)

Source

pub fn unload_plugin_start(&self, _ctx: Ctx<'_>, name: String) -> u64

Unload a plugin by name (async)

Source

pub fn reload_plugin_start(&self, _ctx: Ctx<'_>, name: String) -> u64

Reload a plugin by name (async)

Source

pub fn list_plugins_start(&self, _ctx: Ctx<'_>) -> u64

List all loaded plugins (async) Returns array of { name: string, path: string, enabled: boolean }

Trait Implementations§

Source§

impl<'js> FromJs<'js> for JsEditorApi
where for<'a> CloneWrapper<'a, Self>: CloneTrait<Self>,

Source§

fn from_js(ctx: &Ctx<'js>, value: Value<'js>) -> Result<Self>

Source§

impl<'js> IntoJs<'js> for JsEditorApi

Source§

fn into_js(self, ctx: &Ctx<'js>) -> Result<Value<'js>>

Source§

impl<'js> JsClass<'js> for JsEditorApi

Source§

const NAME: &'static str = "JsEditorApi"

The name the constructor has in JavaScript
Source§

type Mutable = Writable

Can the type be mutated while a JavaScript value. Read more
Source§

fn prototype(ctx: &Ctx<'js>) -> Result<Option<Object<'js>>>

Returns the class prototype,
Source§

fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>

Returns a predefined constructor for this specific class type if there is one.
Source§

const CALLABLE: bool = false

Is this class a function.
Source§

fn call<'a>( this: &JsCell<'js, Self>, params: Params<'a, 'js>, ) -> Result<Value<'js>, Error>

The function which will be called if Self::CALLABLE is true and an an object with this class is called as if it is a function.
Source§

impl<'js> JsLifetime<'js> for JsEditorApi

Source§

type Changed<'to> = JsEditorApi

The target which has the same type as a Self but with another lifetime 't
Source§

impl MethodImplementor<JsEditorApi> for MethodImpl<JsEditorApi>

Source§

fn implement(&self, _proto: &Object<'_>) -> Result<()>

Source§

impl<'js> Trace<'js> for JsEditorApi

Source§

fn trace<'a>(&self, _tracer: Tracer<'a, 'js>)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'js, T> AsProperty<'js, T> for T
where T: IntoJs<'js>,

Source§

fn config( self, ctx: &Ctx<'js>, ) -> Result<(i32, Value<'js>, Value<'js>, Value<'js>), Error>

Property configuration Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'js, T> IntoArg<'js> for T
where T: IntoJs<'js>,

Source§

fn num_args(&self) -> usize

The number of arguments this value produces.
Source§

fn into_arg(self, args: &mut Args<'js>) -> Result<(), Error>

Convert the value into an argument.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ParallelSend for T