Skip to content
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

Feature: Support multiple searches #16488

Closed
KalitaAlexey opened this issue Dec 5, 2016 · 99 comments
Closed

Feature: Support multiple searches #16488

KalitaAlexey opened this issue Dec 5, 2016 · 99 comments
Assignees
Labels
feature-request Request for new features or functionality on-testplan search Search widget and operation issues
Milestone

Comments

@KalitaAlexey
Copy link

Hi everybody.

Currently VSCode supports only one active search: I cannot look for multiple things at a time.
I often have need in this feature.
I can implement it myself if someone will guide me.
I suggest to add new tab "Searches", which looks like this:
collapsed_searches
And it expands to:
expanded_searches
Unfortunately, I haven't made a close button. Imagine there is a close button to the right of a search entry.
When a user starts a search, then an entry in the searches is created.
When a user clicks on a search entry, then the entry's search becomes active.
When a user clicks on the close button of a search entry, then the entry is deleted.

I am waiting for your opinions to this feature.

@sandy081
Copy link
Member

sandy081 commented Dec 7, 2016

@KalitaAlexey Very much appreciated with your thoughts and ideas. I see that your base requirement is that you wanted to look multiple things at a time. Can you please explain in little more details how do you want to see above results at the end. Possibly with an example would be good.

Thanks

@KalitaAlexey
Copy link
Author

KalitaAlexey commented Dec 7, 2016

Hi @sandy081,
Only one search is active at a time.
Results of the search is shown under the configuration of a search. As it is made now.
I will include screenshots.

@KalitaAlexey
Copy link
Author

Hi @sandy081,
I try to implement it myself.

@sandy081
Copy link
Member

sandy081 commented Dec 8, 2016

@KalitaAlexey We are always welcome to receive PRs for VS Code. But I would suggest before starting, it would be good to discuss in detail.

  • What is the problem?
  • What is the proposed solution?
  • Are there any other current ways to overcome the problem

Hence, I asked to know how the end result looks like and is it going to fix the problem? It would be helpful if you can explain me with an example.

Thanks

@KalitaAlexey
Copy link
Author

Hi @sandy081,
I am downloading source code. I am changing the source code just to prepare an example.
I am sending pictures then.

@KalitaAlexey
Copy link
Author

Hi @sandy081 and everyone,

I have thought about this feature and have prepared some screenshots explaining the design.
I'm sorry for the close button on the screenshots below.
Let's assume we open a project.
We navigate to the "Search" tab.
It is empty:
empty_search
We enter A to the "Search" field and press the Enter button.
It starts a new search.
When the search is ended, the "Searches" panel appears:
a_is_added
We enter B to the "Search" field and press the Enter button again.
It starts a new search.
When the search is ended, in the "Searches" panel the new search appears:
b_is_active_search
I click on the "A" search in the "Searches" panel.
The "A" search becomes active:
a_is_active_search

If the close button of a search is clicked, then the associated search is removed.
If all searches are removed, the "Searches" panel is hidden.

Unresolved questions

Should a new search be added to the "Searches" panel either when the search started or ended?

If it would be added when it is started, then we should think about whether a running search may be cancelled.

Is an active search customizable?

If it would be, then there should be a way to start a new search.

Regards,
Alexey

@sandy081
Copy link
Member

sandy081 commented Dec 8, 2016

@KalitaAlexey Thanks for the details. I am wondering why not using the following flow with current design (Single Search)

