pub struct Workspace { /* private fields */ }Expand description
A collection of open buffers and their views.
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn view_count(&self) -> usize
pub fn view_count(&self) -> usize
Returns the number of open views.
Sourcepub fn active_view_id(&self) -> Option<ViewId>
pub fn active_view_id(&self) -> Option<ViewId>
Return the active view id (if any).
Sourcepub fn active_buffer_id(&self) -> Option<BufferId>
pub fn active_buffer_id(&self) -> Option<BufferId>
Return the active buffer id (if any).
Sourcepub fn intelligence(&self) -> &WorkspaceIntelligence
pub fn intelligence(&self) -> &WorkspaceIntelligence
Read workspace-scoped language intelligence result sets (references/call hierarchy/etc.).
Sourcepub fn intelligence_mut(&mut self) -> &mut WorkspaceIntelligence
pub fn intelligence_mut(&mut self) -> &mut WorkspaceIntelligence
Mutate workspace-scoped language intelligence result sets (references/call hierarchy/etc.).
Sourcepub fn set_active_view(&mut self, id: ViewId) -> Result<(), WorkspaceError>
pub fn set_active_view(&mut self, id: ViewId) -> Result<(), WorkspaceError>
Set the active view.
Sourcepub fn open_buffer(
&mut self,
uri: Option<String>,
text: &str,
viewport_width: usize,
) -> Result<OpenBufferResult, WorkspaceError>
pub fn open_buffer( &mut self, uri: Option<String>, text: &str, viewport_width: usize, ) -> Result<OpenBufferResult, WorkspaceError>
Open a new buffer in the workspace, creating an initial view.
uriis optional and host-provided (e.g.file:///...).textis the initial contents.viewport_widthis the initial view’s wrap width.
Sourcepub fn close_buffer(&mut self, id: BufferId) -> Result<(), WorkspaceError>
pub fn close_buffer(&mut self, id: BufferId) -> Result<(), WorkspaceError>
Close a buffer (and all its views).
Sourcepub fn close_view(&mut self, id: ViewId) -> Result<(), WorkspaceError>
pub fn close_view(&mut self, id: ViewId) -> Result<(), WorkspaceError>
Close a view. If it was the last view of its buffer, the buffer is also closed.
Sourcepub fn buffer_ids(&self) -> Vec<BufferId>
pub fn buffer_ids(&self) -> Vec<BufferId>
Return all open buffer ids in deterministic order.
Sourcepub fn create_view(
&mut self,
buffer: BufferId,
viewport_width: usize,
) -> Result<ViewId, WorkspaceError>
pub fn create_view( &mut self, buffer: BufferId, viewport_width: usize, ) -> Result<ViewId, WorkspaceError>
Create a new view into an existing buffer.
Sourcepub fn buffer_id_for_uri(&self, uri: &str) -> Option<BufferId>
pub fn buffer_id_for_uri(&self, uri: &str) -> Option<BufferId>
Look up a buffer by uri.
Sourcepub fn buffer_line_index(
&self,
buffer_id: BufferId,
) -> Result<&LineIndex, WorkspaceError>
pub fn buffer_line_index( &self, buffer_id: BufferId, ) -> Result<&LineIndex, WorkspaceError>
Get a reference to a buffer’s line index (logical line/column <-> char offsets).
Sourcepub fn buffer_char_count(
&self,
buffer_id: BufferId,
) -> Result<usize, WorkspaceError>
pub fn buffer_char_count( &self, buffer_id: BufferId, ) -> Result<usize, WorkspaceError>
Get the document length for a buffer in Unicode scalar values (Rust chars).
Sourcepub fn buffer_text_range(
&self,
buffer_id: BufferId,
start: usize,
len: usize,
) -> Result<String, WorkspaceError>
pub fn buffer_text_range( &self, buffer_id: BufferId, start: usize, len: usize, ) -> Result<String, WorkspaceError>
Get a slice of the buffer text as a String by character offset + length.
Notes:
startandlenare in Unicode scalar indices (Rustchars), not bytes.- Out-of-bounds ranges are clamped by the underlying text buffer.
Sourcepub fn buffer_decorations(
&self,
buffer_id: BufferId,
) -> Result<&BTreeMap<DecorationLayerId, Vec<Decoration>>, WorkspaceError>
pub fn buffer_decorations( &self, buffer_id: BufferId, ) -> Result<&BTreeMap<DecorationLayerId, Vec<Decoration>>, WorkspaceError>
Get all decoration layers for a buffer.
Sourcepub fn folding_regions_for_buffer(
&self,
buffer_id: BufferId,
) -> Result<Vec<FoldRegion>, WorkspaceError>
pub fn folding_regions_for_buffer( &self, buffer_id: BufferId, ) -> Result<Vec<FoldRegion>, WorkspaceError>
Get the current folding regions for a buffer (user folds + derived folds).
Sourcepub fn buffer_is_modified(
&self,
buffer_id: BufferId,
) -> Result<bool, WorkspaceError>
pub fn buffer_is_modified( &self, buffer_id: BufferId, ) -> Result<bool, WorkspaceError>
Returns whether a buffer has unsaved text edits.
Notes:
- This tracks the executor’s “clean point” (usually the last
mark_saved_*call), and is restored by undoing back to that clean point.
Sourcepub fn line_ending_for_buffer(
&self,
buffer_id: BufferId,
) -> Result<LineEnding, WorkspaceError>
pub fn line_ending_for_buffer( &self, buffer_id: BufferId, ) -> Result<LineEnding, WorkspaceError>
Return the preferred line ending for saving this buffer.
Sourcepub fn set_line_ending_for_buffer(
&mut self,
buffer_id: BufferId,
line_ending: LineEnding,
) -> Result<(), WorkspaceError>
pub fn set_line_ending_for_buffer( &mut self, buffer_id: BufferId, line_ending: LineEnding, ) -> Result<(), WorkspaceError>
Override the preferred line ending for saving this buffer.
Sourcepub fn is_modified_for_view(
&self,
view_id: ViewId,
) -> Result<bool, WorkspaceError>
pub fn is_modified_for_view( &self, view_id: ViewId, ) -> Result<bool, WorkspaceError>
Returns whether the view’s underlying buffer has unsaved text edits.
Sourcepub fn line_ending_for_view(
&self,
view_id: ViewId,
) -> Result<LineEnding, WorkspaceError>
pub fn line_ending_for_view( &self, view_id: ViewId, ) -> Result<LineEnding, WorkspaceError>
Return the preferred line ending for saving this view’s underlying buffer.
Sourcepub fn set_line_ending_for_view(
&mut self,
view_id: ViewId,
line_ending: LineEnding,
) -> Result<(), WorkspaceError>
pub fn set_line_ending_for_view( &mut self, view_id: ViewId, line_ending: LineEnding, ) -> Result<(), WorkspaceError>
Override the preferred line ending for saving this view’s underlying buffer.
Sourcepub fn mark_saved_for_buffer(
&mut self,
buffer_id: BufferId,
) -> Result<(), WorkspaceError>
pub fn mark_saved_for_buffer( &mut self, buffer_id: BufferId, ) -> Result<(), WorkspaceError>
Mark the current state of a buffer as saved (clean point).
Sourcepub fn mark_saved_for_view(
&mut self,
view_id: ViewId,
) -> Result<(), WorkspaceError>
pub fn mark_saved_for_view( &mut self, view_id: ViewId, ) -> Result<(), WorkspaceError>
Mark the current state of a view’s buffer as saved (clean point).
Sourcepub fn undo_history_snapshot_for_buffer(
&self,
buffer_id: BufferId,
) -> Result<UndoHistorySnapshot, WorkspaceError>
pub fn undo_history_snapshot_for_buffer( &self, buffer_id: BufferId, ) -> Result<UndoHistorySnapshot, WorkspaceError>
Capture a persistable snapshot of a buffer’s undo/redo history.
Sourcepub fn restore_undo_history_for_buffer(
&mut self,
buffer_id: BufferId,
snapshot: UndoHistorySnapshot,
) -> Result<(), WorkspaceUndoHistoryRestoreError>
pub fn restore_undo_history_for_buffer( &mut self, buffer_id: BufferId, snapshot: UndoHistorySnapshot, ) -> Result<(), WorkspaceUndoHistoryRestoreError>
Restore a buffer’s undo/redo history from a previously captured snapshot.
Notes:
- This does not modify the current buffer text.
- Callers should only restore a snapshot into the same text it was captured from.
Sourcepub fn buffer_metadata(&self, id: BufferId) -> Option<&BufferMetadata>
pub fn buffer_metadata(&self, id: BufferId) -> Option<&BufferMetadata>
Get a buffer’s metadata.
Sourcepub fn buffer_id_for_view(&self, id: ViewId) -> Result<BufferId, WorkspaceError>
pub fn buffer_id_for_view(&self, id: ViewId) -> Result<BufferId, WorkspaceError>
Get the buffer id that a view is pointing at.
Sourcepub fn cursor_position_for_view(
&self,
id: ViewId,
) -> Result<Position, WorkspaceError>
pub fn cursor_position_for_view( &self, id: ViewId, ) -> Result<Position, WorkspaceError>
Get the primary cursor position for a view.
Sourcepub fn selection_for_view(
&self,
id: ViewId,
) -> Result<Option<Selection>, WorkspaceError>
pub fn selection_for_view( &self, id: ViewId, ) -> Result<Option<Selection>, WorkspaceError>
Get the primary selection for a view (None means “empty selection / caret only”).
Sourcepub fn tab_width_for_view(&self, id: ViewId) -> Result<usize, WorkspaceError>
pub fn tab_width_for_view(&self, id: ViewId) -> Result<usize, WorkspaceError>
Get the current tab width setting for a view (in monospace cells).
Sourcepub fn viewport_width_for_view(
&self,
id: ViewId,
) -> Result<usize, WorkspaceError>
pub fn viewport_width_for_view( &self, id: ViewId, ) -> Result<usize, WorkspaceError>
Get the current viewport width setting for a view (in monospace cells).
Sourcepub fn wrap_mode_for_view(&self, id: ViewId) -> Result<WrapMode, WorkspaceError>
pub fn wrap_mode_for_view(&self, id: ViewId) -> Result<WrapMode, WorkspaceError>
Get the current soft wrap mode for a view.
Sourcepub fn wrap_indent_for_view(
&self,
id: ViewId,
) -> Result<WrapIndent, WorkspaceError>
pub fn wrap_indent_for_view( &self, id: ViewId, ) -> Result<WrapIndent, WorkspaceError>
Get the current wrapped-line indentation policy for a view.
Sourcepub fn tab_key_behavior_for_view(
&self,
id: ViewId,
) -> Result<TabKeyBehavior, WorkspaceError>
pub fn tab_key_behavior_for_view( &self, id: ViewId, ) -> Result<TabKeyBehavior, WorkspaceError>
Get the current tab key behavior for a view.
Sourcepub fn indentation_config_for_view(
&self,
id: ViewId,
) -> Result<IndentationConfig, WorkspaceError>
pub fn indentation_config_for_view( &self, id: ViewId, ) -> Result<IndentationConfig, WorkspaceError>
Get the current indentation configuration for a view.
Sourcepub fn auto_pairs_config_for_view(
&self,
id: ViewId,
) -> Result<AutoPairsConfig, WorkspaceError>
pub fn auto_pairs_config_for_view( &self, id: ViewId, ) -> Result<AutoPairsConfig, WorkspaceError>
Get the current auto-pairs configuration for a view.
Sourcepub fn cursor_state_for_view(
&self,
id: ViewId,
) -> Result<CursorState, WorkspaceError>
pub fn cursor_state_for_view( &self, id: ViewId, ) -> Result<CursorState, WorkspaceError>
Get a view’s normalized cursor/selection snapshot.
This matches the semantics of EditorStateManager::get_cursor_state, but for workspace views.
Sourcepub fn scroll_top_for_view(&self, id: ViewId) -> Result<usize, WorkspaceError>
pub fn scroll_top_for_view(&self, id: ViewId) -> Result<usize, WorkspaceError>
Get the scroll position (top visual row) for a view.
Sourcepub fn scroll_sub_row_offset_for_view(
&self,
id: ViewId,
) -> Result<u16, WorkspaceError>
pub fn scroll_sub_row_offset_for_view( &self, id: ViewId, ) -> Result<u16, WorkspaceError>
Get the sub-row smooth-scroll offset for a view.
Sourcepub fn overscan_rows_for_view(
&self,
id: ViewId,
) -> Result<usize, WorkspaceError>
pub fn overscan_rows_for_view( &self, id: ViewId, ) -> Result<usize, WorkspaceError>
Get overscan rows for a view.
Sourcepub fn smooth_scroll_state_for_view(
&self,
id: ViewId,
) -> Result<ViewSmoothScrollState, WorkspaceError>
pub fn smooth_scroll_state_for_view( &self, id: ViewId, ) -> Result<ViewSmoothScrollState, WorkspaceError>
Get smooth-scroll state for a view.
Sourcepub fn set_buffer_uri(
&mut self,
id: BufferId,
uri: Option<String>,
) -> Result<(), WorkspaceError>
pub fn set_buffer_uri( &mut self, id: BufferId, uri: Option<String>, ) -> Result<(), WorkspaceError>
Update a buffer’s uri/path.
Sourcepub fn view_version(&self, id: ViewId) -> Option<u64>
pub fn view_version(&self, id: ViewId) -> Option<u64>
Get a view’s current version (increments on view-local changes and buffer changes).
Sourcepub fn last_text_delta_for_view(&self, id: ViewId) -> Option<&Arc<TextDelta>>
pub fn last_text_delta_for_view(&self, id: ViewId) -> Option<&Arc<TextDelta>>
Get the last broadcast text delta for this view (if any).
Sourcepub fn take_last_text_delta_for_view(
&mut self,
id: ViewId,
) -> Option<Arc<TextDelta>>
pub fn take_last_text_delta_for_view( &mut self, id: ViewId, ) -> Option<Arc<TextDelta>>
Take the last broadcast text delta for this view (if any).
Sourcepub fn take_last_text_delta_for_buffer(
&mut self,
id: BufferId,
) -> Result<Option<Arc<TextDelta>>, WorkspaceError>
pub fn take_last_text_delta_for_buffer( &mut self, id: BufferId, ) -> Result<Option<Arc<TextDelta>>, WorkspaceError>
Take the last text delta for a buffer (if any).
This is useful for incremental consumers (e.g. LSP sync) that want to observe each buffer edit exactly once, regardless of how many views exist for that buffer.
Sourcepub fn subscribe_view<F>(
&mut self,
id: ViewId,
callback: F,
) -> Result<(), WorkspaceError>
pub fn subscribe_view<F>( &mut self, id: ViewId, callback: F, ) -> Result<(), WorkspaceError>
Subscribe to changes for a view.
Sourcepub fn execute(
&mut self,
view_id: ViewId,
command: Command,
) -> Result<CommandResult, WorkspaceError>
pub fn execute( &mut self, view_id: ViewId, command: Command, ) -> Result<CommandResult, WorkspaceError>
Execute a command against a specific view.
- Cursor/selection state is view-local.
- Text edits and derived-state edits are applied to the underlying buffer.
- Any text delta is broadcast to all views of that buffer.
Sourcepub fn has_active_snippet_session(
&self,
view_id: ViewId,
) -> Result<bool, WorkspaceError>
pub fn has_active_snippet_session( &self, view_id: ViewId, ) -> Result<bool, WorkspaceError>
Return true if the given view currently has an active snippet session.
Snippet sessions are created by snippet inserts (for example LSP completion items with
insertTextFormat == 2) and allow tab/shift-tab navigation between placeholders.
Sourcepub fn toggle_bookmark_at_cursor_line(
&mut self,
view_id: ViewId,
) -> Result<bool, WorkspaceError>
pub fn toggle_bookmark_at_cursor_line( &mut self, view_id: ViewId, ) -> Result<bool, WorkspaceError>
Toggle a bookmark at the current cursor line for the given view.
Returns true if a bookmark was added, or false if an existing bookmark on that line was
removed.
Sourcepub fn bookmark_lines(
&self,
buffer_id: BufferId,
) -> Result<Vec<usize>, WorkspaceError>
pub fn bookmark_lines( &self, buffer_id: BufferId, ) -> Result<Vec<usize>, WorkspaceError>
Return all bookmark line numbers (0-based) for a buffer.
Sourcepub fn clear_bookmarks(
&mut self,
buffer_id: BufferId,
) -> Result<(), WorkspaceError>
pub fn clear_bookmarks( &mut self, buffer_id: BufferId, ) -> Result<(), WorkspaceError>
Clear all bookmarks for a buffer.
Sourcepub fn goto_next_bookmark(
&mut self,
view_id: ViewId,
) -> Result<Option<Position>, WorkspaceError>
pub fn goto_next_bookmark( &mut self, view_id: ViewId, ) -> Result<Option<Position>, WorkspaceError>
Move the cursor to the next bookmark (wrapping to the first bookmark).
Returns the new cursor position, or None if there are no bookmarks.
Sourcepub fn goto_prev_bookmark(
&mut self,
view_id: ViewId,
) -> Result<Option<Position>, WorkspaceError>
pub fn goto_prev_bookmark( &mut self, view_id: ViewId, ) -> Result<Option<Position>, WorkspaceError>
Move the cursor to the previous bookmark (wrapping to the last bookmark).
Returns the new cursor position, or None if there are no bookmarks.
Sourcepub fn set_mark_at_cursor(
&mut self,
view_id: ViewId,
name: String,
) -> Result<(), WorkspaceError>
pub fn set_mark_at_cursor( &mut self, view_id: ViewId, name: String, ) -> Result<(), WorkspaceError>
Set (or replace) a named mark at the current cursor position of the given view.
Sourcepub fn goto_mark(
&mut self,
view_id: ViewId,
name: &str,
) -> Result<Option<Position>, WorkspaceError>
pub fn goto_mark( &mut self, view_id: ViewId, name: &str, ) -> Result<Option<Position>, WorkspaceError>
Move the cursor to a named mark (if present).
Returns the new cursor position, or None if the mark does not exist.
Sourcepub fn clear_mark(
&mut self,
buffer_id: BufferId,
name: &str,
) -> Result<bool, WorkspaceError>
pub fn clear_mark( &mut self, buffer_id: BufferId, name: &str, ) -> Result<bool, WorkspaceError>
Remove a named mark from a buffer.
Returns true if the mark existed.
Sourcepub fn mark_names(
&self,
buffer_id: BufferId,
) -> Result<Vec<String>, WorkspaceError>
pub fn mark_names( &self, buffer_id: BufferId, ) -> Result<Vec<String>, WorkspaceError>
Return all mark names for a buffer (deterministic order).
Sourcepub fn clear_all_marks(
&mut self,
buffer_id: BufferId,
) -> Result<(), WorkspaceError>
pub fn clear_all_marks( &mut self, buffer_id: BufferId, ) -> Result<(), WorkspaceError>
Clear all marks for a buffer.
Sourcepub fn push_jump_location(
&mut self,
view_id: ViewId,
) -> Result<(), WorkspaceError>
pub fn push_jump_location( &mut self, view_id: ViewId, ) -> Result<(), WorkspaceError>
Record the current cursor position as a jump-list location for a view.
Typical usage: call this before performing a “jump” (go-to-definition, search result, symbol navigation, …).
Sourcepub fn jump_back(
&mut self,
view_id: ViewId,
) -> Result<Option<JumpTarget>, WorkspaceError>
pub fn jump_back( &mut self, view_id: ViewId, ) -> Result<Option<JumpTarget>, WorkspaceError>
Jump back in the view’s jump list.
Returns the navigation target (including the buffer id). If the target belongs to the current view’s buffer, this method also moves the cursor and clears selection.
Sourcepub fn jump_forward(
&mut self,
view_id: ViewId,
) -> Result<Option<JumpTarget>, WorkspaceError>
pub fn jump_forward( &mut self, view_id: ViewId, ) -> Result<Option<JumpTarget>, WorkspaceError>
Jump forward in the view’s jump list.
Returns the navigation target (including the buffer id). If the target belongs to the current view’s buffer, this method also moves the cursor and clears selection.
Sourcepub fn clear_jump_list(&mut self, view_id: ViewId) -> Result<(), WorkspaceError>
pub fn clear_jump_list(&mut self, view_id: ViewId) -> Result<(), WorkspaceError>
Clear the jump list (both back/forward stacks) for a view.
Sourcepub fn apply_jump_target(
&mut self,
view_id: ViewId,
target: JumpTarget,
) -> Result<(), WorkspaceError>
pub fn apply_jump_target( &mut self, view_id: ViewId, target: JumpTarget, ) -> Result<(), WorkspaceError>
Apply a previously produced JumpTarget to a view (moves the cursor and clears
selection).
Sourcepub fn set_viewport_height(
&mut self,
view_id: ViewId,
height: usize,
) -> Result<(), WorkspaceError>
pub fn set_viewport_height( &mut self, view_id: ViewId, height: usize, ) -> Result<(), WorkspaceError>
Set the viewport height for a view (used for ViewportState calculations).
Sourcepub fn set_scroll_top(
&mut self,
view_id: ViewId,
scroll_top: usize,
) -> Result<(), WorkspaceError>
pub fn set_scroll_top( &mut self, view_id: ViewId, scroll_top: usize, ) -> Result<(), WorkspaceError>
Set the scroll position (top visual row) for a view.
Sourcepub fn set_scroll_sub_row_offset(
&mut self,
view_id: ViewId,
sub_row_offset: u16,
) -> Result<(), WorkspaceError>
pub fn set_scroll_sub_row_offset( &mut self, view_id: ViewId, sub_row_offset: u16, ) -> Result<(), WorkspaceError>
Set sub-row smooth-scroll offset for a view.
Sourcepub fn set_overscan_rows(
&mut self,
view_id: ViewId,
overscan_rows: usize,
) -> Result<(), WorkspaceError>
pub fn set_overscan_rows( &mut self, view_id: ViewId, overscan_rows: usize, ) -> Result<(), WorkspaceError>
Set overscan rows for a view.
Sourcepub fn set_smooth_scroll_state(
&mut self,
view_id: ViewId,
state: ViewSmoothScrollState,
) -> Result<(), WorkspaceError>
pub fn set_smooth_scroll_state( &mut self, view_id: ViewId, state: ViewSmoothScrollState, ) -> Result<(), WorkspaceError>
Set smooth-scroll state for a view.
Sourcepub fn viewport_state_for_view(
&mut self,
view_id: ViewId,
) -> Result<WorkspaceViewportState, WorkspaceError>
pub fn viewport_state_for_view( &mut self, view_id: ViewId, ) -> Result<WorkspaceViewportState, WorkspaceError>
Get viewport state for a view, including total visual lines and overscan prefetch range.
Sourcepub fn total_visual_lines_for_view(
&mut self,
view_id: ViewId,
) -> Result<usize, WorkspaceError>
pub fn total_visual_lines_for_view( &mut self, view_id: ViewId, ) -> Result<usize, WorkspaceError>
Get total visual lines for a view (wrap + folding aware).
Sourcepub fn visual_to_logical_for_view(
&mut self,
view_id: ViewId,
visual_row: usize,
) -> Result<(usize, usize), WorkspaceError>
pub fn visual_to_logical_for_view( &mut self, view_id: ViewId, visual_row: usize, ) -> Result<(usize, usize), WorkspaceError>
Map global visual row to (logical_line, visual_in_logical) for a view.
Sourcepub fn logical_to_visual_for_view(
&mut self,
view_id: ViewId,
line: usize,
column: usize,
) -> Result<Option<(usize, usize)>, WorkspaceError>
pub fn logical_to_visual_for_view( &mut self, view_id: ViewId, line: usize, column: usize, ) -> Result<Option<(usize, usize)>, WorkspaceError>
Map logical position to global visual (row, x_cells) for a view.
Sourcepub fn visual_position_to_logical_for_view(
&mut self,
view_id: ViewId,
visual_row: usize,
x_cells: usize,
) -> Result<Option<Position>, WorkspaceError>
pub fn visual_position_to_logical_for_view( &mut self, view_id: ViewId, visual_row: usize, x_cells: usize, ) -> Result<Option<Position>, WorkspaceError>
Map visual (row, x_cells) back to logical position for a view.
Sourcepub fn buffer_text(&self, buffer_id: BufferId) -> Result<String, WorkspaceError>
pub fn buffer_text(&self, buffer_id: BufferId) -> Result<String, WorkspaceError>
Get the full document text for a buffer.
Sourcepub fn buffer_text_for_saving(
&self,
buffer_id: BufferId,
) -> Result<String, WorkspaceError>
pub fn buffer_text_for_saving( &self, buffer_id: BufferId, ) -> Result<String, WorkspaceError>
Get the full document text converted to the buffer’s preferred line ending for saving.
Sourcepub fn text_for_saving_for_view(
&self,
view_id: ViewId,
) -> Result<String, WorkspaceError>
pub fn text_for_saving_for_view( &self, view_id: ViewId, ) -> Result<String, WorkspaceError>
Get the full document text converted to the view’s preferred line ending for saving.
Sourcepub fn get_viewport_content_styled(
&mut self,
view_id: ViewId,
start_visual_row: usize,
count: usize,
) -> Result<HeadlessGrid, WorkspaceError>
pub fn get_viewport_content_styled( &mut self, view_id: ViewId, start_visual_row: usize, count: usize, ) -> Result<HeadlessGrid, WorkspaceError>
Get styled viewport content for a view (by visual line).
Sourcepub fn get_minimap_content(
&mut self,
view_id: ViewId,
start_visual_row: usize,
count: usize,
) -> Result<MinimapGrid, WorkspaceError>
pub fn get_minimap_content( &mut self, view_id: ViewId, start_visual_row: usize, count: usize, ) -> Result<MinimapGrid, WorkspaceError>
Get lightweight minimap content for a view (by visual line).
Sourcepub fn get_viewport_content_composed(
&mut self,
view_id: ViewId,
start_visual_row: usize,
count: usize,
) -> Result<ComposedGrid, WorkspaceError>
pub fn get_viewport_content_composed( &mut self, view_id: ViewId, start_visual_row: usize, count: usize, ) -> Result<ComposedGrid, WorkspaceError>
Get a decoration-aware composed viewport snapshot for a view (by composed visual line).
This snapshot can include virtual text (inlay hints, code lens) injected from the buffer’s
decoration layers. See crate::EditorCore::get_headless_grid_composed for details.
Sourcepub fn apply_processing_edits<I>(
&mut self,
buffer_id: BufferId,
edits: I,
) -> Result<(), WorkspaceError>where
I: IntoIterator<Item = ProcessingEdit>,
pub fn apply_processing_edits<I>(
&mut self,
buffer_id: BufferId,
edits: I,
) -> Result<(), WorkspaceError>where
I: IntoIterator<Item = ProcessingEdit>,
Apply derived-state edits to a buffer and broadcast them to all views of that buffer.
Sourcepub fn search_all_open_buffers(
&self,
query: &str,
options: SearchOptions,
) -> Result<Vec<WorkspaceSearchResult>, SearchError>
pub fn search_all_open_buffers( &self, query: &str, options: SearchOptions, ) -> Result<Vec<WorkspaceSearchResult>, SearchError>
Search across all open buffers in the workspace.
- This is purely in-memory (no file I/O).
- Match ranges are returned as character offsets (half-open).
Sourcepub fn apply_text_edits<I>(
&mut self,
edits: I,
) -> Result<Vec<(BufferId, usize)>, WorkspaceError>
pub fn apply_text_edits<I>( &mut self, edits: I, ) -> Result<Vec<(BufferId, usize)>, WorkspaceError>
Apply a set of text edits to multiple open buffers.
- This is purely in-memory (no file I/O).
- Edits are applied as a single undoable step per buffer.
- Buffers are applied in deterministic
BufferIdorder.