Open kaste opened 6 months ago
How should this work when multiple plugins add sticky phantoms to the top and bottom of the view?
Throughout Sublime Text we only ever have "last-one-wins" API's. We have one gutter icon per line, one tooltip per view. If regions overlap they render however they want. :grin: etc. And you can't stack headers and footers endlessly anyway. (These are not "toast" messages.) To detect that on_hide
callbacks like for the tooltips would be maybe necessary so that the plugin knows when the sticky phantom changes.
Problem description
I would think "sticky" phantoms would be very useful. I say "phantoms" because they should render Html like the phantoms do. But they're not inserted at a specific point in the buffer but attached to a view.
We should have a sticky phantom at the top of a view and one at the bottom of a view. Stickiness means that they're in a layer "above" the buffer and don't scroll.
There are numerous way to think about them:
When you're in kind of an editor mode, show the keys/some help in a bottom phantom.
If you're looking at an older revision of a file, show the commit hash in a top phantom. Maybe also indicate that the revision is read-only.
Show type annotation/signature help in there. Generally, show documentation here. (Tooltips are often in the way and not subtle enough as they open directly at the cursor.)
Show a breadcrumb or the previous header in markdown/documentation files.
I think there are endless ways to use them.
Preferred solution
I don't have a preferred, superior API for that in mind.
Alternatives
Sticky tooltips would be basically the same thing. Although tooltips probably have more shadow, look less flat as typical sticky headers/footers. Also the phantoms should not automatically react to
ESC
as tooltips do.Additional Information
This is not the "breadcrumb"-feature (https://github.com/sublimehq/sublime_text/issues/5543) every other editor now has. The breadcrumbs have very different challenges.