When hovering paths in terminal, search worktree entries for relative ones only (#29406)
Follow-up of https://github.com/zed-industries/zed/pull/29274 Release Notes: - N/A
This commit is contained in:
parent
93862838bd
commit
49003d8038
1 changed files with 16 additions and 14 deletions
|
@ -1100,7 +1100,7 @@ fn possible_open_target(
|
||||||
|
|
||||||
for path_with_position in &potential_paths {
|
for path_with_position in &potential_paths {
|
||||||
let path_to_check = if worktree_root.ends_with(&path_with_position.path) {
|
let path_to_check = if worktree_root.ends_with(&path_with_position.path) {
|
||||||
let root_path_with_posiition = PathWithPosition {
|
let root_path_with_position = PathWithPosition {
|
||||||
path: worktree_root.to_path_buf(),
|
path: worktree_root.to_path_buf(),
|
||||||
row: path_with_position.row,
|
row: path_with_position.row,
|
||||||
column: path_with_position.column,
|
column: path_with_position.column,
|
||||||
|
@ -1108,11 +1108,11 @@ fn possible_open_target(
|
||||||
match worktree.read(cx).root_entry() {
|
match worktree.read(cx).root_entry() {
|
||||||
Some(root_entry) => {
|
Some(root_entry) => {
|
||||||
return Task::ready(Some(OpenTarget::Worktree(
|
return Task::ready(Some(OpenTarget::Worktree(
|
||||||
root_path_with_posiition,
|
root_path_with_position,
|
||||||
root_entry.clone(),
|
root_entry.clone(),
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
None => root_path_with_posiition,
|
None => root_path_with_position,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PathWithPosition {
|
PathWithPosition {
|
||||||
|
@ -1126,6 +1126,7 @@ fn possible_open_target(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if path_to_check.path.is_relative() {
|
||||||
if let Some(entry) = worktree.read(cx).entry_for_path(&path_to_check.path) {
|
if let Some(entry) = worktree.read(cx).entry_for_path(&path_to_check.path) {
|
||||||
return Task::ready(Some(OpenTarget::Worktree(
|
return Task::ready(Some(OpenTarget::Worktree(
|
||||||
PathWithPosition {
|
PathWithPosition {
|
||||||
|
@ -1135,11 +1136,12 @@ fn possible_open_target(
|
||||||
},
|
},
|
||||||
entry.clone(),
|
entry.clone(),
|
||||||
)));
|
)));
|
||||||
} else {
|
|
||||||
paths_to_check.push(path_to_check);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paths_to_check.push(path_to_check);
|
||||||
|
}
|
||||||
|
|
||||||
if !paths_to_check.is_empty() {
|
if !paths_to_check.is_empty() {
|
||||||
worktree_paths_to_check.push((worktree.clone(), paths_to_check));
|
worktree_paths_to_check.push((worktree.clone(), paths_to_check));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue