struct graph
This commit is contained in:
@@ -73,6 +73,27 @@ async fn open_workspace(
|
||||
.await
|
||||
}
|
||||
#[tauri::command]
|
||||
async fn close_workspace(root: PathBuf, state: State<'_, AppState>) -> Result<(), String> {
|
||||
let state = state.inner().clone();
|
||||
blocking(move || {
|
||||
let _lifecycle = state.lifecycle.lock().unwrap();
|
||||
let mut workspace = state.workspace.lock().unwrap();
|
||||
if workspace.as_ref().is_none_or(|w| w.root != root) {
|
||||
return Err("Workspace changed.".into());
|
||||
}
|
||||
state.search_generation.fetch_add(1, Ordering::Relaxed);
|
||||
state.explanations.invalidate(true);
|
||||
if let Some(server) = state.analysis.lock().unwrap().take() {
|
||||
server.stop();
|
||||
}
|
||||
*workspace = None;
|
||||
*state.analysis_status.lock().unwrap() =
|
||||
AnalysisStatus::unavailable("Open a project to start analysis.");
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
}
|
||||
#[tauri::command]
|
||||
async fn list_directory(path: String, state: State<'_, AppState>) -> Result<Vec<Entry>, String> {
|
||||
let workspace = state.current()?;
|
||||
blocking(move || workspace.list(&path)).await
|
||||
@@ -322,6 +343,7 @@ fn main() {
|
||||
remove_recent,
|
||||
inspect_workspace,
|
||||
open_workspace,
|
||||
close_workspace,
|
||||
list_directory,
|
||||
read_file,
|
||||
remember_file,
|
||||
|
||||
Reference in New Issue
Block a user