Searchfox tab titles now dynamically update

16 views
Skip to first unread message

Andrew Sutherland

unread,
Apr 5, 2021, 7:20:27 PMApr 5
to dev-pl...@mozilla.org, Firefox Dev
You may have noticed that your Searchfox tab titles are much more
exciting than they used to be, especially if you mainly look at C++
code!  What's going on?

We start by selecting only the finest symbols using these artisanal
heuristics:
1) Current selection.  If you have selected a line by clicking on a line
number (and as is reflected in the URL hash), we attempt to figure out
what symbol is on the line you selected or, failing that, what's going
on with closest symbol that would result in a "position: sticky" being
displayed for that line.  You can de-select a line by control-clicking
on an already selected line.
2) Current "position: sticky".  If you haven't selected a line, we just
use the current most specific "position: sticky" thing you're looking at.
3) We give up and just show you the classic `${filename} - mozsearch`.

Once we've selected the finest symbols we:
1) Try and collapse things that perhaps are namespaces so your tab
titles aren't just namespaces.  "mozilla::dom::Foo::Bar" becomes
"m:d:Foo::Bar". "mozilla::dom::foo::Bar" becomes "m:d:f:Bar".
2) Put the classic title in parentheses.  So you get `m:d:Foo::Bar
(${filename} - mozsearch)`.

These heuristics are currently a little hacky but will hopefully be
improved by changes that will be landing as part of bug 1641372 that
provides searchfox with a more structured understanding of the codebase
that will let us know what is and isn't a namespace.

Relevant links for those looking to provide feedback or get more
involved (we're always looking for more contributors!):
- https://bugzilla.mozilla.org/show_bug.cgi?id=1702319 covers the
changes discussed here plus some thoughts about using the Clients API to
help reuse existing Searchfox tabs.
- https://bugzilla.mozilla.org/show_bug.cgi?id=1641372 covers landing
structured analysis changes and some potential changes to how we deal
XPIDL/IPDL/WebIDL.
- The current implementation is the `DocumentTitler` in
https://github.com/mozsearch/mozsearch/blob/master/static/js/code-highlighter.js
- https://bugzilla.mozilla.org/show_bug.cgi?id=1703077 covers some
deployment hiccups today that will be addressed by
https://bugzilla.mozilla.org/show_bug.cgi?id=1703115 and
https://bugzilla.mozilla.org/show_bug.cgi?id=1687148#c1

You can also provide feedback in the "Searchfox" channel on
https://chat.mozilla.org/ or the "Searchfox Outage" channel if your
feedback is more urgent in nature.

Andrew

Reply all
Reply to author
Forward
0 new messages