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: StringImplementations§
Source§impl JsEditorApi
impl JsEditorApi
pub const js_api_version: __impl_api_version = __impl_api_version
pub const js_get_active_buffer_id: __impl_get_active_buffer_id = __impl_get_active_buffer_id
pub const js_get_active_split_id: __impl_get_active_split_id = __impl_get_active_split_id
pub const js_list_buffers: __impl_list_buffers = __impl_list_buffers
pub const js_debug: __impl_debug = __impl_debug
pub const js_info: __impl_info = __impl_info
pub const js_warn: __impl_warn = __impl_warn
pub const js_error: __impl_error = __impl_error
pub const js_set_status: __impl_set_status = __impl_set_status
pub const js_copy_to_clipboard: __impl_copy_to_clipboard = __impl_copy_to_clipboard
pub const js_set_clipboard: __impl_set_clipboard = __impl_set_clipboard
pub const js_get_keybinding_label: __impl_get_keybinding_label = __impl_get_keybinding_label
pub const js_register_command: __impl_register_command = __impl_register_command
pub const js_unregister_command: __impl_unregister_command = __impl_unregister_command
pub const js_set_context: __impl_set_context = __impl_set_context
pub const js_execute_action: __impl_execute_action = __impl_execute_action
pub const js_t: __impl_t = __impl_t
pub const js_get_cursor_position: __impl_get_cursor_position = __impl_get_cursor_position
pub const js_get_buffer_path: __impl_get_buffer_path = __impl_get_buffer_path
pub const js_get_buffer_length: __impl_get_buffer_length = __impl_get_buffer_length
pub const js_is_buffer_modified: __impl_is_buffer_modified = __impl_is_buffer_modified
pub const js_save_buffer_to_path: __impl_save_buffer_to_path = __impl_save_buffer_to_path
pub const js_get_buffer_info: __impl_get_buffer_info = __impl_get_buffer_info
pub const js_get_primary_cursor: __impl_get_primary_cursor = __impl_get_primary_cursor
pub const js_get_all_cursors: __impl_get_all_cursors = __impl_get_all_cursors
pub const js_get_all_cursor_positions: __impl_get_all_cursor_positions = __impl_get_all_cursor_positions
pub const js_get_viewport: __impl_get_viewport = __impl_get_viewport
pub const js_get_cursor_line: __impl_get_cursor_line = __impl_get_cursor_line
pub const js_get_line_start_position_start: __impl_get_line_start_position_start = __impl_get_line_start_position_start
pub const js_get_line_end_position_start: __impl_get_line_end_position_start = __impl_get_line_end_position_start
pub const js_get_buffer_line_count_start: __impl_get_buffer_line_count_start = __impl_get_buffer_line_count_start
pub const js_scroll_to_line_center: __impl_scroll_to_line_center = __impl_scroll_to_line_center
pub const js_find_buffer_by_path: __impl_find_buffer_by_path = __impl_find_buffer_by_path
pub const js_get_buffer_saved_diff: __impl_get_buffer_saved_diff = __impl_get_buffer_saved_diff
pub const js_insert_text: __impl_insert_text = __impl_insert_text
pub const js_delete_range: __impl_delete_range = __impl_delete_range
pub const js_insert_at_cursor: __impl_insert_at_cursor = __impl_insert_at_cursor
pub const js_open_file: __impl_open_file = __impl_open_file
pub const js_open_file_in_split: __impl_open_file_in_split = __impl_open_file_in_split
pub const js_show_buffer: __impl_show_buffer = __impl_show_buffer
pub const js_close_buffer: __impl_close_buffer = __impl_close_buffer
pub const js_on: __impl_on = __impl_on
pub const js_off: __impl_off = __impl_off
pub const js_get_env: __impl_get_env = __impl_get_env
pub const js_get_cwd: __impl_get_cwd = __impl_get_cwd
pub const js_path_join: __impl_path_join = __impl_path_join
pub const js_path_dirname: __impl_path_dirname = __impl_path_dirname
pub const js_path_basename: __impl_path_basename = __impl_path_basename
pub const js_path_extname: __impl_path_extname = __impl_path_extname
pub const js_path_is_absolute: __impl_path_is_absolute = __impl_path_is_absolute
pub const js_file_uri_to_path: __impl_file_uri_to_path = __impl_file_uri_to_path
pub const js_path_to_file_uri: __impl_path_to_file_uri = __impl_path_to_file_uri
pub const js_utf8_byte_length: __impl_utf8_byte_length = __impl_utf8_byte_length
pub const js_file_exists: __impl_file_exists = __impl_file_exists
pub const js_read_file: __impl_read_file = __impl_read_file
pub const js_write_file: __impl_write_file = __impl_write_file
pub const js_read_dir: __impl_read_dir = __impl_read_dir
pub const js_get_config: __impl_get_config = __impl_get_config
pub const js_get_user_config: __impl_get_user_config = __impl_get_user_config
pub const js_reload_config: __impl_reload_config = __impl_reload_config
pub const js_reload_themes: __impl_reload_themes = __impl_reload_themes
pub const js_reload_and_apply_theme: __impl_reload_and_apply_theme = __impl_reload_and_apply_theme
pub const js_register_grammar: __impl_register_grammar = __impl_register_grammar
pub const js_register_language_config: __impl_register_language_config = __impl_register_language_config
pub const js_register_lsp_server: __impl_register_lsp_server = __impl_register_lsp_server
pub const js_reload_grammars_start: __impl_reload_grammars_start = __impl_reload_grammars_start
pub const js_get_config_dir: __impl_get_config_dir = __impl_get_config_dir
pub const js_get_themes_dir: __impl_get_themes_dir = __impl_get_themes_dir
pub const js_apply_theme: __impl_apply_theme = __impl_apply_theme
pub const js_get_theme_schema: __impl_get_theme_schema = __impl_get_theme_schema
pub const js_get_builtin_themes: __impl_get_builtin_themes = __impl_get_builtin_themes
pub const js_delete_theme_sync: __impl_delete_theme_sync = __impl_delete_theme_sync
pub const js_delete_theme: __impl_delete_theme = __impl_delete_theme
pub const js_get_theme_data: __impl_get_theme_data = __impl_get_theme_data
pub const js_save_theme_file: __impl_save_theme_file = __impl_save_theme_file
pub const js_theme_file_exists: __impl_theme_file_exists = __impl_theme_file_exists
pub const js_file_stat: __impl_file_stat = __impl_file_stat
pub const js_is_process_running: __impl_is_process_running = __impl_is_process_running
pub const js_kill_process: __impl_kill_process = __impl_kill_process
pub const js_plugin_translate: __impl_plugin_translate = __impl_plugin_translate
pub const js_create_composite_buffer_start: __impl_create_composite_buffer_start = __impl_create_composite_buffer_start
pub const js_update_composite_alignment: __impl_update_composite_alignment = __impl_update_composite_alignment
pub const js_close_composite_buffer: __impl_close_composite_buffer = __impl_close_composite_buffer
pub const js_get_highlights_start: __impl_get_highlights_start = __impl_get_highlights_start
pub const js_add_overlay: __impl_add_overlay = __impl_add_overlay
pub const js_clear_namespace: __impl_clear_namespace = __impl_clear_namespace
pub const js_clear_all_overlays: __impl_clear_all_overlays = __impl_clear_all_overlays
pub const js_clear_overlays_in_range: __impl_clear_overlays_in_range = __impl_clear_overlays_in_range
pub const js_remove_overlay: __impl_remove_overlay = __impl_remove_overlay
pub const js_add_conceal: __impl_add_conceal = __impl_add_conceal
pub const js_clear_conceal_namespace: __impl_clear_conceal_namespace = __impl_clear_conceal_namespace
pub const js_clear_conceals_in_range: __impl_clear_conceals_in_range = __impl_clear_conceals_in_range
pub const js_add_soft_break: __impl_add_soft_break = __impl_add_soft_break
pub const js_clear_soft_break_namespace: __impl_clear_soft_break_namespace = __impl_clear_soft_break_namespace
pub const js_clear_soft_breaks_in_range: __impl_clear_soft_breaks_in_range = __impl_clear_soft_breaks_in_range
pub const js_submit_view_transform: __impl_submit_view_transform = __impl_submit_view_transform
pub const js_clear_view_transform: __impl_clear_view_transform = __impl_clear_view_transform
pub const js_set_layout_hints: __impl_set_layout_hints = __impl_set_layout_hints
pub const js_set_file_explorer_decorations: __impl_set_file_explorer_decorations = __impl_set_file_explorer_decorations
pub const js_clear_file_explorer_decorations: __impl_clear_file_explorer_decorations = __impl_clear_file_explorer_decorations
pub const js_add_virtual_text: __impl_add_virtual_text = __impl_add_virtual_text
pub const js_remove_virtual_text: __impl_remove_virtual_text = __impl_remove_virtual_text
pub const js_remove_virtual_texts_by_prefix: __impl_remove_virtual_texts_by_prefix = __impl_remove_virtual_texts_by_prefix
pub const js_clear_virtual_texts: __impl_clear_virtual_texts = __impl_clear_virtual_texts
pub const js_clear_virtual_text_namespace: __impl_clear_virtual_text_namespace = __impl_clear_virtual_text_namespace
pub const js_add_virtual_line: __impl_add_virtual_line = __impl_add_virtual_line
pub const js_prompt_start: __impl_prompt_start = __impl_prompt_start
pub const js_start_prompt: __impl_start_prompt = __impl_start_prompt
pub const js_start_prompt_with_initial: __impl_start_prompt_with_initial = __impl_start_prompt_with_initial
pub const js_set_prompt_suggestions: __impl_set_prompt_suggestions = __impl_set_prompt_suggestions
pub const js_set_prompt_input_sync: __impl_set_prompt_input_sync = __impl_set_prompt_input_sync
pub const js_define_mode: __impl_define_mode = __impl_define_mode
pub const js_set_editor_mode: __impl_set_editor_mode = __impl_set_editor_mode
pub const js_get_editor_mode: __impl_get_editor_mode = __impl_get_editor_mode
pub const js_close_split: __impl_close_split = __impl_close_split
pub const js_set_split_buffer: __impl_set_split_buffer = __impl_set_split_buffer
pub const js_focus_split: __impl_focus_split = __impl_focus_split
pub const js_set_split_scroll: __impl_set_split_scroll = __impl_set_split_scroll
pub const js_set_split_ratio: __impl_set_split_ratio = __impl_set_split_ratio
pub const js_set_split_label: __impl_set_split_label = __impl_set_split_label
pub const js_clear_split_label: __impl_clear_split_label = __impl_clear_split_label
pub const js_get_split_by_label_start: __impl_get_split_by_label_start = __impl_get_split_by_label_start
pub const js_distribute_splits_evenly: __impl_distribute_splits_evenly = __impl_distribute_splits_evenly
pub const js_set_buffer_cursor: __impl_set_buffer_cursor = __impl_set_buffer_cursor
pub const js_set_line_indicator: __impl_set_line_indicator = __impl_set_line_indicator
pub const js_set_line_indicators: __impl_set_line_indicators = __impl_set_line_indicators
pub const js_clear_line_indicators: __impl_clear_line_indicators = __impl_clear_line_indicators
pub const js_set_line_numbers: __impl_set_line_numbers = __impl_set_line_numbers
pub const js_set_view_mode: __impl_set_view_mode = __impl_set_view_mode
pub const js_set_line_wrap: __impl_set_line_wrap = __impl_set_line_wrap
pub const js_set_view_state: __impl_set_view_state = __impl_set_view_state
pub const js_get_view_state: __impl_get_view_state = __impl_get_view_state
pub const js_set_global_state: __impl_set_global_state = __impl_set_global_state
pub const js_get_global_state: __impl_get_global_state = __impl_get_global_state
pub const js_create_scroll_sync_group: __impl_create_scroll_sync_group = __impl_create_scroll_sync_group
pub const js_set_scroll_sync_anchors: __impl_set_scroll_sync_anchors = __impl_set_scroll_sync_anchors
pub const js_remove_scroll_sync_group: __impl_remove_scroll_sync_group = __impl_remove_scroll_sync_group
pub const js_execute_actions: __impl_execute_actions = __impl_execute_actions
pub const js_show_action_popup: __impl_show_action_popup = __impl_show_action_popup
pub const js_disable_lsp_for_language: __impl_disable_lsp_for_language = __impl_disable_lsp_for_language
pub const js_restart_lsp_for_language: __impl_restart_lsp_for_language = __impl_restart_lsp_for_language
pub const js_set_lsp_root_uri: __impl_set_lsp_root_uri = __impl_set_lsp_root_uri
pub const js_get_all_diagnostics: __impl_get_all_diagnostics = __impl_get_all_diagnostics
pub const js_get_handlers: __impl_get_handlers = __impl_get_handlers
pub const js_create_virtual_buffer_start: __impl_create_virtual_buffer_start = __impl_create_virtual_buffer_start
pub const js_create_virtual_buffer_in_split_start: __impl_create_virtual_buffer_in_split_start = __impl_create_virtual_buffer_in_split_start
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
pub const js_set_virtual_buffer_content: __impl_set_virtual_buffer_content = __impl_set_virtual_buffer_content
pub const js_get_text_properties_at_cursor: __impl_get_text_properties_at_cursor = __impl_get_text_properties_at_cursor
pub const js_spawn_process_start: __impl_spawn_process_start = __impl_spawn_process_start
pub const js_spawn_process_wait_start: __impl_spawn_process_wait_start = __impl_spawn_process_wait_start
pub const js_get_buffer_text_start: __impl_get_buffer_text_start = __impl_get_buffer_text_start
pub const js_delay_start: __impl_delay_start = __impl_delay_start
pub const js_grep_project_start: __impl_grep_project_start = __impl_grep_project_start
pub const js_grep_project_streaming_start: __impl_grep_project_streaming_start = __impl_grep_project_streaming_start
pub const js_replace_in_file_start: __impl_replace_in_file_start = __impl_replace_in_file_start
pub const js_send_lsp_request_start: __impl_send_lsp_request_start = __impl_send_lsp_request_start
pub const js_spawn_background_process_start: __impl_spawn_background_process_start = __impl_spawn_background_process_start
pub const js_kill_background_process: __impl_kill_background_process = __impl_kill_background_process
pub const js_create_terminal_start: __impl_create_terminal_start = __impl_create_terminal_start
pub const js_send_terminal_input: __impl_send_terminal_input = __impl_send_terminal_input
pub const js_close_terminal: __impl_close_terminal = __impl_close_terminal
pub const js_refresh_lines: __impl_refresh_lines = __impl_refresh_lines
pub const js_get_current_locale: __impl_get_current_locale = __impl_get_current_locale
pub const js_load_plugin_start: __impl_load_plugin_start = __impl_load_plugin_start
pub const js_unload_plugin_start: __impl_unload_plugin_start = __impl_unload_plugin_start
pub const js_reload_plugin_start: __impl_reload_plugin_start = __impl_reload_plugin_start
pub const js_list_plugins_start: __impl_list_plugins_start = __impl_list_plugins_start
Source§impl JsEditorApi
impl JsEditorApi
Sourcepub fn api_version(&self) -> u32
pub fn api_version(&self) -> u32
Get the plugin API version. Plugins can check this to verify the editor supports the features they need.
Sourcepub fn get_active_buffer_id(&self) -> u32
pub fn get_active_buffer_id(&self) -> u32
Get the active buffer ID (0 if none)
Sourcepub fn get_active_split_id(&self) -> u32
pub fn get_active_split_id(&self) -> u32
Get the active split ID
Sourcepub fn list_buffers<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn list_buffers<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
List all open buffers - returns array of BufferInfo objects
pub fn debug(&self, msg: String)
pub fn info(&self, msg: String)
pub fn warn(&self, msg: String)
pub fn error(&self, msg: String)
pub fn set_status(&self, msg: String)
pub fn copy_to_clipboard(&self, text: String)
pub fn set_clipboard(&self, text: String)
Sourcepub fn get_keybinding_label(
&self,
action: String,
mode: Option<String>,
) -> Option<String>
pub fn get_keybinding_label( &self, action: String, mode: Option<String>, ) -> Option<String>
Get the display label for a keybinding by action name and optional mode. Returns null if no binding is found.
Sourcepub fn register_command<'js>(
&self,
_ctx: Ctx<'js>,
name: String,
description: String,
handler_name: String,
context: Opt<Value<'js>>,
) -> Result<bool>
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 in the command palette (Ctrl+P).
Usually you should omit context so the command is always visible.
If provided, the command is hidden unless your plugin has activated
that context with editor.setContext(name, true) or the focused buffer’s
virtual mode (from defineMode()) matches. This is for plugin-defined
contexts only (e.g. "tour-active", "review-mode"), not built-in
editor modes.
Sourcepub fn unregister_command(&self, name: String) -> bool
pub fn unregister_command(&self, name: String) -> bool
Unregister a command by name
Sourcepub fn set_context(&self, name: String, active: bool) -> bool
pub fn set_context(&self, name: String, active: bool) -> bool
Set a context (for keybinding conditions)
Sourcepub fn execute_action(&self, action_name: String) -> bool
pub fn execute_action(&self, action_name: String) -> bool
Execute a built-in action
Sourcepub fn t<'js>(
&self,
_ctx: Ctx<'js>,
key: String,
args: Rest<Value<'js>>,
) -> String
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
Sourcepub fn get_cursor_position(&self) -> u32
pub fn get_cursor_position(&self) -> u32
Get cursor position in active buffer
Sourcepub fn get_buffer_path(&self, buffer_id: u32) -> String
pub fn get_buffer_path(&self, buffer_id: u32) -> String
Get file path for a buffer
Sourcepub fn get_buffer_length(&self, buffer_id: u32) -> u32
pub fn get_buffer_length(&self, buffer_id: u32) -> u32
Get buffer length in bytes
Sourcepub fn is_buffer_modified(&self, buffer_id: u32) -> bool
pub fn is_buffer_modified(&self, buffer_id: u32) -> bool
Check if buffer has unsaved changes
Sourcepub fn save_buffer_to_path(&self, buffer_id: u32, path: String) -> bool
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
Sourcepub fn get_buffer_info<'js>(
&self,
ctx: Ctx<'js>,
buffer_id: u32,
) -> Result<Value<'js>>
pub fn get_buffer_info<'js>( &self, ctx: Ctx<'js>, buffer_id: u32, ) -> Result<Value<'js>>
Get buffer info by ID
Sourcepub fn get_primary_cursor<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_primary_cursor<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get primary cursor info for active buffer
Sourcepub fn get_all_cursors<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_all_cursors<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get all cursors for active buffer
Sourcepub fn get_all_cursor_positions<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_all_cursor_positions<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get all cursor positions as byte offsets
Sourcepub fn get_viewport<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_viewport<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get viewport info for active buffer
Sourcepub fn get_cursor_line(&self) -> u32
pub fn get_cursor_line(&self) -> u32
Get the line number (0-indexed) of the primary cursor
Sourcepub fn get_line_start_position_start(&self, _ctx: Ctx<'_>, line: u32) -> u64
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
Sourcepub fn get_line_end_position_start(&self, _ctx: Ctx<'_>, line: u32) -> u64
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
Sourcepub fn get_buffer_line_count_start(&self, _ctx: Ctx<'_>) -> u64
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
Sourcepub fn scroll_to_line_center(
&self,
split_id: u32,
buffer_id: u32,
line: u32,
) -> bool
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)
Sourcepub fn find_buffer_by_path(&self, path: String) -> u32
pub fn find_buffer_by_path(&self, path: String) -> u32
Find buffer by file path, returns buffer ID or 0 if not found
Sourcepub fn get_buffer_saved_diff<'js>(
&self,
ctx: Ctx<'js>,
buffer_id: u32,
) -> Result<Value<'js>>
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
Sourcepub fn insert_text(&self, buffer_id: u32, position: u32, text: String) -> bool
pub fn insert_text(&self, buffer_id: u32, position: u32, text: String) -> bool
Insert text at a position in a buffer
Sourcepub fn delete_range(&self, buffer_id: u32, start: u32, end: u32) -> bool
pub fn delete_range(&self, buffer_id: u32, start: u32, end: u32) -> bool
Delete a range from a buffer
Sourcepub fn insert_at_cursor(&self, text: String) -> bool
pub fn insert_at_cursor(&self, text: String) -> bool
Insert text at cursor position in active buffer
Sourcepub fn open_file(
&self,
path: String,
line: Option<u32>,
column: Option<u32>,
) -> bool
pub fn open_file( &self, path: String, line: Option<u32>, column: Option<u32>, ) -> bool
Open a file, optionally at a specific line/column
Sourcepub fn open_file_in_split(
&self,
split_id: u32,
path: String,
line: u32,
column: u32,
) -> bool
pub fn open_file_in_split( &self, split_id: u32, path: String, line: u32, column: u32, ) -> bool
Open a file in a specific split
Sourcepub fn show_buffer(&self, buffer_id: u32) -> bool
pub fn show_buffer(&self, buffer_id: u32) -> bool
Show a buffer in the current split
Sourcepub fn close_buffer(&self, buffer_id: u32) -> bool
pub fn close_buffer(&self, buffer_id: u32) -> bool
Close a buffer
Sourcepub fn on<'js>(&self, _ctx: Ctx<'js>, event_name: String, handler_name: String)
pub fn on<'js>(&self, _ctx: Ctx<'js>, event_name: String, handler_name: String)
Subscribe to an editor event
Sourcepub fn path_join(&self, parts: Rest<String>) -> String
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)
Sourcepub fn path_dirname(&self, path: String) -> String
pub fn path_dirname(&self, path: String) -> String
Get directory name from path
Sourcepub fn path_basename(&self, path: String) -> String
pub fn path_basename(&self, path: String) -> String
Get file name from path
Sourcepub fn path_extname(&self, path: String) -> String
pub fn path_extname(&self, path: String) -> String
Get file extension
Sourcepub fn path_is_absolute(&self, path: String) -> bool
pub fn path_is_absolute(&self, path: String) -> bool
Check if path is absolute
Sourcepub fn file_uri_to_path(&self, uri: String) -> String
pub fn file_uri_to_path(&self, uri: String) -> String
Convert a file:// URI to a local file path. Handles percent-decoding and Windows drive letters. Returns an empty string if the URI is not a valid file URI.
Sourcepub fn path_to_file_uri(&self, path: String) -> String
pub fn path_to_file_uri(&self, path: String) -> String
Convert a local file path to a file:// URI. Handles Windows drive letters and special characters. Returns an empty string if the path cannot be converted.
Sourcepub fn utf8_byte_length(&self, text: String) -> u32
pub fn utf8_byte_length(&self, text: String) -> u32
Get the UTF-8 byte length of a JavaScript string.
JS strings are UTF-16 internally, so str.length returns the number of
UTF-16 code units, not the number of bytes in a UTF-8 encoding. The
editor API uses byte offsets for all buffer positions (overlays, cursor,
getBufferText ranges, etc.). This helper lets plugins convert JS string
lengths / regex match indices to the byte offsets the editor expects.
Sourcepub fn file_exists(&self, path: String) -> bool
pub fn file_exists(&self, path: String) -> bool
Check if file exists
Sourcepub fn write_file(&self, path: String, content: String) -> bool
pub fn write_file(&self, path: String, content: String) -> bool
Write file contents
Sourcepub fn read_dir<'js>(&self, ctx: Ctx<'js>, path: String) -> Result<Value<'js>>
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})
Sourcepub fn get_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get current config as JS object
Sourcepub fn get_user_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_user_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get user config as JS object
Sourcepub fn reload_config(&self)
pub fn reload_config(&self)
Reload configuration from file
Sourcepub fn reload_themes(&self)
pub fn reload_themes(&self)
Reload theme registry from disk Call this after installing theme packages or saving new themes
Sourcepub fn reload_and_apply_theme(&self, theme_name: String)
pub fn reload_and_apply_theme(&self, theme_name: String)
Reload theme registry and apply a theme atomically
Sourcepub fn register_grammar(
&self,
language: String,
grammar_path: String,
extensions: Vec<String>,
) -> bool
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
Sourcepub fn register_language_config(
&self,
language: String,
config: LanguagePackConfig,
) -> bool
pub fn register_language_config( &self, language: String, config: LanguagePackConfig, ) -> bool
Register language configuration (comment prefix, indentation, formatter)
Sourcepub fn register_lsp_server(
&self,
language: String,
config: LspServerPackConfig,
) -> bool
pub fn register_lsp_server( &self, language: String, config: LspServerPackConfig, ) -> bool
Register an LSP server for a language
Sourcepub fn reload_grammars_start(&self, _ctx: Ctx<'_>) -> u64
pub fn reload_grammars_start(&self, _ctx: Ctx<'_>) -> u64
Reload the grammar registry to apply registered grammars (async) Call this after registering one or more grammars. Returns a Promise that resolves when the grammar rebuild completes.
Sourcepub fn get_config_dir(&self) -> String
pub fn get_config_dir(&self) -> String
Get config directory path
Sourcepub fn get_themes_dir(&self) -> String
pub fn get_themes_dir(&self) -> String
Get themes directory path
Sourcepub fn apply_theme(&self, theme_name: String) -> bool
pub fn apply_theme(&self, theme_name: String) -> bool
Apply a theme by name
Sourcepub fn get_theme_schema<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_theme_schema<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get theme schema as JS object
Sourcepub fn get_builtin_themes<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_builtin_themes<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get list of builtin themes as JS object
Sourcepub fn delete_theme_sync(&self, name: String) -> bool
pub fn delete_theme_sync(&self, name: String) -> bool
Delete a custom theme file (sync)
Sourcepub fn delete_theme(&self, name: String) -> bool
pub fn delete_theme(&self, name: String) -> bool
Delete a custom theme (alias for deleteThemeSync)
Sourcepub fn get_theme_data<'js>(
&self,
ctx: Ctx<'js>,
name: String,
) -> Result<Value<'js>>
pub fn get_theme_data<'js>( &self, ctx: Ctx<'js>, name: String, ) -> Result<Value<'js>>
Get theme data (JSON) by name from the in-memory cache
Sourcepub fn save_theme_file(&self, name: String, content: String) -> Result<String>
pub fn save_theme_file(&self, name: String, content: String) -> Result<String>
Save a theme file to the user themes directory, returns the saved path
Sourcepub fn theme_file_exists(&self, name: String) -> bool
pub fn theme_file_exists(&self, name: String) -> bool
Check if a user theme file exists
Sourcepub fn file_stat<'js>(&self, ctx: Ctx<'js>, path: String) -> Result<Value<'js>>
pub fn file_stat<'js>(&self, ctx: Ctx<'js>, path: String) -> Result<Value<'js>>
Get file stat information
Sourcepub fn is_process_running(&self, _process_id: u64) -> bool
pub fn is_process_running(&self, _process_id: u64) -> bool
Check if a background process is still running
Sourcepub fn kill_process(&self, process_id: u64) -> bool
pub fn kill_process(&self, process_id: u64) -> bool
Kill a process by ID (alias for killBackgroundProcess)
Sourcepub fn plugin_translate<'js>(
&self,
_ctx: Ctx<'js>,
plugin_name: String,
key: String,
args: Opt<Object<'js>>,
) -> String
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
Sourcepub fn create_composite_buffer_start(
&self,
opts: CreateCompositeBufferOptions,
) -> u64
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
Sourcepub fn update_composite_alignment(
&self,
buffer_id: u32,
hunks: Vec<CompositeHunk>,
) -> bool
pub fn update_composite_alignment( &self, buffer_id: u32, hunks: Vec<CompositeHunk>, ) -> bool
Update alignment hunks for a composite buffer
Uses typed Vec
Sourcepub fn close_composite_buffer(&self, buffer_id: u32) -> bool
pub fn close_composite_buffer(&self, buffer_id: u32) -> bool
Close a composite buffer
Sourcepub fn get_highlights_start<'js>(
&self,
_ctx: Ctx<'js>,
buffer_id: u32,
start: u32,
end: u32,
) -> Result<u64>
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)
Sourcepub fn add_overlay<'js>(
&self,
_ctx: Ctx<'js>,
buffer_id: u32,
namespace: String,
start: u32,
end: u32,
options: Object<'js>,
) -> Result<bool>
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”
Options: fg, bg (RGB array or theme key string), bold, italic, underline, strikethrough, extend_to_line_end (all booleans, default false).
Example usage in TypeScript:
editor.addOverlay(bufferId, "my-namespace", 0, 10, {
fg: "syntax.keyword", // theme key
bg: [40, 40, 50], // RGB array
bold: true,
strikethrough: true,
});Sourcepub fn clear_namespace(&self, buffer_id: u32, namespace: String) -> bool
pub fn clear_namespace(&self, buffer_id: u32, namespace: String) -> bool
Clear all overlays in a namespace
Sourcepub fn clear_all_overlays(&self, buffer_id: u32) -> bool
pub fn clear_all_overlays(&self, buffer_id: u32) -> bool
Clear all overlays from a buffer
Sourcepub fn clear_overlays_in_range(
&self,
buffer_id: u32,
start: u32,
end: u32,
) -> bool
pub fn clear_overlays_in_range( &self, buffer_id: u32, start: u32, end: u32, ) -> bool
Clear all overlays that overlap with a byte range
Sourcepub fn remove_overlay(&self, buffer_id: u32, handle: String) -> bool
pub fn remove_overlay(&self, buffer_id: u32, handle: String) -> bool
Remove an overlay by its handle
Sourcepub fn add_conceal(
&self,
buffer_id: u32,
namespace: String,
start: u32,
end: u32,
replacement: Option<String>,
) -> bool
pub fn add_conceal( &self, buffer_id: u32, namespace: String, start: u32, end: u32, replacement: Option<String>, ) -> bool
Add a conceal range that hides or replaces a byte range during rendering
Sourcepub fn clear_conceal_namespace(&self, buffer_id: u32, namespace: String) -> bool
pub fn clear_conceal_namespace(&self, buffer_id: u32, namespace: String) -> bool
Clear all conceal ranges in a namespace
Sourcepub fn clear_conceals_in_range(
&self,
buffer_id: u32,
start: u32,
end: u32,
) -> bool
pub fn clear_conceals_in_range( &self, buffer_id: u32, start: u32, end: u32, ) -> bool
Clear all conceal ranges that overlap with a byte range
Sourcepub fn add_soft_break(
&self,
buffer_id: u32,
namespace: String,
position: u32,
indent: u32,
) -> bool
pub fn add_soft_break( &self, buffer_id: u32, namespace: String, position: u32, indent: u32, ) -> bool
Add a soft break point for marker-based line wrapping
Sourcepub fn clear_soft_break_namespace(
&self,
buffer_id: u32,
namespace: String,
) -> bool
pub fn clear_soft_break_namespace( &self, buffer_id: u32, namespace: String, ) -> bool
Clear all soft breaks in a namespace
Sourcepub fn clear_soft_breaks_in_range(
&self,
buffer_id: u32,
start: u32,
end: u32,
) -> bool
pub fn clear_soft_breaks_in_range( &self, buffer_id: u32, start: u32, end: u32, ) -> bool
Clear all soft breaks that fall within a byte range
Sourcepub 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>
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?: {…}}
Sourcepub fn clear_view_transform(
&self,
buffer_id: u32,
split_id: Option<u32>,
) -> bool
pub fn clear_view_transform( &self, buffer_id: u32, split_id: Option<u32>, ) -> bool
Clear view transform for a buffer/split
Sourcepub fn set_layout_hints<'js>(
&self,
buffer_id: u32,
split_id: Option<u32>,
hints: Object<'js>,
) -> Result<bool>
pub fn set_layout_hints<'js>( &self, buffer_id: u32, split_id: Option<u32>, hints: Object<'js>, ) -> Result<bool>
Set layout hints (compose width, column guides) for a buffer/split without going through the view_transform pipeline.
Sourcepub fn set_file_explorer_decorations<'js>(
&self,
_ctx: Ctx<'js>,
namespace: String,
decorations: Vec<Object<'js>>,
) -> Result<bool>
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
Sourcepub fn clear_file_explorer_decorations(&self, namespace: String) -> bool
pub fn clear_file_explorer_decorations(&self, namespace: String) -> bool
Clear file explorer decorations for a namespace
Sourcepub 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
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)
Sourcepub fn remove_virtual_text(
&self,
buffer_id: u32,
virtual_text_id: String,
) -> bool
pub fn remove_virtual_text( &self, buffer_id: u32, virtual_text_id: String, ) -> bool
Remove a virtual text by ID
Sourcepub fn remove_virtual_texts_by_prefix(
&self,
buffer_id: u32,
prefix: String,
) -> bool
pub fn remove_virtual_texts_by_prefix( &self, buffer_id: u32, prefix: String, ) -> bool
Remove virtual texts whose ID starts with the given prefix
Sourcepub fn clear_virtual_texts(&self, buffer_id: u32) -> bool
pub fn clear_virtual_texts(&self, buffer_id: u32) -> bool
Clear all virtual texts from a buffer
Sourcepub fn clear_virtual_text_namespace(
&self,
buffer_id: u32,
namespace: String,
) -> bool
pub fn clear_virtual_text_namespace( &self, buffer_id: u32, namespace: String, ) -> bool
Clear all virtual texts in a namespace
Sourcepub 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
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)
Sourcepub fn prompt_start(
&self,
_ctx: Ctx<'_>,
label: String,
initial_value: String,
) -> u64
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
Sourcepub fn start_prompt(&self, label: String, prompt_type: String) -> bool
pub fn start_prompt(&self, label: String, prompt_type: String) -> bool
Start an interactive prompt
Sourcepub fn start_prompt_with_initial(
&self,
label: String,
prompt_type: String,
initial_value: String,
) -> bool
pub fn start_prompt_with_initial( &self, label: String, prompt_type: String, initial_value: String, ) -> bool
Start a prompt with initial value
Sourcepub fn set_prompt_suggestions(&self, suggestions: Vec<Suggestion>) -> bool
pub fn set_prompt_suggestions(&self, suggestions: Vec<Suggestion>) -> bool
Set suggestions for the current prompt
Uses typed Vec
pub fn set_prompt_input_sync(&self, sync: bool) -> bool
Sourcepub fn define_mode(
&self,
name: String,
bindings_arr: Vec<Vec<String>>,
read_only: Opt<bool>,
allow_text_input: Opt<bool>,
) -> bool
pub fn define_mode( &self, name: String, bindings_arr: Vec<Vec<String>>, read_only: Opt<bool>, allow_text_input: Opt<bool>, ) -> bool
Define a buffer mode (takes bindings as array of [key, command] pairs)
Sourcepub fn set_editor_mode(&self, mode: Option<String>) -> bool
pub fn set_editor_mode(&self, mode: Option<String>) -> bool
Set the global editor mode
Sourcepub fn get_editor_mode(&self) -> Option<String>
pub fn get_editor_mode(&self) -> Option<String>
Get the current editor mode
Sourcepub fn close_split(&self, split_id: u32) -> bool
pub fn close_split(&self, split_id: u32) -> bool
Close a split
Sourcepub fn set_split_buffer(&self, split_id: u32, buffer_id: u32) -> bool
pub fn set_split_buffer(&self, split_id: u32, buffer_id: u32) -> bool
Set the buffer displayed in a split
Sourcepub fn focus_split(&self, split_id: u32) -> bool
pub fn focus_split(&self, split_id: u32) -> bool
Focus a specific split
Sourcepub fn set_split_scroll(&self, split_id: u32, top_byte: u32) -> bool
pub fn set_split_scroll(&self, split_id: u32, top_byte: u32) -> bool
Set scroll position of a split
Sourcepub fn set_split_ratio(&self, split_id: u32, ratio: f32) -> bool
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)
Sourcepub fn set_split_label(&self, split_id: u32, label: String) -> bool
pub fn set_split_label(&self, split_id: u32, label: String) -> bool
Set a label on a split (e.g., “sidebar”)
Sourcepub fn clear_split_label(&self, split_id: u32) -> bool
pub fn clear_split_label(&self, split_id: u32) -> bool
Remove a label from a split
Sourcepub fn get_split_by_label_start(&self, _ctx: Ctx<'_>, label: String) -> u64
pub fn get_split_by_label_start(&self, _ctx: Ctx<'_>, label: String) -> u64
Find a split by label (async)
Sourcepub fn distribute_splits_evenly(&self) -> bool
pub fn distribute_splits_evenly(&self) -> bool
Distribute all splits evenly
Sourcepub fn set_buffer_cursor(&self, buffer_id: u32, position: u32) -> bool
pub fn set_buffer_cursor(&self, buffer_id: u32, position: u32) -> bool
Set cursor position in a buffer
Sourcepub fn set_line_indicator(
&self,
buffer_id: u32,
line: u32,
namespace: String,
symbol: String,
r: u8,
g: u8,
b: u8,
priority: i32,
) -> bool
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
Sourcepub fn set_line_indicators(
&self,
buffer_id: u32,
lines: Vec<u32>,
namespace: String,
symbol: String,
r: u8,
g: u8,
b: u8,
priority: i32,
) -> bool
pub fn set_line_indicators( &self, buffer_id: u32, lines: Vec<u32>, namespace: String, symbol: String, r: u8, g: u8, b: u8, priority: i32, ) -> bool
Batch set line indicators in the gutter
Sourcepub fn clear_line_indicators(&self, buffer_id: u32, namespace: String) -> bool
pub fn clear_line_indicators(&self, buffer_id: u32, namespace: String) -> bool
Clear line indicators in a namespace
Sourcepub fn set_line_numbers(&self, buffer_id: u32, enabled: bool) -> bool
pub fn set_line_numbers(&self, buffer_id: u32, enabled: bool) -> bool
Enable or disable line numbers for a buffer
Sourcepub fn set_view_mode(&self, buffer_id: u32, mode: String) -> bool
pub fn set_view_mode(&self, buffer_id: u32, mode: String) -> bool
Set the view mode for a buffer (“source” or “compose”)
Sourcepub fn set_line_wrap(
&self,
buffer_id: u32,
split_id: Option<u32>,
enabled: bool,
) -> bool
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
Sourcepub fn set_view_state<'js>(
&self,
ctx: Ctx<'js>,
buffer_id: u32,
key: String,
value: Value<'js>,
) -> bool
pub fn set_view_state<'js>( &self, ctx: Ctx<'js>, buffer_id: u32, key: String, value: Value<'js>, ) -> bool
Set plugin-managed per-buffer view state (write-through to snapshot + command for persistence)
Sourcepub fn get_view_state<'js>(
&self,
ctx: Ctx<'js>,
buffer_id: u32,
key: String,
) -> Result<Value<'js>>
pub fn get_view_state<'js>( &self, ctx: Ctx<'js>, buffer_id: u32, key: String, ) -> Result<Value<'js>>
Get plugin-managed per-buffer view state (reads from snapshot)
Sourcepub fn set_global_state<'js>(
&self,
ctx: Ctx<'js>,
key: String,
value: Value<'js>,
) -> bool
pub fn set_global_state<'js>( &self, ctx: Ctx<'js>, key: String, value: Value<'js>, ) -> bool
Set plugin-managed global state (write-through to snapshot + command for persistence). State is automatically isolated per plugin using the plugin’s name. TODO: Need to think about plugin isolation / namespacing strategy for these APIs.
Sourcepub fn get_global_state<'js>(
&self,
ctx: Ctx<'js>,
key: String,
) -> Result<Value<'js>>
pub fn get_global_state<'js>( &self, ctx: Ctx<'js>, key: String, ) -> Result<Value<'js>>
Get plugin-managed global state (reads from snapshot). State is automatically isolated per plugin using the plugin’s name. TODO: Need to think about plugin isolation / namespacing strategy for these APIs.
Sourcepub fn create_scroll_sync_group(
&self,
group_id: u32,
left_split: u32,
right_split: u32,
) -> bool
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
Sourcepub fn set_scroll_sync_anchors<'js>(
&self,
_ctx: Ctx<'js>,
group_id: u32,
anchors: Vec<Vec<u32>>,
) -> bool
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
Sourcepub fn remove_scroll_sync_group(&self, group_id: u32) -> bool
pub fn remove_scroll_sync_group(&self, group_id: u32) -> bool
Remove a scroll sync group
Sourcepub fn execute_actions(&self, actions: Vec<ActionSpec>) -> bool
pub fn execute_actions(&self, actions: Vec<ActionSpec>) -> bool
Execute multiple actions in sequence
Takes typed ActionSpec array - serde validates field names at runtime
Sourcepub fn show_action_popup(&self, opts: ActionPopupOptions) -> bool
pub fn show_action_popup(&self, opts: ActionPopupOptions) -> bool
Show an action popup
Takes a typed ActionPopupOptions struct - serde validates field names at runtime
Sourcepub fn disable_lsp_for_language(&self, language: String) -> bool
pub fn disable_lsp_for_language(&self, language: String) -> bool
Disable LSP for a specific language
Sourcepub fn restart_lsp_for_language(&self, language: String) -> bool
pub fn restart_lsp_for_language(&self, language: String) -> bool
Restart LSP server for a specific language
Sourcepub fn set_lsp_root_uri(&self, language: String, uri: String) -> bool
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)
Sourcepub fn get_all_diagnostics<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_all_diagnostics<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get all diagnostics from LSP
Sourcepub fn get_handlers(&self, event_name: String) -> Vec<String>
pub fn get_handlers(&self, event_name: String) -> Vec<String>
Get registered event handlers for an event
Sourcepub fn create_virtual_buffer_start(
&self,
_ctx: Ctx<'_>,
opts: CreateVirtualBufferOptions,
) -> Result<u64>
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)
Sourcepub fn create_virtual_buffer_in_split_start(
&self,
_ctx: Ctx<'_>,
opts: CreateVirtualBufferInSplitOptions,
) -> Result<u64>
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)
Sourcepub fn create_virtual_buffer_in_existing_split_start(
&self,
_ctx: Ctx<'_>,
opts: CreateVirtualBufferInExistingSplitOptions,
) -> Result<u64>
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)
Sourcepub fn set_virtual_buffer_content<'js>(
&self,
ctx: Ctx<'js>,
buffer_id: u32,
entries_arr: Vec<Object<'js>>,
) -> Result<bool>
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
Sourcepub fn get_text_properties_at_cursor(
&self,
buffer_id: u32,
) -> TextPropertiesAtCursor
pub fn get_text_properties_at_cursor( &self, buffer_id: u32, ) -> TextPropertiesAtCursor
Get text properties at cursor position (returns JS array)
Sourcepub fn spawn_process_start(
&self,
_ctx: Ctx<'_>,
command: String,
args: Vec<String>,
cwd: Opt<String>,
) -> u64
pub fn spawn_process_start( &self, _ctx: Ctx<'_>, command: String, args: Vec<String>, cwd: Opt<String>, ) -> u64
Spawn a process (async, returns request_id)
Sourcepub fn spawn_process_wait_start(&self, _ctx: Ctx<'_>, process_id: u64) -> u64
pub fn spawn_process_wait_start(&self, _ctx: Ctx<'_>, process_id: u64) -> u64
Wait for a process to complete and get its result (async)
Sourcepub fn get_buffer_text_start(
&self,
_ctx: Ctx<'_>,
buffer_id: u32,
start: u32,
end: u32,
) -> u64
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)
Sourcepub fn delay_start(&self, _ctx: Ctx<'_>, duration_ms: u64) -> u64
pub fn delay_start(&self, _ctx: Ctx<'_>, duration_ms: u64) -> u64
Delay/sleep (async, returns request_id)
Sourcepub fn grep_project_start(
&self,
_ctx: Ctx<'_>,
pattern: String,
fixed_string: Option<bool>,
case_sensitive: Option<bool>,
max_results: Option<u32>,
whole_words: Option<bool>,
) -> u64
pub fn grep_project_start( &self, _ctx: Ctx<'_>, pattern: String, fixed_string: Option<bool>, case_sensitive: Option<bool>, max_results: Option<u32>, whole_words: Option<bool>, ) -> u64
Project-wide grep search (async) Searches all files in the project, respecting .gitignore. Open buffers with dirty edits are searched in-memory.
Sourcepub fn grep_project_streaming_start(
&self,
_ctx: Ctx<'_>,
pattern: String,
fixed_string: bool,
case_sensitive: bool,
max_results: u32,
whole_words: bool,
) -> u64
pub fn grep_project_streaming_start( &self, _ctx: Ctx<'_>, pattern: String, fixed_string: bool, case_sensitive: bool, max_results: u32, whole_words: bool, ) -> u64
Streaming project-wide grep search Returns a thenable with a searchId property. The progressCallback is called with batches of matches as they are found.
Sourcepub fn replace_in_file_start(
&self,
_ctx: Ctx<'_>,
file_path: String,
matches: Vec<Vec<u32>>,
replacement: String,
) -> u64
pub fn replace_in_file_start( &self, _ctx: Ctx<'_>, file_path: String, matches: Vec<Vec<u32>>, replacement: String, ) -> u64
Replace matches in a file’s buffer (async) Opens the file if not already in a buffer, applies edits via the buffer model, and saves. All edits are grouped as a single undo action.
Sourcepub fn send_lsp_request_start<'js>(
&self,
ctx: Ctx<'js>,
language: String,
method: String,
params: Option<Object<'js>>,
) -> Result<u64>
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)
Sourcepub fn spawn_background_process_start(
&self,
_ctx: Ctx<'_>,
command: String,
args: Vec<String>,
cwd: Opt<String>,
) -> u64
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)
Sourcepub fn kill_background_process(&self, process_id: u64) -> bool
pub fn kill_background_process(&self, process_id: u64) -> bool
Kill a background process
Sourcepub fn create_terminal_start(
&self,
_ctx: Ctx<'_>,
opts: Opt<CreateTerminalOptions>,
) -> Result<u64>
pub fn create_terminal_start( &self, _ctx: Ctx<'_>, opts: Opt<CreateTerminalOptions>, ) -> Result<u64>
Create a new terminal in a split (async, returns TerminalResult)
Sourcepub fn send_terminal_input(&self, terminal_id: u64, data: String) -> bool
pub fn send_terminal_input(&self, terminal_id: u64, data: String) -> bool
Send input data to a terminal
Sourcepub fn close_terminal(&self, terminal_id: u64) -> bool
pub fn close_terminal(&self, terminal_id: u64) -> bool
Close a terminal
Sourcepub fn refresh_lines(&self, buffer_id: u32) -> bool
pub fn refresh_lines(&self, buffer_id: u32) -> bool
Force refresh of line display
Sourcepub fn get_current_locale(&self) -> String
pub fn get_current_locale(&self) -> String
Get the current locale
Sourcepub fn load_plugin_start(&self, _ctx: Ctx<'_>, path: String) -> u64
pub fn load_plugin_start(&self, _ctx: Ctx<'_>, path: String) -> u64
Load a plugin from a file path (async)
Sourcepub fn unload_plugin_start(&self, _ctx: Ctx<'_>, name: String) -> u64
pub fn unload_plugin_start(&self, _ctx: Ctx<'_>, name: String) -> u64
Unload a plugin by name (async)
Sourcepub fn reload_plugin_start(&self, _ctx: Ctx<'_>, name: String) -> u64
pub fn reload_plugin_start(&self, _ctx: Ctx<'_>, name: String) -> u64
Reload a plugin by name (async)
Sourcepub fn list_plugins_start(&self, _ctx: Ctx<'_>) -> u64
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 JsEditorApiwhere
for<'a> CloneWrapper<'a, Self>: CloneTrait<Self>,
impl<'js> FromJs<'js> for JsEditorApiwhere
for<'a> CloneWrapper<'a, Self>: CloneTrait<Self>,
Source§impl<'js> IntoJs<'js> for JsEditorApi
impl<'js> IntoJs<'js> for JsEditorApi
Source§impl<'js> JsClass<'js> for JsEditorApi
impl<'js> JsClass<'js> for JsEditorApi
Source§fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
fn constructor(ctx: &Ctx<'js>) -> Result<Option<Constructor<'js>>>
Source§impl<'js> JsLifetime<'js> for JsEditorApi
impl<'js> JsLifetime<'js> for JsEditorApi
Source§type Changed<'to> = JsEditorApi
type Changed<'to> = JsEditorApi
Self but with another lifetime 'tSource§impl MethodImplementor<JsEditorApi> for MethodImpl<JsEditorApi>
impl MethodImplementor<JsEditorApi> for MethodImpl<JsEditorApi>
Auto Trait Implementations§
impl Freeze for JsEditorApi
impl !RefUnwindSafe for JsEditorApi
impl !Send for JsEditorApi
impl !Sync for JsEditorApi
impl Unpin for JsEditorApi
impl UnsafeUnpin for JsEditorApi
impl !UnwindSafe for JsEditorApi
Blanket Implementations§
Source§impl<'js, T> AsProperty<'js, T> for Twhere
T: IntoJs<'js>,
impl<'js, T> AsProperty<'js, T> for Twhere
T: IntoJs<'js>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more