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
This commit is contained in:
Mayank Verma
2025-11-23 17:35:43 +02:00
committed by GitHub
parent 06e03a41aa
commit 1f03fc62db
+14 -12
View File
@@ -23,7 +23,7 @@ use language::{
use lsp::DiagnosticSeverity; use lsp::DiagnosticSeverity;
use multi_buffer::MultiBufferOffset; use multi_buffer::MultiBufferOffset;
use project::{ use project::{
Project, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger, File, Project, ProjectItem as _, ProjectPath, lsp_store::FormatTrigger,
project_settings::ProjectSettings, search::SearchQuery, project_settings::ProjectSettings, search::SearchQuery,
}; };
use rpc::proto::{self, update_view}; use rpc::proto::{self, update_view};
@@ -645,18 +645,20 @@ impl Item for Editor {
} }
fn tab_tooltip_text(&self, cx: &App) -> Option<SharedString> { fn tab_tooltip_text(&self, cx: &App) -> Option<SharedString> {
let file_path = self self.buffer()
.buffer()
.read(cx) .read(cx)
.as_singleton()? .as_singleton()
.read(cx) .and_then(|buffer| buffer.read(cx).file())
.file() .and_then(|file| File::from_dyn(Some(file)))
.and_then(|f| f.as_local())? .map(|file| {
.abs_path(cx); file.worktree
.read(cx)
let file_path = file_path.compact().to_string_lossy().into_owned(); .absolutize(&file.path)
.compact()
Some(file_path.into()) .to_string_lossy()
.into_owned()
.into()
})
} }
fn telemetry_event_text(&self) -> Option<&'static str> { fn telemetry_event_text(&self) -> Option<&'static str> {