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_plugin_name: __impl_plugin_name = __impl_plugin_name
pub const js_export_plugin_api: __impl_export_plugin_api = __impl_export_plugin_api
pub const js_get_plugin_api: __impl_get_plugin_api = __impl_get_plugin_api
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_has_active_search: __impl_has_active_search = __impl_has_active_search
pub const js_list_buffers: __impl_list_buffers = __impl_list_buffers
pub const js_list_grammars: __impl_list_grammars = __impl_list_grammars
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_cancel_prompt: __impl_cancel_prompt = __impl_cancel_prompt
pub const js_register_status_bar_element: __impl_register_status_bar_element = __impl_register_status_bar_element
pub const js_set_status_bar_value: __impl_set_status_bar_value = __impl_set_status_bar_value
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_screen_size: __impl_get_screen_size = __impl_get_screen_size
pub const js_list_splits: __impl_list_splits = __impl_list_splits
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_get_composite_cursor_info_start: __impl_get_composite_cursor_info_start = __impl_get_composite_cursor_info_start
pub const js_scroll_to_line_center: __impl_scroll_to_line_center = __impl_scroll_to_line_center
pub const js_scroll_buffer_to_line: __impl_scroll_buffer_to_line = __impl_scroll_buffer_to_line
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_background: __impl_open_file_in_background = __impl_open_file_in_background
pub const js_open_file_in_split: __impl_open_file_in_split = __impl_open_file_in_split
pub const js_open_file_streaming_start: __impl_open_file_streaming_start = __impl_open_file_streaming_start
pub const js_refresh_buffer_from_disk_start: __impl_refresh_buffer_from_disk_start = __impl_refresh_buffer_from_disk_start
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_close_other_buffers_in_split: __impl_close_other_buffers_in_split = __impl_close_other_buffers_in_split
pub const js_close_all_buffers_in_split: __impl_close_all_buffers_in_split = __impl_close_all_buffers_in_split
pub const js_close_buffers_to_right_in_split: __impl_close_buffers_to_right_in_split = __impl_close_buffers_to_right_in_split
pub const js_close_buffers_to_left_in_split: __impl_close_buffers_to_left_in_split = __impl_close_buffers_to_left_in_split
pub const js_move_tab_to_left: __impl_move_tab_to_left = __impl_move_tab_to_left
pub const js_move_tab_to_right: __impl_move_tab_to_right = __impl_move_tab_to_right
pub const js_animate_area: __impl_animate_area = __impl_animate_area
pub const js_animate_virtual_buffer: __impl_animate_virtual_buffer = __impl_animate_virtual_buffer
pub const js_cancel_animation: __impl_cancel_animation = __impl_cancel_animation
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_workspace_trust_level: __impl_workspace_trust_level = __impl_workspace_trust_level
pub const js_env_active: __impl_env_active = __impl_env_active
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_create_dir: __impl_create_dir = __impl_create_dir
pub const js_remove_path: __impl_remove_path = __impl_remove_path
pub const js_rename_path: __impl_rename_path = __impl_rename_path
pub const js_copy_path: __impl_copy_path = __impl_copy_path
pub const js_get_temp_dir: __impl_get_temp_dir = __impl_get_temp_dir
pub const js_parse_jsonc: __impl_parse_jsonc = __impl_parse_jsonc
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_define_config_boolean: __impl_define_config_boolean = __impl_define_config_boolean
pub const js_define_config_integer: __impl_define_config_integer = __impl_define_config_integer
pub const js_define_config_number: __impl_define_config_number = __impl_define_config_number
pub const js_define_config_string: __impl_define_config_string = __impl_define_config_string
pub const js_define_config_enum: __impl_define_config_enum = __impl_define_config_enum
pub const js_define_config_string_array: __impl_define_config_string_array = __impl_define_config_string_array
pub const js_get_plugin_config: __impl_get_plugin_config = __impl_get_plugin_config
pub const js_reload_config: __impl_reload_config = __impl_reload_config
pub const js_set_setting: __impl_set_setting = __impl_set_setting
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_plugin_dir: __impl_get_plugin_dir = __impl_get_plugin_dir
pub const js_get_config_dir: __impl_get_config_dir = __impl_get_config_dir
pub const js_get_data_dir: __impl_get_data_dir = __impl_get_data_dir
pub const js_get_terminal_dir: __impl_get_terminal_dir = __impl_get_terminal_dir
pub const js_get_working_data_dir: __impl_get_working_data_dir = __impl_get_working_data_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_override_theme_colors: __impl_override_theme_colors = __impl_override_theme_colors
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_get_all_themes: __impl_get_all_themes = __impl_get_all_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_flush_layout: __impl_flush_layout = __impl_flush_layout
pub const js_composite_next_hunk: __impl_composite_next_hunk = __impl_composite_next_hunk
pub const js_composite_prev_hunk: __impl_composite_prev_hunk = __impl_composite_prev_hunk
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_clear_overlays_in_range_for_namespace: __impl_clear_overlays_in_range_for_namespace = __impl_clear_overlays_in_range_for_namespace
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_fold: __impl_add_fold = __impl_add_fold
pub const js_clear_folds: __impl_clear_folds = __impl_clear_folds
pub const js_set_folding_ranges: __impl_set_folding_ranges = __impl_set_folding_ranges
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_set_file_explorer_slots: __impl_set_file_explorer_slots = __impl_set_file_explorer_slots
pub const js_clear_file_explorer_slots: __impl_clear_file_explorer_slots = __impl_clear_file_explorer_slots
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_add_virtual_text_styled: __impl_add_virtual_text_styled = __impl_add_virtual_text_styled
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_begin_key_capture: __impl_begin_key_capture = __impl_begin_key_capture
pub const js_end_key_capture: __impl_end_key_capture = __impl_end_key_capture
pub const js_get_next_key_start: __impl_get_next_key_start = __impl_get_next_key_start
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_set_prompt_title: __impl_set_prompt_title = __impl_set_prompt_title
pub const js_set_prompt_status: __impl_set_prompt_status = __impl_set_prompt_status
pub const js_set_prompt_toolbar: __impl_set_prompt_toolbar = __impl_set_prompt_toolbar
pub const js_toggle_overlay_toolbar_widget: __impl_toggle_overlay_toolbar_widget = __impl_toggle_overlay_toolbar_widget
pub const js_set_prompt_selected_index: __impl_set_prompt_selected_index = __impl_set_prompt_selected_index
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_create_window: __impl_create_window = __impl_create_window
pub const js_set_active_window: __impl_set_active_window = __impl_set_active_window
pub const js_set_active_window_animated: __impl_set_active_window_animated = __impl_set_active_window_animated
pub const js_set_window_cycle_order: __impl_set_window_cycle_order = __impl_set_window_cycle_order
pub const js_close_window: __impl_close_window = __impl_close_window
pub const js_prewarm_window: __impl_prewarm_window = __impl_prewarm_window
pub const js_watch_path_start: __impl_watch_path_start = __impl_watch_path_start
pub const js_unwatch_path: __impl_unwatch_path = __impl_unwatch_path
pub const js_preview_window_in_rect: __impl_preview_window_in_rect = __impl_preview_window_in_rect
pub const js_clear_window_preview: __impl_clear_window_preview = __impl_clear_window_preview
pub const js_list_windows: __impl_list_windows = __impl_list_windows
pub const js_active_window: __impl_active_window = __impl_active_window
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_buffer_show_cursors: __impl_set_buffer_show_cursors = __impl_set_buffer_show_cursors
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_set_window_state: __impl_set_window_state = __impl_set_window_state
pub const js_get_window_state: __impl_get_window_state = __impl_get_window_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_create_buffer_group_start: __impl_create_buffer_group_start = __impl_create_buffer_group_start
pub const js_set_panel_content: __impl_set_panel_content = __impl_set_panel_content
pub const js_close_buffer_group: __impl_close_buffer_group = __impl_close_buffer_group
pub const js_focus_buffer_group_panel: __impl_focus_buffer_group_panel = __impl_focus_buffer_group_panel
pub const js_set_buffer_group_panel_buffer_start: __impl_set_buffer_group_panel_buffer_start = __impl_set_buffer_group_panel_buffer_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_mount_widget_panel: __impl_mount_widget_panel = __impl_mount_widget_panel
pub const js_update_widget_panel: __impl_update_widget_panel = __impl_update_widget_panel
pub const js_unmount_widget_panel: __impl_unmount_widget_panel = __impl_unmount_widget_panel
pub const js_widget_command: __impl_widget_command = __impl_widget_command
pub const js_widget_mutate: __impl_widget_mutate = __impl_widget_mutate
pub const js_mount_floating_widget: __impl_mount_floating_widget = __impl_mount_floating_widget
pub const js_update_floating_widget: __impl_update_floating_widget = __impl_update_floating_widget
pub const js_unmount_floating_widget: __impl_unmount_floating_widget = __impl_unmount_floating_widget
pub const js_floating_panel_control: __impl_floating_panel_control = __impl_floating_panel_control
pub const js_spawn_process_start: __impl_spawn_process_start = __impl_spawn_process_start
pub const js_spawn_host_process_start: __impl_spawn_host_process_start = __impl_spawn_host_process_start
pub const js_kill_host_process: __impl_kill_host_process = __impl_kill_host_process
pub const js_attach_remote_agent: __impl_attach_remote_agent = __impl_attach_remote_agent
pub const js_cancel_remote_agent: __impl_cancel_remote_agent = __impl_cancel_remote_agent
pub const js_set_env: __impl_set_env = __impl_set_env
pub const js_clear_env: __impl_clear_env = __impl_clear_env
pub const js_set_remote_indicator_state: __impl_set_remote_indicator_state = __impl_set_remote_indicator_state
pub const js_clear_remote_indicator_state: __impl_clear_remote_indicator_state = __impl_clear_remote_indicator_state
pub const js_http_fetch_start: __impl_http_fetch_start = __impl_http_fetch_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_begin_search: __impl_begin_search = __impl_begin_search
pub const js_search_handle_take: __impl_search_handle_take = __impl_search_handle_take
pub const js_search_handle_cancel: __impl_search_handle_cancel = __impl_search_handle_cancel
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_create_window_with_terminal_start: __impl_create_window_with_terminal_start = __impl_create_window_with_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_signal_window: __impl_signal_window = __impl_signal_window
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 plugin_name(&self) -> String
pub fn plugin_name(&self) -> String
The name of the plugin this editor handle belongs to. Used by the
M3 plugin-API plane (exportPluginApi tags the exporter). Plugin
authors generally don’t call this directly.
Sourcepub fn export_plugin_api<'js>(
&self,
ctx: Ctx<'js>,
name: String,
api: Value<'js>,
) -> Result<bool>
pub fn export_plugin_api<'js>( &self, ctx: Ctx<'js>, name: String, api: Value<'js>, ) -> Result<bool>
Publish a typed API surface under name. Another plugin (typically
init.ts) can reach it later via getPluginApi(name). Calling
again with the same name replaces the previous registration
(idempotent — reload works). Exports are auto-dropped when the
calling plugin is unloaded.
Returns true on success. Rejects with a TypeError if name is
empty or api is not an object (functions and primitives are not
valid API surfaces — only objects).
Sourcepub fn get_plugin_api<'js>(
&self,
ctx: Ctx<'js>,
name: String,
) -> Result<Value<'js>>
pub fn get_plugin_api<'js>( &self, ctx: Ctx<'js>, name: String, ) -> Result<Value<'js>>
Look up a plugin API previously published via exportPluginApi.
Returns the api object (restored into the caller’s context) or
null if no plugin exports under that name.
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 has_active_search(&self) -> bool
pub fn has_active_search(&self) -> bool
Returns true when search highlights are currently active in the buffer. Becomes true after a search is confirmed; false once cleared.
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
Sourcepub fn list_grammars<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn list_grammars<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
List all available grammars with source info - returns array of GrammarInfo 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>>,
options: 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>>, options: 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 cancel_prompt(&self) -> bool
pub fn cancel_prompt(&self) -> bool
Cancel the active prompt / overlay — the same teardown the Escape key triggers. Lets a plugin dismiss a prompt it opened (e.g. exporting Live Grep results to a dock panel) without routing a synthetic keypress.
Sourcepub fn register_status_bar_element(
&self,
token_name: String,
title: String,
) -> bool
pub fn register_status_bar_element( &self, token_name: String, title: String, ) -> bool
Register a custom statusbar token. Token will be named “plugin_name:token_name” where plugin_name is the current plugin. Returns true if registration succeeded, false if invalid or already registered.
Sourcepub fn set_status_bar_value(
&self,
buffer_id: u64,
token_name: String,
value: String,
) -> bool
pub fn set_status_bar_value( &self, buffer_id: u64, token_name: String, value: String, ) -> bool
Set the value of a status-bar token for a specific buffer. The full token key sent to the editor is “plugin_name:token_name”.
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_screen_size<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_screen_size<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Total terminal dimensions in cells. Unlike getViewport()
(which reports the active split, shrunk by any vertical
split layout), this reflects the full terminal — what a
floating overlay sized by heightPct actually gets.
Sourcepub fn list_splits<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn list_splits<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
List every split with its active buffer and viewport.
Plugins that need to operate on every visible buffer
simultaneously (multi-split flash labels, syncing decorations
across panes, …) iterate this list rather than only seeing
getViewport()’s active-split data. Order is unspecified.
Sourcepub fn get_cursor_line(&self) -> u32
pub fn get_cursor_line(&self) -> u32
Get the line number (0-indexed) of the primary cursor.
@deprecated Use getPrimaryCursor()?.line instead. This accessor cannot
represent “line index unavailable” (huge files before their line scan) —
it returns 0 in that case, indistinguishable from a real first line.
getPrimaryCursor().line is number | null and also covers every cursor
via getAllCursors().
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 get_composite_cursor_info_start(&self, _ctx: Ctx<'_>) -> u64
pub fn get_composite_cursor_info_start(&self, _ctx: Ctx<'_>) -> u64
Cursor info for the active composite (side-by-side diff) buffer.
Resolves with null when the active buffer is not a composite
buffer, otherwise an object describing the focused pane and the
0-indexed source line shown in each pane on the cursor’s aligned
row (null where a pane has no content on that row). Lets a plugin
map a side-by-side cursor back to a concrete file version + line.
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 scroll_buffer_to_line(&self, buffer_id: u32, line: u32) -> bool
pub fn scroll_buffer_to_line(&self, buffer_id: u32, line: u32) -> bool
Scroll any split/panel showing buffer_id so line is visible.
Unlike scrollToLineCenter, this does not require a split id — it
updates every split’s viewport whose active buffer is the given
buffer, including inner leaves of a buffer group. Use this from
a panel plugin to keep the user’s “selected” row in view after
arrow-key navigation (the plugin’s own selection state isn’t
automatically reflected in the buffer cursor, so the core-driven
viewport would otherwise stay put).
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_background(&self, path: String, window_id: Opt<u64>) -> bool
pub fn open_file_in_background(&self, path: String, window_id: Opt<u64>) -> bool
Open a file in the background — no focus change, no
active-split mutation. windowId defaults to the active
session. Setting it to an inactive session id loads the
file’s buffer and adds it as a tab in that session’s
stashed split tree, ready to be revealed on next dive.
Orchestrator uses this to populate worktree sessions with
preselected files.
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 open_file_streaming_start(&self, _ctx: Ctx<'_>, path: String) -> u64
pub fn open_file_streaming_start(&self, _ctx: Ctx<'_>, path: String) -> u64
Open path as a regular buffer in forced large-file (file-backed)
mode. The file is created (empty) if missing — designed for
buffers that will be filled by a concurrent spawnProcess with
stdoutTo. Resolves with the new buffer’s id, or null on
failure.
Pair with refreshBufferFromDisk to grow the buffer as the
streaming write advances.
Sourcepub fn refresh_buffer_from_disk_start(
&self,
_ctx: Ctx<'_>,
buffer_id: u32,
) -> u64
pub fn refresh_buffer_from_disk_start( &self, _ctx: Ctx<'_>, buffer_id: u32, ) -> u64
Re-stat the file backing bufferId and extend the buffer if the
file has grown. Resolves with the new total byte length, or
null if the buffer has no file path or doesn’t exist.
Used to drive a streaming display: while a spawnProcess writes
to a temp file, the plugin polls this on a timer so the buffer
length tracks the file length.
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 close_other_buffers_in_split(
&self,
buffer_id: u32,
split_id: u32,
) -> bool
pub fn close_other_buffers_in_split( &self, buffer_id: u32, split_id: u32, ) -> bool
Close other buffers in split
Sourcepub fn close_all_buffers_in_split(&self, split_id: u32) -> bool
pub fn close_all_buffers_in_split(&self, split_id: u32) -> bool
Close all buffers in split
Sourcepub fn close_buffers_to_right_in_split(
&self,
buffer_id: u32,
split_id: u32,
) -> bool
pub fn close_buffers_to_right_in_split( &self, buffer_id: u32, split_id: u32, ) -> bool
Close buffers to right in split
Sourcepub fn close_buffers_to_left_in_split(
&self,
buffer_id: u32,
split_id: u32,
) -> bool
pub fn close_buffers_to_left_in_split( &self, buffer_id: u32, split_id: u32, ) -> bool
Close buffers to left in split
Sourcepub fn move_tab_to_left(&self) -> bool
pub fn move_tab_to_left(&self) -> bool
Move the active tab to the left in the active split
Sourcepub fn move_tab_to_right(&self) -> bool
pub fn move_tab_to_right(&self) -> bool
Move the active tab to the right in the active split
Sourcepub fn animate_area<'js>(
&self,
rect: Object<'js>,
kind: Object<'js>,
) -> Result<u64>
pub fn animate_area<'js>( &self, rect: Object<'js>, kind: Object<'js>, ) -> Result<u64>
Start a frame-buffer animation over an arbitrary screen region.
Returns an animation id usable with cancelAnimation.
Sourcepub fn animate_virtual_buffer<'js>(
&self,
buffer_id: u32,
kind: Object<'js>,
) -> Result<u64>
pub fn animate_virtual_buffer<'js>( &self, buffer_id: u32, kind: Object<'js>, ) -> Result<u64>
Start an animation over the on-screen Rect currently occupied by a virtual buffer. No-op if the buffer is not visible.
Sourcepub fn cancel_animation(&self, id: u64) -> bool
pub fn cancel_animation(&self, id: u64) -> bool
Cancel an animation previously started via animateArea or
animateVirtualBuffer. No-op if the ID is unknown or already done.
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
Get the active authority’s display label.
Empty means the local (default) authority. A non-empty value
means a plugin-installed or SSH authority is in effect (e.g.
"Container:abc123def456" for a devcontainer). Intended as a
simple “am I already attached?” check that survives editor
restarts — the label lives on the Editor state snapshot so it
is fresh after the authority-transition restart flow.
Sourcepub fn workspace_trust_level(&self) -> String
pub fn workspace_trust_level(&self) -> String
Current Workspace Trust level for the active project: "restricted",
"trusted", or "blocked" (empty when unavailable). Exposed to JS as
editor.workspaceTrustLevel(). Plugins that run repo-controlled work
should treat anything other than "trusted" as “do not execute”.
Sourcepub fn env_active(&self) -> bool
pub fn env_active(&self) -> bool
Whether an environment is currently active (set via editor.setEnv).
Exposed to JS as editor.envActive(). Lets the env-manager plugin
reflect activation and re-establish its file watch after the restart
that setEnv triggers.
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)
Preserves up to 2 leading slashes, which matters on Windows: Rust’s
Path::canonicalize returns \\?\-prefixed paths, and editor.getCwd()
surfaces that to plugin code verbatim. After the backslash→slash
normalization the prefix becomes //?/C:/...; collapsing the leading
// to a single / yields /?/C:/..., which every filesystem API on
Windows rejects, breaking findConfig()-style plugin logic.
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 create_dir(&self, path: String) -> bool
pub fn create_dir(&self, path: String) -> bool
Create a directory (and all parent directories) recursively. Returns true if the directory was created or already exists.
Sourcepub fn remove_path(&self, path: String) -> bool
pub fn remove_path(&self, path: String) -> bool
Remove a file or directory by moving it to the OS trash/recycle bin. For safety, the path must be under the OS temp directory or the Fresh config directory. Returns true on success.
Sourcepub fn rename_path(&self, from: String, to: String) -> bool
pub fn rename_path(&self, from: String, to: String) -> bool
Rename/move a file or directory. Returns true on success. Falls back to copy then trash for cross-filesystem moves.
Sourcepub fn copy_path(&self, from: String, to: String) -> bool
pub fn copy_path(&self, from: String, to: String) -> bool
Copy a file or directory recursively to a new location. Returns true on success.
Sourcepub fn get_temp_dir(&self) -> String
pub fn get_temp_dir(&self) -> String
Get the OS temporary directory path.
Sourcepub fn parse_jsonc<'js>(
&self,
ctx: Ctx<'js>,
text: String,
) -> Result<Value<'js>>
pub fn parse_jsonc<'js>( &self, ctx: Ctx<'js>, text: String, ) -> Result<Value<'js>>
Parse a JSONC (JSON with comments) string into a JS value.
Accepts the JSONC superset: line and block comments, trailing commas, single-quoted strings, and unquoted object keys — matching devcontainer.json / tsconfig.json / VS Code settings.json.
Throws a JS error (catchable with try/catch) when the input is not
valid JSONC, like JSON.parse does for invalid JSON.
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.
The snapshot holds an Arc<serde_json::Value> that was serialized
on the editor side the last time the underlying Arc<Config>
changed. Cloning the Arc inside the read lock is a refcount bump;
the actual walk into the JS runtime happens outside the lock.
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. Same Arc-clone pattern as get_config.
Sourcepub fn define_config_boolean<'js>(
&self,
ctx: Ctx<'js>,
name: String,
options: Object<'js>,
) -> Result<bool>
pub fn define_config_boolean<'js>( &self, ctx: Ctx<'js>, name: String, options: Object<'js>, ) -> Result<bool>
Declare a boolean config field for the calling plugin.
Validates options synchronously: the JS call throws if any
unknown key is present or if default isn’t a boolean. The
Settings UI grows a “Plugin Settings → default).
Sourcepub fn define_config_integer<'js>(
&self,
ctx: Ctx<'js>,
name: String,
options: Object<'js>,
) -> Result<i64>
pub fn define_config_integer<'js>( &self, ctx: Ctx<'js>, name: String, options: Object<'js>, ) -> Result<i64>
Declare an integer config field for the calling plugin. Throws on
invalid options or if the default falls outside minimum/maximum.
Sourcepub fn define_config_number<'js>(
&self,
ctx: Ctx<'js>,
name: String,
options: Object<'js>,
) -> Result<f64>
pub fn define_config_number<'js>( &self, ctx: Ctx<'js>, name: String, options: Object<'js>, ) -> Result<f64>
Declare a floating-point number config field. Throws on bad
options or default outside minimum/maximum.
Sourcepub fn define_config_string<'js>(
&self,
ctx: Ctx<'js>,
name: String,
options: Object<'js>,
) -> Result<String>
pub fn define_config_string<'js>( &self, ctx: Ctx<'js>, name: String, options: Object<'js>, ) -> Result<String>
Declare a free-form string config field.
Sourcepub fn define_config_enum<'js>(
&self,
ctx: Ctx<'js>,
name: String,
options: Object<'js>,
) -> Result<String>
pub fn define_config_enum<'js>( &self, ctx: Ctx<'js>, name: String, options: Object<'js>, ) -> Result<String>
Declare a string config field constrained to one of a fixed set of values. The Settings UI renders this as a dropdown.
The TS signature for this method is hand-written in the d.ts
trailer because the macro can’t express the <E extends string>
generic that propagates values into the return type.
Sourcepub fn define_config_string_array<'js>(
&self,
ctx: Ctx<'js>,
name: String,
options: Object<'js>,
) -> Result<Vec<String>>
pub fn define_config_string_array<'js>( &self, ctx: Ctx<'js>, name: String, options: Object<'js>, ) -> Result<Vec<String>>
Declare an array-of-strings config field (e.g. a list of patterns). The Settings UI renders this as a list editor.
Sourcepub fn get_plugin_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_plugin_config<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Get the calling plugin’s settings as a JS object.
Returns the merged value at config.plugins.<plugin_name>.settings.
The shape comes from whatever the plugin declared via
editor.definePluginConfig(...) (defaults pre-populated by the
host, user overrides on top from the Settings UI). Returns null
if the plugin hasn’t declared a schema and has no user-set value.
Sourcepub fn reload_config(&self)
pub fn reload_config(&self)
Reload configuration from file
Sourcepub fn set_setting<'js>(
&self,
_ctx: Ctx<'js>,
path: String,
value: Value<'js>,
) -> Result<bool>
pub fn set_setting<'js>( &self, _ctx: Ctx<'js>, path: String, value: Value<'js>, ) -> Result<bool>
Set a single config setting in the runtime layer for this session.
path is dot-separated (e.g. "editor.tab_size"). value is any JSON
value in the shape the setting expects. The write lives in an
in-memory layer scoped to the calling plugin — it does not modify
config.json, and unloading the plugin (or reloading init.ts) drops
it. Intended use is init.ts running a conditional:
if (editor.getEnv("SSH_TTY")) editor.setSetting("terminal.mouse", false);
Returns true if the write was queued. The actual update is
asynchronous; a subsequent getConfig() will reflect it after the
editor processes the command.
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<'js>(
&self,
ctx: Ctx<'js>,
language: String,
grammar_path: String,
extensions: Vec<String>,
) -> Result<bool>
pub fn register_grammar<'js>( &self, ctx: Ctx<'js>, language: String, grammar_path: String, extensions: Vec<String>, ) -> Result<bool>
Register a TextMate grammar file for a language The grammar will be pending until reload_grammars() is called
Sourcepub fn register_language_config<'js>(
&self,
ctx: Ctx<'js>,
language: String,
config: LanguagePackConfig,
) -> Result<bool>
pub fn register_language_config<'js>( &self, ctx: Ctx<'js>, language: String, config: LanguagePackConfig, ) -> Result<bool>
Register language configuration (comment prefix, indentation, formatter)
Sourcepub fn register_lsp_server<'js>(
&self,
ctx: Ctx<'js>,
language: String,
config: LspServerPackConfig,
) -> Result<bool>
pub fn register_lsp_server<'js>( &self, ctx: Ctx<'js>, language: String, config: LspServerPackConfig, ) -> Result<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_plugin_dir(&self) -> String
pub fn get_plugin_dir(&self) -> String
Get the directory where this plugin’s files are stored.
For package plugins this is <plugins_dir>/packages/<plugin_name>/.
Sourcepub fn get_config_dir(&self) -> String
pub fn get_config_dir(&self) -> String
Get config directory path
Sourcepub fn get_data_dir(&self) -> String
pub fn get_data_dir(&self) -> String
Get the persistent data directory path (DirectoryContext::data_dir). Intended for plugin state that should outlive a single session — e.g. review-diff comments keyed off git state.
Sourcepub fn get_terminal_dir(&self) -> String
pub fn get_terminal_dir(&self) -> String
Directory holding terminal scrollback backing files for the current working directory. Each project root / worktree has its own subdir, so Universal Search’s terminal scope can stay scoped to the active project rather than spanning every project’s terminals.
Sourcepub fn get_working_data_dir(&self) -> String
pub fn get_working_data_dir(&self) -> String
Per-working-directory data root for plugin state scoped to the current
project root / worktree (<data_dir>/workdirs/<encoded-cwd>/). Use
instead of getDataDir() for state that should not be shared across
worktrees. The directory is not created here — callers create what
they need under it.
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 override_theme_colors<'js>(
&self,
_ctx: Ctx<'js>,
overrides: Value<'js>,
) -> Result<bool>
pub fn override_theme_colors<'js>( &self, _ctx: Ctx<'js>, overrides: Value<'js>, ) -> Result<bool>
Override theme colors in-memory for the running session. overrides
is a JS object mapping "section.field" keys (same namespace as
getThemeSchema) to [r, g, b] triplets (0–255 each).
Unknown keys are dropped silently; out-of-range values are clamped
to 0..=255. Overrides survive until the next applyTheme call
(which replaces the whole Theme). Intended for fast animation
loops from init.ts — no disk I/O, no theme-registry rescan.
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 get_all_themes<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn get_all_themes<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
Full theme registry (builtins + user themes + packages + bundles).
Keyed by canonical registry key; each value carries _key / _pack.
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 flush_layout(&self) -> bool
pub fn flush_layout(&self) -> bool
Force-materialize render-dependent state (like layoutIfNeeded in UIKit).
After calling this, commands that depend on view state created during
rendering (e.g., compositeNextHunk) will work correctly.
Sourcepub fn composite_next_hunk(&self, buffer_id: u32) -> bool
pub fn composite_next_hunk(&self, buffer_id: u32) -> bool
Navigate to the next hunk in a composite buffer
Sourcepub fn composite_prev_hunk(&self, buffer_id: u32) -> bool
pub fn composite_prev_hunk(&self, buffer_id: u32) -> bool
Navigate to the previous hunk in 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 clear_overlays_in_range_for_namespace(
&self,
buffer_id: u32,
namespace: String,
start: u32,
end: u32,
) -> bool
pub fn clear_overlays_in_range_for_namespace( &self, buffer_id: u32, namespace: String, start: u32, end: u32, ) -> bool
Clear overlays in a namespace 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_fold(
&self,
buffer_id: u32,
start: u32,
end: u32,
placeholder: Opt<String>,
) -> bool
pub fn add_fold( &self, buffer_id: u32, start: u32, end: u32, placeholder: Opt<String>, ) -> bool
Add a collapsed fold range. Hides bytes [start, end) from
rendering — the line containing start - 1 (the fold “header”)
stays visible, while subsequent lines covered by the range are
skipped.
Sourcepub fn clear_folds(&self, buffer_id: u32) -> bool
pub fn clear_folds(&self, buffer_id: u32) -> bool
Clear every collapsed fold range on the buffer.
Sourcepub fn set_folding_ranges<'js>(
&self,
_ctx: Ctx<'js>,
buffer_id: u32,
ranges_arr: Vec<Object<'js>>,
) -> Result<bool>
pub fn set_folding_ranges<'js>( &self, _ctx: Ctx<'js>, buffer_id: u32, ranges_arr: Vec<Object<'js>>, ) -> Result<bool>
Publish a set of toggleable fold ranges on the buffer. Same
shape an LSP foldingRange response would take. Unlike
addFold, this does not pre-collapse anything — the
standard fold-toggle keybinding finds the range under the
cursor and collapses or expands it on demand. Replacing call
replaces the prior set.
ranges is a JS array of objects shaped
{ startLine, endLine, kind? } (lines are 0-indexed).
kind is one of "comment", "imports", "region" per
the LSP spec; omitted/unknown values are accepted as plain
folds.
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 set_file_explorer_slots<'js>(
&self,
ctx: Ctx<'js>,
namespace: String,
slots: Vec<Object<'js>>,
) -> Result<bool>
pub fn set_file_explorer_slots<'js>( &self, ctx: Ctx<'js>, namespace: String, slots: Vec<Object<'js>>, ) -> Result<bool>
Set file explorer slot overrides for a namespace
Sourcepub fn clear_file_explorer_slots(&self, namespace: String) -> bool
pub fn clear_file_explorer_slots(&self, namespace: String) -> bool
Clear file explorer slot overrides 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 add_virtual_text_styled<'js>(
&self,
_ctx: Ctx<'js>,
buffer_id: u32,
virtual_text_id: String,
position: u32,
text: String,
options: Object<'js>,
before: bool,
) -> Result<bool>
pub fn add_virtual_text_styled<'js>( &self, _ctx: Ctx<'js>, buffer_id: u32, virtual_text_id: String, position: u32, text: String, options: Object<'js>, before: bool, ) -> Result<bool>
Add styled virtual text — richer form of addVirtualText whose
options accepts an addOverlay-style record: fg/bg may
be RGB arrays or theme-key strings, plus bold/italic. Theme
keys are resolved at render time so the label follows theme
changes live.
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<'js>(
&self,
_ctx: Ctx<'js>,
buffer_id: u32,
position: u32,
text: String,
options: Object<'js>,
above: bool,
namespace: String,
priority: i32,
) -> Result<bool>
pub fn add_virtual_line<'js>( &self, _ctx: Ctx<'js>, buffer_id: u32, position: u32, text: String, options: Object<'js>, above: bool, namespace: String, priority: i32, ) -> Result<bool>
Add a virtual line (full line above/below a position)
The options object accepts:
fg,bg— either an[r, g, b]array (each0..=255) or a theme-key string (e.g."editor.line_number_fg"). Theme keys are resolved at render time so the line follows theme changes. Both default tonull(no foreground / transparent background).gutterGlyph— optional single character (any short string) rendered in the line-number column on this virtual line’s first visual row. Use to mark e.g. a deletion line with “-” so the indicator sits next to the deleted content instead of on the following source line.gutterColor— color forgutterGlyph, same shape asfg/bg. Falls back to the theme’s line-number fg.
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,
floating_overlay: Opt<bool>,
) -> bool
pub fn start_prompt( &self, label: String, prompt_type: String, floating_overlay: Opt<bool>, ) -> bool
Start an interactive prompt.
When floatingOverlay is true, the editor renders the prompt
and its suggestions inside a centred floating frame instead of
the bottom minibuffer row (issue #1796 — Live Grep). The flag
is rendering-only; confirm/cancel/hooks behave identically to a
non-overlay prompt of the same promptType.
Sourcepub fn begin_key_capture(&self) -> bool
pub fn begin_key_capture(&self) -> bool
Begin a key-capture window for the calling plugin.
Pair with endKeyCapture() around any getNextKey() loop.
While capture is active, keys arriving between two
getNextKey() calls are buffered in-order rather than
falling through to the buffer / mode bindings, so fast typing,
pastes, or held-key auto-repeat are delivered losslessly.
Without this, a plugin’s input loop has a race where keys
typed while the plugin is mid-redraw can leak into the editor.
Sourcepub fn end_key_capture(&self) -> bool
pub fn end_key_capture(&self) -> bool
End the key-capture window and discard any unconsumed buffered
keys. Call from a finally block so capture is released even
if the plugin’s loop throws.
Sourcepub fn get_next_key_start(&self, _ctx: Ctx<'_>) -> u64
pub fn get_next_key_start(&self, _ctx: Ctx<'_>) -> u64
Wait for the next keypress and resolve with a KeyEventPayload.
While the returned promise is pending the editor consumes the
next key and resolves it; the key does not propagate to mode
bindings or other dispatch. Multiple in-flight requests across
plugins are FIFO. Designed for short input loops (flash labels,
vi find-char, replace-char) that would otherwise need to bind
every printable key in defineMode.
For lossless capture against fast typing or paste, wrap the
loop with beginKeyCapture() / endKeyCapture().
Sourcepub fn start_prompt_with_initial(
&self,
label: String,
prompt_type: String,
initial_value: String,
floating_overlay: Opt<bool>,
) -> bool
pub fn start_prompt_with_initial( &self, label: String, prompt_type: String, initial_value: String, floating_overlay: Opt<bool>, ) -> bool
Start a prompt with initial value. See startPrompt for the
meaning of floatingOverlay.
Sourcepub fn set_prompt_suggestions(
&self,
suggestions: Vec<Suggestion>,
selected_index: Opt<Option<u32>>,
) -> bool
pub fn set_prompt_suggestions( &self, suggestions: Vec<Suggestion>, selected_index: Opt<Option<u32>>, ) -> bool
Set suggestions for the current prompt
Uses typed Vec
pub fn set_prompt_input_sync(&self, sync: bool) -> bool
Sourcepub fn set_prompt_title(&self, title: Vec<StyledText>) -> bool
pub fn set_prompt_title(&self, title: Vec<StyledText>) -> bool
Set the title shown in the floating-overlay prompt’s frame
header (issue #1796) as styled segments. Each segment
carries optional Partial<OverlayOptions>, the same
styling primitive used by virtual text — plugins mark
keybinding hints with { fg: "ui.help_key_fg" },
separators with { fg: "ui.popup_border_fg" }, etc. Pass
an empty array to clear the title and fall back to the
prompt-type default. Has no visible effect on non-overlay
prompts.
Set the footer chrome row of the floating-overlay prompt’s
results pane. Plugins use this for hotkey-hint banners
(Orchestrator’s [n] new [d] dive [Esc] close row).
Empty array clears the footer. Has no visible effect on
non-overlay prompts.
Sourcepub fn set_prompt_status(&self, status: String) -> bool
pub fn set_prompt_status(&self, status: String) -> bool
Set the floating-overlay prompt’s input-row status text (right-aligned, left of the match count). Empty string clears it.
Sourcepub fn set_prompt_toolbar<'js>(
&self,
ctx: Ctx<'js>,
spec_obj: Value<'js>,
) -> Result<bool>
pub fn set_prompt_toolbar<'js>( &self, ctx: Ctx<'js>, spec_obj: Value<'js>, ) -> Result<bool>
Set the floating-overlay prompt’s toolbar as a WidgetSpec (real,
clickable Toggle/Button widgets rendered in the header band, in
place of the styled-text title). Pass null/undefined to clear it.
Sourcepub fn toggle_overlay_toolbar_widget(&self, key: String) -> bool
pub fn toggle_overlay_toolbar_widget(&self, key: String) -> bool
Toggle a floating-overlay toolbar control by its widget key. The host
owns the toggle’s checked state, flips it, and emits a widget_event
the plugin can listen for. Lets a plugin route its own Alt+… shortcut
through the same host path as a click / Space on the toggle.
Sourcepub fn set_prompt_selected_index(&self, index: u32) -> bool
pub fn set_prompt_selected_index(&self, index: u32) -> bool
Override the currently-highlighted suggestion row in the
open prompt. The editor clamps index to the suggestion
list’s bounds and the renderer scrolls it into view on
the next frame. No-op when no prompt is open or the
suggestion list is empty. Typical use: re-opening a
picker and pre-selecting the entry the user last acted on
(Orchestrator highlights the active session).
Sourcepub fn define_mode(
&self,
name: String,
bindings_arr: Vec<Vec<String>>,
read_only: Opt<bool>,
allow_text_input: Opt<bool>,
inherit_normal_bindings: Opt<bool>,
) -> bool
pub fn define_mode( &self, name: String, bindings_arr: Vec<Vec<String>>, read_only: Opt<bool>, allow_text_input: Opt<bool>, inherit_normal_bindings: 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 create_window(&self, root: String, label: String) -> bool
pub fn create_window(&self, root: String, label: String) -> bool
Create a new editor session rooted at root. root must be
an absolute path; relative paths are rejected by the editor
(logged, no session created). The new session’s id is
reported via the window_created hook payload — plugins
that need the id should listen for that event rather than
polling listWindows.
Returns false only when the IPC channel to the editor is
closed (editor is shutting down).
Sourcepub fn set_active_window(&self, id: u64) -> bool
pub fn set_active_window(&self, id: u64) -> bool
Make the session with id id the active one. No-op if
already active. Errors (id not found) are logged on the
editor side; the JS caller can verify by reading
activeWindow() after.
Sourcepub fn set_active_window_animated(&self, id: u64, from_edge: String) -> bool
pub fn set_active_window_animated(&self, id: u64, from_edge: String) -> bool
Switch the active window with a directional wipe on the
incoming content. from_edge: “top” | “bottom” | “left” |
“right”. See PluginCommand::SetActiveWindowAnimated.
Sourcepub fn set_window_cycle_order(&self, ids: Vec<i64>) -> bool
pub fn set_window_cycle_order(&self, ids: Vec<i64>) -> bool
Restrict (and order) the windows that Next/Prev Window cycle
through to ids, in this order. An empty array clears the
override (back to every window, by id). Non-open ids are skipped
at cycle time. See PluginCommand::SetWindowCycleOrder.
Sourcepub fn close_window(&self, id: u64) -> bool
pub fn close_window(&self, id: u64) -> bool
Close session id. Refuses to close the active session or
the base session (id 1). Logs and no-ops on failure.
Sourcepub fn prewarm_window(&self, id: u64) -> bool
pub fn prewarm_window(&self, id: u64) -> bool
Eagerly initialise an inactive session’s per-session state (file tree walk, ignore matcher, etc.) without diving. No-op for the active session or unknown id.
Sourcepub fn watch_path_start(
&self,
_ctx: Ctx<'_>,
path: String,
recursive: Opt<bool>,
) -> Result<u64>
pub fn watch_path_start( &self, _ctx: Ctx<'_>, path: String, recursive: Opt<bool>, ) -> Result<u64>
Register a notify-backed watch on path. Returns a
promise that resolves to a numeric handle (also passed
in subsequent path_changed event payloads). The promise
rejects on notify errors (path missing, kernel limit).
recursive defaults to false. Non-recursive watches
cover the path itself plus its direct children for
directories — see services/file_watcher.rs for the
rationale.
Sourcepub fn unwatch_path(&self, handle: u64) -> bool
pub fn unwatch_path(&self, handle: u64) -> bool
Drop a watcher by its handle. Unknown handles are silently ignored.
Sourcepub fn preview_window_in_rect(&self, id: u64) -> bool
pub fn preview_window_in_rect(&self, id: u64) -> bool
Tell the editor that the floating-overlay prompt’s
preview pane should render the entire split tree of
session id natively. 0 (or any unknown id) clears the
override and the preview falls back to the existing
path-based phantom-leaf renderer.
Orchestrator calls this on each prompt-selection-change so the right pane shows the highlighted session’s full editor UI live — splits, terminals, syntax highlighting, decorations — at native rendering cost.
Sourcepub fn clear_window_preview(&self) -> bool
pub fn clear_window_preview(&self) -> bool
Clear the session-preview override. Equivalent to
previewWindowInRect(0) but reads better at call sites.
Sourcepub fn list_windows<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
pub fn list_windows<'js>(&self, ctx: Ctx<'js>) -> Result<Value<'js>>
All editor sessions, sorted by id (creation order). Always non-empty (the base session is always present).
Sourcepub fn active_window(&self) -> u64
pub fn active_window(&self) -> u64
The currently active session id. Always present in
listWindows().
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_buffer_show_cursors(&self, buffer_id: u32, show: bool) -> bool
pub fn set_buffer_show_cursors(&self, buffer_id: u32, show: bool) -> bool
Toggle whether the editor draws a native caret in this buffer.
Buffer-group panel buffers default to show_cursors = false, which
also blocks all native movement actions in action_to_events. Plugins
that want native cursor motion in a panel (e.g. magit-style row
navigation) call this with true after createBufferGroup returns.
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 set_window_state<'js>(
&self,
ctx: Ctx<'js>,
key: String,
value: Value<'js>,
) -> bool
pub fn set_window_state<'js>( &self, ctx: Ctx<'js>, key: String, value: Value<'js>, ) -> bool
Set per-session state on the active session. Same
shape as setGlobalState (write-through to snapshot +
dispatched to editor; null/undefined deletes), but the
underlying storage lives on Session.plugin_state and
swaps with the rest of session state on setActiveWindow.
Plugins that genuinely want per-project state use this;
Orchestrator itself uses setGlobalState because its session
list lives above session boundaries.
Sourcepub fn get_window_state<'js>(
&self,
ctx: Ctx<'js>,
key: String,
) -> Result<Value<'js>>
pub fn get_window_state<'js>( &self, ctx: Ctx<'js>, key: String, ) -> Result<Value<'js>>
Get per-session state from the active session
(snapshot read). undefined if missing.
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
Contribute (or replace, or clear) menu rows for the LSP-Servers
popup. Pass an empty items to clear this plugin’s slice for
the given language. See PluginCommand::SetLspMenuContributions.
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 create_buffer_group_start(
&self,
_ctx: Ctx<'_>,
name: String,
mode: String,
layout_json: String,
) -> Result<u64>
pub fn create_buffer_group_start( &self, _ctx: Ctx<'_>, name: String, mode: String, layout_json: String, ) -> Result<u64>
Create a buffer group: multiple panels appearing as one tab
Sourcepub fn set_panel_content<'js>(
&self,
ctx: Ctx<'js>,
group_id: u32,
panel_name: String,
entries_arr: Vec<Object<'js>>,
) -> Result<bool>
pub fn set_panel_content<'js>( &self, ctx: Ctx<'js>, group_id: u32, panel_name: String, entries_arr: Vec<Object<'js>>, ) -> Result<bool>
Set the content of a panel within a buffer group
Sourcepub fn close_buffer_group(&self, group_id: u32) -> bool
pub fn close_buffer_group(&self, group_id: u32) -> bool
Close a buffer group
Sourcepub fn focus_buffer_group_panel(
&self,
group_id: u32,
panel_name: String,
) -> bool
pub fn focus_buffer_group_panel( &self, group_id: u32, panel_name: String, ) -> bool
Focus a specific panel within a buffer group
Sourcepub fn set_buffer_group_panel_buffer_start(
&self,
_ctx: Ctx<'_>,
group_id: u32,
panel_name: String,
buffer_id: u32,
) -> u64
pub fn set_buffer_group_panel_buffer_start( &self, _ctx: Ctx<'_>, group_id: u32, panel_name: String, buffer_id: u32, ) -> u64
Re-point a buffer-group’s panel at a different buffer id.
Streaming plugins (e.g. git-log) allocate one file-backed
buffer per item and call this on navigation to swap which
buffer the panel displays — instead of mutating a single
shared buffer’s contents. Resolves with true on success.
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 mount_widget_panel<'js>(
&self,
ctx: Ctx<'js>,
panel_id: f64,
buffer_id: u32,
spec_obj: Value<'js>,
) -> Result<bool>
pub fn mount_widget_panel<'js>( &self, ctx: Ctx<'js>, panel_id: f64, buffer_id: u32, spec_obj: Value<'js>, ) -> Result<bool>
Mount a declarative widget panel inside a virtual buffer.
spec is a WidgetSpec JSON tree (see fresh.d.ts for the
shape). The host renders the spec into the buffer; subsequent
updateWidgetPanel calls re-render the panel against the
previously-mounted spec.
Returns true on successful queue, false if the IPC channel is closed.
Sourcepub fn update_widget_panel<'js>(
&self,
ctx: Ctx<'js>,
panel_id: f64,
spec_obj: Value<'js>,
) -> Result<bool>
pub fn update_widget_panel<'js>( &self, ctx: Ctx<'js>, panel_id: f64, spec_obj: Value<'js>, ) -> Result<bool>
Replace the spec of a previously-mounted widget panel. No-op if the panel id was never mounted.
Sourcepub fn unmount_widget_panel(&self, panel_id: f64) -> bool
pub fn unmount_widget_panel(&self, panel_id: f64) -> bool
Unmount a previously-mounted widget panel. The plugin retains ownership of the underlying virtual buffer.
Sourcepub fn widget_command<'js>(
&self,
ctx: Ctx<'js>,
panel_id: f64,
action_obj: Value<'js>,
) -> Result<bool>
pub fn widget_command<'js>( &self, ctx: Ctx<'js>, panel_id: f64, action_obj: Value<'js>, ) -> Result<bool>
Route a keystroke / nav action to the panel’s focused widget.
action is a WidgetAction JSON object — see fresh.d.ts for
the shapes ({kind: "focusAdvance", delta: 1} etc.). Plugin’s
defineMode bindings dispatch into here for keys handled by
the widget layer; the host runtime acts on the panel’s
currently focused widget and fires widget_event as
appropriate.
Sourcepub fn widget_mutate<'js>(
&self,
ctx: Ctx<'js>,
panel_id: f64,
mutation_obj: Value<'js>,
) -> Result<bool>
pub fn widget_mutate<'js>( &self, ctx: Ctx<'js>, panel_id: f64, mutation_obj: Value<'js>, ) -> Result<bool>
Apply a targeted mutation to a mounted widget panel — the
IPC fast path. Use instead of updateWidgetPanel when the
model change touches a single widget; the host applies the
mutation in place without re-transmitting the full spec.
See WidgetMutation in fresh.d.ts for the shapes.
Sourcepub fn mount_floating_widget<'js>(
&self,
ctx: Ctx<'js>,
panel_id: f64,
spec_obj: Value<'js>,
width_pct: f64,
height_pct: f64,
as_dock: Opt<bool>,
) -> Result<bool>
pub fn mount_floating_widget<'js>( &self, ctx: Ctx<'js>, panel_id: f64, spec_obj: Value<'js>, width_pct: f64, height_pct: f64, as_dock: Opt<bool>, ) -> Result<bool>
Mount a declarative widget panel as a centered floating overlay (not bound to any virtual buffer).
Sourcepub fn update_floating_widget<'js>(
&self,
ctx: Ctx<'js>,
panel_id: f64,
spec_obj: Value<'js>,
) -> Result<bool>
pub fn update_floating_widget<'js>( &self, ctx: Ctx<'js>, panel_id: f64, spec_obj: Value<'js>, ) -> Result<bool>
Replace the spec of the currently-mounted floating widget panel.
Sourcepub fn unmount_floating_widget(&self, panel_id: f64) -> bool
pub fn unmount_floating_widget(&self, panel_id: f64) -> bool
Tear down the floating widget panel.
Sourcepub fn floating_panel_control(
&self,
panel_id: f64,
op: String,
arg: f64,
) -> bool
pub fn floating_panel_control( &self, panel_id: f64, op: String, arg: f64, ) -> bool
Control a mounted floating panel’s placement / focus without
re-sending its spec. op: “dock” (arg = width in columns),
“center”, “focus”, “blur”, “fullscreen” (arg != 0 makes a
centered panel cover the whole frame over the dock). See
PluginCommand::FloatingPanelControl.
Sourcepub fn spawn_process_start(
&self,
_ctx: Ctx<'_>,
command: String,
args: Vec<String>,
cwd: Opt<String>,
stdout_to: Opt<String>,
) -> u64
pub fn spawn_process_start( &self, _ctx: Ctx<'_>, command: String, args: Vec<String>, cwd: Opt<String>, stdout_to: Opt<String>, ) -> u64
Spawn a process (async, returns request_id)
Optional 4th argument stdoutTo: string pipes the child’s stdout
directly into the named file instead of buffering it. The
resolved SpawnResult.stdout is empty in that case; the bytes
land on disk for openFile to pick up as a file-backed buffer.
Sourcepub fn spawn_host_process_start(
&self,
_ctx: Ctx<'_>,
command: String,
args: Vec<String>,
cwd: Opt<String>,
) -> u64
pub fn spawn_host_process_start( &self, _ctx: Ctx<'_>, command: String, args: Vec<String>, cwd: Opt<String>, ) -> u64
Spawn a process on the host regardless of the active authority.
Intended for plugin internals that must run host-side work
(e.g. devcontainer up) before installing an authority that
would otherwise route the spawn elsewhere. Same calling shape
as spawnProcess.
Sourcepub fn kill_host_process(&self, process_id: u64) -> bool
pub fn kill_host_process(&self, process_id: u64) -> bool
Cancel a host-side process started via spawnHostProcess.
process_id is the callback id the JS wrapper stashed on the
handle. Returns false only when the command channel is dead
(editor tearing down). Unknown ids no-op on the editor side —
see PluginCommand::KillHostProcess in fresh-core/api.rs.
Exposed on the JS side as editor._killHostProcess; the
public API is handle.kill() from the spawnHostProcess
wrapper.
Install a new authority via an opaque payload.
The payload is a JS object describing filesystem + spawner +
terminal wrapper + display label. The canonical schema lives in
the AuthorityPayload type in fresh-editor; plugins should
hand-build objects that match it. Fire-and-forget: the editor
restarts as part of the transition, so the plugin is reloaded
before any follow-up work can run on this call’s return value.
Restore the default local authority. Same restart semantics as
setAuthority.
Sourcepub fn attach_remote_agent(&self, ctx: Ctx<'_>, payload: Value<'_>) -> u64
pub fn attach_remote_agent(&self, ctx: Ctx<'_>, payload: Value<'_>) -> u64
Attach to a remote agent that needs a live connection (an SSH host or a
kubectl exec agent in a Kubernetes pod). The connect is asynchronous —
the editor spawns the carrier, bootstraps the agent and builds the
session in the background — and this returns a promise that settles on
the real outcome:
- resolves once the session (authority + window) is fully constructed, so a caller can keep its dialog open until there is a real session to show;
- rejects with the failure reason (e.g. ssh “Could not resolve hostname”) if the connect or window creation fails — in which case no window is created and the editor stays on its current authority.
The payload schema (RemoteAgentSpec) lives in fresh-editor;
plugins hand-build an object matching it.
Sourcepub fn cancel_remote_agent(&self)
pub fn cancel_remote_agent(&self)
Cancel any in-flight attachRemoteAgent connect — the New-Session
dialog’s Cancel. The pending promise rejects with “cancelled” and the
background connect’s late result is discarded, so no window is built.
A no-op when nothing is connecting.
Sourcepub fn set_env(&self, snippet: String, dir: Option<String>)
pub fn set_env(&self, snippet: String, dir: Option<String>)
Activate an environment: set the live env recipe (snippet run in
dir). Applied to every spawn, re-evaluated on demand — no restart.
Honored only when the workspace is Trusted.
Sourcepub fn set_remote_indicator_state(&self, ctx: Ctx<'_>, state: Value<'_>) -> bool
pub fn set_remote_indicator_state(&self, ctx: Ctx<'_>, state: Value<'_>) -> bool
Override the Remote Indicator’s displayed state. Plugins call
this to surface lifecycle transitions that the authority layer
doesn’t know about yet — “Connecting” while devcontainer up
runs, “FailedAttach” after a non-zero exit, etc.
Accepts a tagged JS object:
editor.setRemoteIndicatorState({ kind: "connecting", label: "Building" });
editor.setRemoteIndicatorState({ kind: "failed_attach", error: "exit 1" });
editor.setRemoteIndicatorState({ kind: "connected", label: "Container:abc" });
editor.setRemoteIndicatorState({ kind: "local" });The override sticks until replaced or cleared via
clearRemoteIndicatorState. Editor restart (e.g. on
setAuthority) resets it — plugins must reassert after a
post-restart init if they want the override to persist.
Sourcepub fn clear_remote_indicator_state(&self)
pub fn clear_remote_indicator_state(&self)
Drop any active Remote Indicator override. Safe to call even
without a prior setRemoteIndicatorState.
Sourcepub fn http_fetch_start(
&self,
_ctx: Ctx<'_>,
url: String,
target_path: String,
) -> u64
pub fn http_fetch_start( &self, _ctx: Ctx<'_>, url: String, target_path: String, ) -> u64
Fetch a URL over HTTP(S) and stream the response body into target_path.
Resolves with a SpawnResult-shaped value: exit_code is 0 on a
2xx response (file written), the HTTP status code on non-2xx
(target file untouched), and -1 on transport errors. stderr
carries an error message in the non-success cases; stdout is
always empty.
This uses the editor’s built-in HTTP client (ureq), so plugins
don’t need curl/wget on PATH.
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 begin_search(
&self,
_ctx: Ctx<'_>,
pattern: String,
fixed_string: bool,
case_sensitive: bool,
max_results: u32,
whole_words: bool,
source_buffer_id: u32,
) -> u64
pub fn begin_search( &self, _ctx: Ctx<'_>, pattern: String, fixed_string: bool, case_sensitive: bool, max_results: u32, whole_words: bool, source_buffer_id: u32, ) -> u64
Begin a streaming project-wide search and return a SearchHandle.
The producer (host) writes matches at full speed into shared state;
the consumer drains via handle.take() at its own cadence. Call
handle.cancel() to abort.
Sourcepub fn search_handle_take<'js>(
&self,
ctx: Ctx<'js>,
handle_id: u64,
) -> Result<Value<'js>>
pub fn search_handle_take<'js>( &self, ctx: Ctx<'js>, handle_id: u64, ) -> Result<Value<'js>>
Drain pending matches for a search handle. Returns the matches that
have arrived since the previous call plus terminal-state flags.
After done is observed, the handle entry is removed from the
registry.
Sourcepub fn search_handle_cancel(&self, handle_id: u64)
pub fn search_handle_cancel(&self, handle_id: u64)
Cancel a streaming search. Idempotent and safe to call after the handle has been removed from the registry.
Sourcepub fn replace_in_file_start(
&self,
_ctx: Ctx<'_>,
file_path: String,
matches: Vec<Vec<u32>>,
replacement: String,
buffer_id: Opt<u32>,
) -> u64
pub fn replace_in_file_start( &self, _ctx: Ctx<'_>, file_path: String, matches: Vec<Vec<u32>>, replacement: String, buffer_id: Opt<u32>, ) -> 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 create_window_with_terminal_start(
&self,
_ctx: Ctx<'_>,
opts: CreateWindowWithTerminalOptions,
) -> Result<u64>
pub fn create_window_with_terminal_start( &self, _ctx: Ctx<'_>, opts: CreateWindowWithTerminalOptions, ) -> Result<u64>
Create a new editor window seeded with an agent terminal as
its only buffer. Atomic — replaces the legacy
createWindow + setActiveWindow + createTerminal
chain that left a transient [No Name] tab alongside the
agent terminal.
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 signal_window(&self, id: f64, signal: String) -> bool
pub fn signal_window(&self, id: f64, signal: String) -> bool
Send signal (“SIGTERM” / “SIGKILL” / “SIGINT” / “SIGHUP”)
to every process group the window id is tracking. The
window’s authority decides delivery; this is the
canonical entry point for “stop everything this window
owns” rather than reaching at the terminal level. Returns
false only when the command channel is closed.
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 !RefUnwindSafe for JsEditorApi
impl !Send for JsEditorApi
impl !Sync for JsEditorApi
impl !UnwindSafe for JsEditorApi
impl Freeze for JsEditorApi
impl Unpin for JsEditorApi
impl UnsafeUnpin 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