[find-and-replace] Convert the UI to a service
Have you checked for existing feature requests?
- [x] Completed
Summary
When I wrote pulsar-find-references, I wanted to present a frontend to the Find References Request described in the LSP spec.
The main presentation style is via same-document highlighting — put your cursor in a token and you see all the other references to that token in the document — but it's also able to provide all the references to that symbol in the entire project, if applicable. So I built a UI that was… remarkably similar to that of find-and-replace, including copying most of the HTML.
There's an alternative: much like autocomplete-plus is a lightweight autocompletion UI that can be driven by multiple data sources, we could make find-and-replace
- provide a UI service that can be consumed by any package that wants to show a results-style UI, or
- consume a service that can be provided by any package that can serve it a list of results.
Either model makes sense, depending on your mental model of the problem.
What benefits does this feature provide?
There's a lot of subtle behavior in the find-and-replace results list, and it feels very strange to be copying the exact HTML for what is basically the same use case.
The upside for the user is exact recreation of a UI they're very familiar with.
Any alternatives?
Actually, there's already a find-and-replace service. It was introduced because some packages were relying on being able to retrieve the display markers for search results from the default marker layer.
Though it wasn't envisioned this way, this service made it possible to write packages that put search results on the scroll bar.
This existing service could be broadened to support more tasks; this would be the “UI provider” model rather than the “data provider” model.
Other examples:
No response