-> Search for value1 you see results
-> Search for value2 you see results
-> If you want to see previous results, navigate history in Search input using alt+up and enter and you see results.
-> if you want to see results matching value1 or value2 at a time why not use Reg ex `(value1)|(value2)

I am not getting the use case that needs to show results for two search terms at a time. May be I am not sure, but I have not seen in any editor that shows multiple search results at a time.

Sorry, but I am trying to get the need to build this functionality and how everybody can gain by this.

Thanks

@KalitaAlexey
Copy link
Author

@sandy081,
I didn't know about alt+up, but anyway it doesn't preserve search results. I must start search again.
Think about it if a project very very big.

@leup
Copy link

leup commented Jan 26, 2017

Being able to keep search results would be very nice. Sometimes it's useful to be able to switch between search results without relaunching the search everytime.
So, may be a checkbox "Open results in a new pane", or something.
Netbeans, for example, keep results in different panes.

image

Here, for instance, I searched for "grdf" and "test", and each result set is kept in a different pane.

@theclapp
Copy link

theclapp commented Feb 8, 2017

You can use regular expressions to search for multiple items at once, though it's obviously still all the same single search. E.g. from your example above, "A|B" would search for A and B at the same time. (Make sure you enable regular expressions for that search; on a Mac, Opt-Cmd-R.)

@KalitaAlexey
Copy link
Author

KalitaAlexey commented Feb 8, 2017

@theclapp,
I'd rather open a new window and search there.
What if I already use regex for something ugly and complex?

@leup
Copy link

leup commented Feb 8, 2017

@KalitaAlexey 👍
@theclapp I agree that it could be a solution for some simple searches, but this is not what I am looking for.

@theclapp
Copy link

theclapp commented Feb 8, 2017

Use parentheses: (ugly-complex-expression)|(some-other-expression)

Don't get me wrong: You can ask for this (or implement it!), that's fine with me. I'm not saying you shouldn't. I'm just saying there are alternatives or workarounds out there.

If someone does do this, might I suggest highlighting the different finds in different colors.

@KalitaAlexey
Copy link
Author

@theclapp,
I know about alternatives, but it isn't convenient.
I got your point.

@sandy081 sandy081 added feature-request Request for new features or functionality search Search widget and operation issues labels Feb 27, 2017
@sandy081 sandy081 added this to the Backlog milestone Feb 27, 2017
@jjinux
Copy link

jjinux commented Mar 9, 2017

This is an absolute must for me and a few of my co-workers. We have a very large codebase. Currently, I use IntelliJ. I'm often involved in very large refactors. I might do a search for something that I need to refactor. I work my way down the list slowly. I might have that search tab open for a day and a half. If I need to search for something else, I can search in a new tab without losing my place in my refactoring effort.

Switching between search terms is not a viable solution to this problem since I lose my place in the search results every time I have to do a new search.

This is a feature that NetBeans, IntelliJ, and even Sublime Text (via a plugin) have.

If you'd like to see how IntelliJ did the UI:

  • Do a global search.
  • Do another global search, but before you start it, click Result options :: Open in new tab.

By default, the "Open in new tab" is unchecked so as not to confuse the newbies. However, more advanced users such as myself have it checked all the time.

BTW, this is the single, most important feature that prevents me from being able to use VS Code.

@spencer-schumann
Copy link

I agree that this is an important feature. Often when analyzing the results of a search it's helpful to run additional exploratory searches without losing the context on the original search. One helpful feature that search currently has is a close button to remove individual files from the search to prune out irrelevant results. If you've been analyzing and pruning a search and then start a new search, you currently lose all of the pruning you've done.

@balajitrv
Copy link

@sandy081 , Although i have nothing extra to add, VS2015, provides this option via ctrl+shift+f, append results or list results in results 2 window. This would be a good addition to VSCode if you can accommodate the request.

@KalitaAlexey
Copy link
Author

But please don't limit count of searches to 2.
Sometimes you need much more than that.

@asad-abbasi
Copy link

I like VS Code very much and try to use it as much as possible. However multiple searches is one feature for which I am forced to get help from some other editor. I would suggest taking a look at Notepad++ before designing the feature for VS Code.

@himanshu-codaio
Copy link

+1 to multiple search windows. It is very helpful when you want to do follow up searches to understand the context of something you found in the first search. I often have to fire up Idea just for this specific thing. Would like to be able to move to VSCode for everything.

@jjinux
Copy link

jjinux commented Jan 10, 2018

One nice workaround to handle this problem is to do:

ag --group search_term directory | code - &

You can even do it from the terminal within VS Code. This will pop open a temporary file with the search results, and you can edit or delete them as you go through them.

@gel
Copy link

gel commented Nov 7, 2019

This is mandatory, how can we get this prioritized?

@RenjingYin
Copy link

Encountered same use case, I downloaded another editor for simple solution, but would love to see this in VScode

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Nov 19, 2019

Hey all, this sprint I'll be working on a somewhat related feature, "Search Tabs", where search results can be copied over to a tab while preserving "go-to-result" support. You could have an arbitrarily large number of these "Search Tabs", but (at least for the initial implementation), the query will not be modifiable once the results have been dumped into a tab.

I believe this would solve many of the pain points listed in this thread, and I'm interested to hear if anyone here has a use case that would not be satisfied with such a model.

@aramando
Copy link

@JacksonKearl That sounds perfect, especially if the search tabs will be formatted in the same way as the search results, i.e. grouped by source file and with the option to permanently remove items from the list once they have been assessed to be either irrelevant or dealt with.

@JacksonKearl
Copy link
Contributor

@aramando The search tabs will be text editors (a. la. Sublime), so removing results is deleting text.

@evelant
Copy link

evelant commented Nov 21, 2019

@JacksonKearl Awesome! Glad to see movement on this. My opinion is that the search panel should be done away with altogether. Search results should always open in a separate persisted tab. If I think about all the searches I've done recently not a single one of them made sense as a temporary set of results in the side panel. Nearly all global searches I do lead to subsequent searches based on the original result set which is currently impossible to do while keeping the original results around. This lackluster search function is by far my biggest pain point with VSCode.

@JacksonKearl
Copy link
Contributor

@AndrewMorsillo This is just the MVP to start to get an idea of what the Search Editor flow is like, many people have similarly requested to skip the search viewlet/panel entirely and we may in the future make the overall search position configuration 'viewlet' | 'panel' | 'editor'. #23931 has more discussion on the matter.

@Maxxee
Copy link

Maxxee commented Dec 3, 2019

(Sorry for "invading" this thread - well, it's not really invading, it's about the search feature after all and all other threads are closed.)

I really appreciate that you made the search feature remember the search phrases by pressing up/down or alt+up/alt+down.
This was really needed.
Now excuse me, but what is so difficult about adding something visual to the Visual Studio Code like two arrow keys, so that you have an expandable list of all the previous search phrases like in any other editor?

@fxdave
Copy link

fxdave commented Jan 4, 2020

@JacksonKearl Having search tabs is a nice to have feature, but I would step a bit further. On every search tabs, there could be a "-" and a "+" button to be able to subtract and add other search tab results to(from) the actual one.

On search tabs:
By clicking "-" a modal could show up to select a search tab for subtraction.
By clicking "+" a modal could show up to select a search tab for addition.

On the selection modal:
By pressing "enter" it would modify the currently active search tab.
By pressing "shift+enter" it would create a new search tab.

Addition and subtraction should operate between filenames, instead of between the resulted lines since lines can be subtracted out by an in-tab search.

@JacksonKearl
Copy link
Contributor

A new Search Editor implementation is out for testing, which enables having multiple active searches:
image

You can try this out with the Open new Search Editor command, which you can map to any keybinding you'd like in the Keybindings Editor.

Let me know how this works for your multiple searches use cases.

More details at #88154.

@JacksonKearl
Copy link
Contributor

As mentioned earlier, we are supporting multiple searches through search editors, which have been available in preview for a couple releases and will be out of preview in the February release.

@NickGrease
Copy link

NickGrease commented Feb 22, 2020

I appreciate the effort to improve searches, but this is not what I had hoped for. I have more than enough tabs open as it is, adding a half dozen or more tabs is ridiculous. The side bar is where searches belong (for me, my opinion); horizontal workspace is at a premium, and I hope someone over there can appreciate other peoples workflow and viewing restraints.

To add to the problem, the tab doesn't even show what files/folders/disks are being searched. The sidebar made it easy to see where the search was performed, and at a glance which files had matches. I don't really enjoy the idea of scrolling through 1000's of lines of search results to see if a match was in a specific file.

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Feb 28, 2020

@NickGrease I appreciate your feedback and understand that this isn't exactly what was originally requested, but at the end of the day we aren't in a position where we can dedicate resources to developing many different competing search models.

With that said, I would be interested in improving one of the current search models to better suit your needs:

the tab doesn't even show what files/folders/disks are being searched

Could you explain what you mean by this? It uses the same query editor widget as the search viewlet.

I don't really enjoy the idea of scrolling through 1000's of lines of search results to see if a match was in a specific file.

Wouldn't you be doing this in the viewlet as well?

@jaroslawjanas
Copy link

What I rly end up needing all the time is

  1. Nested searches
  2. Search history/selection
  3. More advanced searches
  4. Better documentation on how to actually search stuff because the one you have at the moment is incredibly confusing (at least for me, maybe I'm stupid)

@roblourens
Copy link
Member

@jaroslawjanas I would like to hear more about all of those points. Please open a new issue

  1. Honestly I'm not sure what you mean by this
  2. You can navigate history with the up/down arrow keys, please tell me more if it's not what you're looking for
  3. Advanced in what way?
  4. And I'd like to improve the documentation, please tell me what you are struggling with

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Feb 28, 2020

@jaroslawjanas

  1. Nested searches

Do you mean searching for a string within the results of a different search? This is possible with search editors.

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Feb 28, 2020

@roblourens I think 2. refers to a global history of the full search configuration, so queries get associated with flags and includes/etc. This could be especially useful now that we have two separate ways to run workspace searches.

@jaroslawjanas
Copy link

jaroslawjanas commented Feb 29, 2020

  1. (4.) I just did a quick google search of search editors didn't find anything in the top searches

  2. I mean a search history similar to history of actions in Photoshop, where you get a table with all of your actions listed in order, so something similar for vs code would be nice, rather than jumping from search to search till you find the one you wanted.

  3. Good question, I don't know why but I find the feature lacking in features (no pun intended), I mean it shouldn't be overdeveloped either but maybe some more UI or something that would make complex searches easier to write. Maybe an option to have a preview based on sample data and then you can just swap your actual search params to do the actual search? That'd be pretty handy.

  4. Usages, cases, examples of difficult searches.

@roblourens
Copy link
Member

Please, let's discuss in a new issue

@NickGrease
Copy link

@JacksonKearl

the tab doesn't even show what files/folders/disks are being searched

Could you explain what you mean by this? It uses the same query editor widget as the search viewlet.
ImageA

ImageB

With multiple tabs open, figuring out which tab was which search, is a pain compared to the sidebar view.

I don't really enjoy the idea of scrolling through 1000's of lines of search results to see if a match was in a specific file.

Wouldn't you be doing this in the viewlet as well?

ImageC

Using your treatment/implementation, the search for "Test" would mean scrolling past 64 results in Scripts, 24 in documentation, to finally find the 4 in research. Using the image above, it takes a split second.

When I'm searching hierarchies of folders (that I'm not always familiar with) for bits of api code/functions - I need to see at a glance what folders the results are in. If I search for a function that I expect starts with the word "Load", seeing a list of folders that have matches means I can guess what folder I'm likely looking for, for example,if the results show a dozen folders, one is "ShipAI", one is, ShipCrewAPI" one is "PlanetAPI" - if I was looking for how to "load crew" - I'd know instantly what folder to open results in.

I hope that makes sense; and at the end of the day I've been managing for well over a year now. You do you, and I'll make do :)

@frumbert
Copy link

frumbert commented Mar 3, 2020

@jaroslawjanas

  1. Nested searches

Do you mean searching for a string within the results of a different search? This is possible with search editors.

I'd like to search for a term to get a list of the files that match that value. THEN with the list of the files, search only those files for a different term. Currently the process is that I click the file in the search result, the press ctrl-f on the file view and search my second term inside the file, stepping through all the matches. It would be far easier to have a "Search within results" option.

What are search editors?

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Mar 3, 2020

@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests