pub struct EditorAccess { /* private fields */ }Expand description
The concrete editor-capability handle. Clone-able (all fields are cheap handles), shared between agent tasks off the editor thread.
Implementations§
Source§impl EditorAccess
impl EditorAccess
pub fn new( cache: EditorStateHandle, buffer_store: Option<BufferStoreHandle>, workspace_folders: Vec<String>, writes: Option<InboundBus<EditorWriteRequest>>, ) -> Self
Sourcepub fn current_selection(&self) -> Option<SelectionInfo>
pub fn current_selection(&self) -> Option<SelectionInfo>
The active buffer’s path + selection + covered text, if any buffer
is active. None when nothing is active (the “nothing selected”
case — callers map this to their own empty-result shape).
Sourcepub fn open_editors(&self) -> Vec<OpenEditor>
pub fn open_editors(&self) -> Vec<OpenEditor>
The open file-editor buffers (skips synthetic / unsaved buffers with no path).
pub fn workspace_folders(&self) -> &[String]
Sourcepub fn document_dirty(&self, path: &str) -> bool
pub fn document_dirty(&self, path: &str) -> bool
Dirty flag for path. An unknown path (not open, or no buffer-store
service) is false, never an error.
Sourcepub async fn open_file(
&self,
path: PathBuf,
column: Option<Utf16Pos>,
) -> Result<()>
pub async fn open_file( &self, path: PathBuf, column: Option<Utf16Pos>, ) -> Result<()>
Open path, optionally forcing the cursor to column (a UTF-16
position; None opens without moving the cursor — re-opening an
already-open file keeps its position).
Sourcepub async fn save_document(&self, path: PathBuf) -> Result<()>
pub async fn save_document(&self, path: PathBuf) -> Result<()>
Save the document for path (only when it is the active buffer —
option C, the I3 limitation).
Sourcepub async fn close_tab(
&self,
origin_session: u64,
tab_name: String,
) -> Result<()>
pub async fn close_tab( &self, origin_session: u64, tab_name: String, ) -> Result<()>
Close the tab named tab_name, scoped to connection
origin_session — the host rejects that connection’s diff
session(s), falling back to the active-buffer file-close.
Sourcepub async fn close_session_diffs(&self, origin_session: u64) -> Result<()>
pub async fn close_session_diffs(&self, origin_session: u64) -> Result<()>
Reject every programmatic diff connection origin_session opened.
Trait Implementations§
Source§impl Clone for EditorAccess
impl Clone for EditorAccess
Source§fn clone(&self) -> EditorAccess
fn clone(&self) -> EditorAccess
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for EditorAccess
impl !UnwindSafe for EditorAccess
impl Freeze for EditorAccess
impl Send for EditorAccess
impl Sync for EditorAccess
impl Unpin for EditorAccess
impl UnsafeUnpin for EditorAccess
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more