-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workspace Search #943
Comments
So excited for this! It's a huge gap today 😄 I'll be very happy when I no longer need to leave Onivim 2 to
I've been thinking a bit about this - there are two pieces we need: Piece 1: The ability to focus the 'sidebar' or other panes. Ideally, we could use the IE, this oni2/src/Model/WindowManager.re Line 105 in b3fb1c6
docks ).
Piece 2: For vim keybindings, I anticipate there are multiple places we will want vim keybindings to integrate into GUI actions - the file explorer being one, the search result being another, maybe output logs / notifications like in #849 . I'd like to provide a special hook for this, like:
to act as the 'bridge' from the GUI world to Vim-keybinding-compatibility. Under-the-hood, this hook would integrate with Even without that fully implemented - we could implement the
I can see a few options for this: Option 1 - VSCode-style: - When the user initiates search, we show the search UI and the search results in the sidebar. This seems like it might be the simplest to implement - the only downside is the UX isn't great IMO (since search results are often much wider than the sidebar!). At the minimum, we'd need to implement a resize functionality for our sidebar alongside this. Option 2 - Search buffer: We could consider, though, moving the search query into the 'find results' pane. We could still show the magnifying-glass-search-icon in the activity bar, but what would be a bit awkward is clicking it would open this 'search buffer' instead of a sidebar. Option 3 - Vim / Quickfix style results: Vim has the concept of a 'quickfix' / 'loclist' window - which is a window you can toggle on / off at the bottom of the screen, that has a list of locations - often it is used to show search results: We could consider an experience like this, as it is 'vim-like'. It also is a place where we could funnel output from plugins that use the quickfix / location list. For the search experience, like option 2, we could consider moving the search query into the 'find results' pane.
It sounds like this would be like 'Option 2', except we include the search query in the buffer. Seems pretty reasonable to me!
In my opinion having the query UX separate would be a confusing (although I believe SublimeText does this...).
Vim does have a Thinking about this, I don't have a strong opinion per-se, but Option 3 - showing a bottom-window - is the most appealing to me. Primarily because such a pane could also be used for notification / output, like in #849 , showing build errors, and it would be a natural place for compatibility with Vim's quickfix / location list concepts. A quick mock-up of what I was thinking:
Just some ideas - sorry for the stream-of-consciousness reply! Let me know if you have ideas / questions / or need clarifications. |
I basically agree with what @bryphe has said, leaning into the vim side of things sounds like it could help both search and many other actions that use a QuickFix/Location list window. That way, we get a lot of benefit from adding a new component. I can see the benefit of having a search buffer too, so it could be something to explore as well. There is an open issue that outlines a different search buffer UI/UX: #194, which might help add some ideas for that. Especially for anything interactive, which is where a quick fix UI (at least in the vim model) breaks down for me. For a workspace search and replace, a big buffer so I can see every change and apply more formatting sounds nicer. |
I've just opened #971, which implements a rudimentary first attempt at a search UI. It's kind of a combination of vscode-style and vim-style, a drawer at the bottom which has the query UI on the left, roughly as wide and tall as in vscode, and the results on the right. It's a little bit awkward to have the button to open it on the side, far away from where it actually appears, but I'm sure we can figure out how to solve that. It would also be really easy to integrate a button, on the right side of the results header for example, to pop the results out into a buffer. We then have option 1, 2 and 3 all-in-one! (Kinda) |
Oh, cool @yunti! I actually googled Intellij/Webstorm's search UI when looking for inspiration, but didn't get the impression from screenshots that it was a popover-style UI. It looked like just a cramped dialog to me.
Have you switched the images? The second seems more relevant as it shows file content being searched, while the first is more like an advanced QuickOpen menu with an understanding of the AST. Which is of course cool, but requires very good language support. Probably more than the LSP provides? The second screenshot has a button labeled "Open in Find Window". Do you know what that is? What does that do that this doesn't? Other questions/concerns:
Definitely, I think that's the biggest benefit of this. Coupled with he ability to select a "work set" of results to open in a more persistent location list, as @gitbugr mentioned over in #971, this could be a very powerful tool. |
reposting here from #971 --
also a note about the tab-selection aspect of this - when it opens the quickfix menu, this suffices as my search & replace tool, in fact, it's more powerful. I can create a macro which will jump between the files and do more than just replacing strings. The only thing I don't have a solution for is explicitly excluding types of files. |
Thank you guys for being open to discuss such an important feature of code editors. I'm very excited for this stuff! I've been looking for the best search experience in code editors for quite a long time. What @gitbugr described above is close to what I use (and want), but not quite. 😄 I will list all the stuff that I personally want from search. I also understand that some of the features might not be implemented or be an overkill, but I think search functionality is the most important feature for me, so I need at least to have my word. Here's the list:
Generally speaking, I want oni2 to have a flexible and highly configurable generic search interface exposed through an API which in the future will allow plugin authors to build providers they want. Most of what I wrote is probably out of scope for this issue, but maybe it will give you some thoughts and ideas on how we should handle this. |
I second this. The search is the main reason why I haven't been able to switch to a vim-emulated experience in vscode/atom/itellij, and why oni2 is so exciting for me.
I actually have vim-swoop but don't get to use it very often because it doesn't allow you to do project-wide search/replace, only the buffers you currently have open. I think it could achieve both what I want (with macros) and what you want (with vim-swoop-like editing, right in the buffer.) |
Yup I agree it's definitely key, and worth the time to get right. And as @bogdan0083 mentioned mentioned, (ideally):
Answering @glennsl 's questions
Eh yes sorry I meant this one. I think one of the main design choices is whether to use an in-plane search or an out-of-plane / popover one.
It opens into this, which is basically in-plane search, but made really painful as to move the editor to the relevant result you have to double click each time, rather than single click (or hover). For layout of results, I would definitely go for result first, then filepath, (as you mentioned in the other thread @glennsl) as we are (generally) reading LtR so have the key item come first.
Generally it just shows the filename, if unique and enough of the path to identify it if the filename isn't unique. This works great - creates less noise (there's probably an option to configure it, but I can't see it straightaway). You can also make the window any width too.
It keeps the query and the state, so if you click away it's just a keyboard shortcut to pull it back up as it was, so this isn't ever an issue.
It works well for this too as it stores the query and state, so it's not an issue. Generally I would say that search is one's of intellij's strengths vs vscode (although intellij lacks in plenty of other areas) and is definitely an example worth looking at. However @bogdan0083 makes a great post and like most editors it definitely doesn't do point 5. That looks great and definitely looks like a great addition to search further down the line. Thinking further down the line, when we have multiple tools in there that @bryphe has mentioned he would like to do, like the filetree, search, embedded terminal, debugger etc...., it makes sense to have these treated in a common way, which is often what many editors/Ide's don't get quite right, and it seems that this being vim, making everything a buffer in some way is going to give better consistency. (eg as was touched on in #734 ) |
VS Code Insiders Edition also has a "Search Editor" feature now: https://code.visualstudio.com/updates/v1_42#_search-editor |
Just a minor UX suggestion, but if the search is going to remain in the bottom pane, the search icon should move to the status bar where Problems and Notifications are, since having it in the sidebar implies it's an openable sidebar pane. |
We 'bout to get search! But how?
Here's a rough outline of the (current) plan:
Copying vscode is relatively straight-forward, so while other feedback is of course also welcome, my only questions right now are:
Progress will be tracked in https://github.com/onivim/oni2/projects/9
The text was updated successfully, but these errors were encountered: