Tab Name Disambiguation

In languages that have rich module systems, you’ll end up with the same filename reused across multiple directories. For example, in Rust every module might have a mod.rs file. As another example, in Python every module will have an __init__.py file. If you open more than one of these identically named files a time, it becomes ambiguous what tab corresponds to what file. As shown in the screenshot:

Maybe builder should disambiguate the filenames in some way? Here’s how VS Code handles it:

Possible solutions:

  • Show project-relative full paths, so the tab title would be /src/page/language/mod.rs
  • Show the immediate parent directory. Doesn’t cover all usecases but is an easy solution that helps a lot of the time. So the tab title would be language/mod.rs
  • Have some algorithm to intelligently disambiguate based on the exact collection of tabs visible. This is VS Code’s behavior, so the exact algorithm to decide which chunks of path to show should be copied from them:
    • If only src/a/mod.rs is open, then the tab title would be mod.rs
    • If src/a/mod.rs and src/b/mod.rs are shown then make the titles a/mod.rs and b/mod.rs respectively
    • if src/a/mod.rs, src/b/mod.rs, and src/some/subdir/a/mod.rs are shown, then the titles would be /src/a/mod.rs, b/mod.rs, and subdir/a/mod.rs respectively
  • In addition to one of the methods above, use the language server to resolve the actual name of the module relative to the root of the project, and use that as the tab title (so for example: src/page/language/mod.rs would instead be shown as crate::page::language, and src/page/language/filter.rs would be shown as crate::page::language::filter)
1 Like

I second this. I know I am suggested to just leave a like if I want to show support for someone’s post on this forum, but this has been something I have noticed every day working with GNOME builder + Rust.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.