Skip to main content

Workspace

Trait Workspace 

Source
pub trait Workspace:
    Send
    + Sync
    + Debug {
    // Required methods
    fn environment<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<EnvironmentInfo, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn metadata(&self) -> WorkspaceMetadata;
    fn invalidate_environment_cache<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn list_files<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: Option<&'life1 str>,
        max_results: Option<usize>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn working_directory(&self) -> &Path;
    fn read_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: ReadFileRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<FileContentResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn list_directory<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: ListDirectoryRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<FileListResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn glob<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: GlobRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<GlobResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn grep<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: GrepRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<SearchResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn astgrep<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: AstGrepRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<SearchResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn apply_edits<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: ApplyEditsRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<EditResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn write_file<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: WriteFileRequest,
        ctx: &'life1 WorkspaceOpContext,
    ) -> Pin<Box<dyn Future<Output = Result<EditResult, WorkspaceError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Core workspace abstraction for environment information and file operations

Required Methods§

Source

fn environment<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<EnvironmentInfo, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get environment information for this workspace

Source

fn metadata(&self) -> WorkspaceMetadata

Get workspace metadata

Source

fn invalidate_environment_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Invalidate cached environment information (force refresh on next call)

Source

fn list_files<'life0, 'life1, 'async_trait>( &'life0 self, query: Option<&'life1 str>, max_results: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

List files in the workspace for fuzzy finding Returns workspace-relative paths, filtered by optional query

Source

fn working_directory(&self) -> &Path

Get the working directory for this workspace

Source

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, request: ReadFileRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<FileContentResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Read file contents with optional offset/limit.

Source

fn list_directory<'life0, 'life1, 'async_trait>( &'life0 self, request: ListDirectoryRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<FileListResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

List a directory (similar to ls).

Source

fn glob<'life0, 'life1, 'async_trait>( &'life0 self, request: GlobRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<GlobResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Apply glob patterns.

Source

fn grep<'life0, 'life1, 'async_trait>( &'life0 self, request: GrepRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Text search (grep-style).

Source

fn astgrep<'life0, 'life1, 'async_trait>( &'life0 self, request: AstGrepRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

AST search (astgrep-style).

Source

fn apply_edits<'life0, 'life1, 'async_trait>( &'life0 self, request: ApplyEditsRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<EditResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Apply one or more edits to a file.

Source

fn write_file<'life0, 'life1, 'async_trait>( &'life0 self, request: WriteFileRequest, ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<EditResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Write/replace entire file content.

Implementations on Foreign Types§

Source§

impl Workspace for RemoteWorkspace

Source§

fn environment<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<EnvironmentInfo, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn metadata(&self) -> WorkspaceMetadata

Source§

fn invalidate_environment_cache<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where 'life0: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn list_files<'life0, 'life1, 'async_trait>( &'life0 self, query: Option<&'life1 str>, max_results: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn working_directory(&self) -> &Path

Source§

fn read_file<'life0, 'life1, 'async_trait>( &'life0 self, request: ReadFileRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<FileContentResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn list_directory<'life0, 'life1, 'async_trait>( &'life0 self, request: ListDirectoryRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<FileListResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn glob<'life0, 'life1, 'async_trait>( &'life0 self, request: GlobRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<GlobResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn grep<'life0, 'life1, 'async_trait>( &'life0 self, request: GrepRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn astgrep<'life0, 'life1, 'async_trait>( &'life0 self, request: AstGrepRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<SearchResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn apply_edits<'life0, 'life1, 'async_trait>( &'life0 self, request: ApplyEditsRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<EditResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Source§

fn write_file<'life0, 'life1, 'async_trait>( &'life0 self, request: WriteFileRequest, _ctx: &'life1 WorkspaceOpContext, ) -> Pin<Box<dyn Future<Output = Result<EditResult, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, RemoteWorkspace: 'async_trait,

Implementors§