Ability to expand to more lines in multi-buffer view
Is your feature request related to a problem? Please describe. Project search and multi-buffer editing is a killer feature. Kudos! But at times when searching for a term in a big/unknown repo, you may want to have more context around the result.
Describe the solution you'd like Similarly as the GitHub PR provides (fig. below), would be cool if the multi-buffer view could allow users to expand lines above and/or below a result.
Describe alternatives you've considered Perhaps having the ability to open the file in a normal buffer view, but would defeat the amazing multi-buffer experience.
This is something I've been interested in for awhile. Some ideas I that came to mind were:
- A setting could be added to specify the default number of context lines
- A global button could be placed somewhere up near the global search input widget that could adjust the amount of context for all excerpts (this may not be a good idea though, as that might be rather expensive)
- Individual adjustment buttons to tweak each one differently, as needed
I could definitely see an expand button next to the ‘jump to’ button. Would help lower the cycle time on exploring APIs usages in large codebases.
Just my 2c: sometimes you need a couple more lines of context because of formatting in some places but not in others. Being able to expand views individually on demand would be nice in such situations.
My 2c as well: reducing context is as important to me as expanding.
When I tried to switch to Zed, I quickly realized how much I rely on very dense global search results with only one line of context per result, something like this:
I love Zed's multi-buffer but the file headers use too much vertical space and the default context size for search makes it impossible to see lots of results on one screen (unless I'm missing an option somewhere which is entirely possible).
Feedback from @erikareads in the Gleam Discord:
is there a way to expand the number of lines shown in the search view? That is, before and after the search result? A co-worker uses Zed, and the context we needed was just below the fold on each of the search results because of how the call-sites were prettified. Context I could/would add:
ripgrepseparates this into two flags:--after-contextwhich does lines after the matched line and--before-contextwhich does lines before the matched line.--contextis a shorthand for doing both.
This PR adds in the UI and a keybinding to expand the multi-buffer excerpts:
- https://github.com/zed-industries/zed/pull/10300
You can customize the number of lines that get expanded (see the PR). I think we can close this issue out. This does not add in the ability to shrink the excerts, but if the demand for that is high enough for that, we can add that in in a a follow-up.