diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 5bb8af3f389d9787a55734727e15c8310c3b99fa..b3255df812a80736ffed7b9ebdc32239a3414167 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -1915,7 +1915,9 @@ impl Project { return; } - let uri = lsp::Url::from_file_path(file.abs_path(cx)).unwrap(); + let abs_path = file.abs_path(cx); + let uri = lsp::Url::from_file_path(&abs_path) + .unwrap_or_else(|()| panic!("Failed to register file {abs_path:?}")); let initial_snapshot = buffer.text_snapshot(); let language = buffer.language().cloned(); let worktree_id = file.worktree_id(cx); diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs index 476ff49a57efae8dc2f8838ef26b9de3a9828d9e..49f334b2d9d785a342321d4afac723fd3d76ca3c 100644 --- a/crates/terminal_view/src/terminal_view.rs +++ b/crates/terminal_view/src/terminal_view.rs @@ -180,18 +180,28 @@ impl TerminalView { .expect("infallible"); let maybe_path = path_like.path_like; workspace.update(cx, |workspace, cx| { - if false { //&& workspace.contains_path() { - // TODO kb - } else if maybe_path.exists() { - let visible = maybe_path.is_dir(); + let potential_abs_paths = if maybe_path.is_absolute() { + vec![maybe_path] + } else { workspace - .open_abs_path(maybe_path, visible, cx) - .detach_and_log_err(cx); + .worktrees(cx) + .map(|worktree| worktree.read(cx).abs_path().join(&maybe_path)) + .collect() + }; + + for path in potential_abs_paths { + if path.exists() { + let visible = path.is_dir(); + workspace + .open_abs_path(path, visible, cx) + .detach_and_log_err(cx); + break; + } } }); } - // TODO kb let terminal know if we cannot open the string + // TODO kb let terminal know if we cannot open the string + remove the error message when folder open returns None } _ => cx.emit(event.clone()), })