Skip to content

Commit 1f03fc6

Browse files
authored
editor: Fix tab tooltips not showing file path for remote files (#43359)
Closes #42344 Release Notes: - Fixed editor tab tooltips not showing file path for remote files Here's the before/after, tested both local and remote: https://github.com/user-attachments/assets/2768a0f8-e35b-4eff-aa95-d0decb51ec78
1 parent 06e03a4 commit 1f03fc6

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

crates/editor/src/items.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use language::{
2323
use lsp::DiagnosticSeverity;
2424
use multi_buffer::MultiBufferOffset;
2525
use project::{
26-
Project, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger,
26+
File, Project, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger,
2727
project_settings::ProjectSettings, search::SearchQuery,
2828
};
2929
use rpc::proto::{self, update_view};
@@ -645,18 +645,20 @@ impl Item for Editor {
645645
}
646646

647647
fn tab_tooltip_text(&self, cx: &App) -> Option<SharedString> {
648-
let file_path = self
649-
.buffer()
650-
.read(cx)
651-
.as_singleton()?
648+
self.buffer()
652649
.read(cx)
653-
.file()
654-
.and_then(|f| f.as_local())?
655-
.abs_path(cx);
656-
657-
let file_path = file_path.compact().to_string_lossy().into_owned();
658-
659-
Some(file_path.into())
650+
.as_singleton()
651+
.and_then(|buffer| buffer.read(cx).file())
652+
.and_then(|file| File::from_dyn(Some(file)))
653+
.map(|file| {
654+
file.worktree
655+
.read(cx)
656+
.absolutize(&file.path)
657+
.compact()
658+
.to_string_lossy()
659+
.into_owned()
660+
.into()
661+
})
660662
}
661663

662664
fn telemetry_event_text(&self) -> Option<&'static str> {

0 commit comments

Comments
 (0)