From 598954d39f9774921e7ec1f68a85d75ae0de9393 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Tue, 12 Jul 2022 17:49:14 -0700 Subject: [PATCH] Added a bit of documentation for the working directory calculation --- crates/terminal/src/terminal.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index b88725393f..ee39fb1f6a 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -426,6 +426,11 @@ impl Item for Terminal { } } +///Gets the intuitively correct working directory from the given workspace +///If there is an active entry for this project, returns that entry's worktree root. +///If there's no active entry but there is a worktree, returns that worktrees root. +///If either of these roots are files, or if there are any other query failures, +/// returns the user's home directory fn get_wd_for_workspace(workspace: &Workspace, cx: &AppContext) -> Option { let project = workspace.project().read(cx); @@ -435,19 +440,11 @@ fn get_wd_for_workspace(workspace: &Workspace, cx: &AppContext) -> Option