Skip to content

Option to Show Only Unique Lines in Search Viewlet #252239

Open
@rmnilin

Description

@rmnilin

This is a duplicate of #90033 that was incorrectly closed IMO:

When you do a search in VS Code, it will return the same line multiple times if the search string is found in a line multiple times. For example, if you search for "Automobile", the following line will show up 3 times in the search results:

var myAutomobile = CreateAutomobile('Ford Automobile');

I'd like a feature or a setting so that each line is displayed in the search results only once.

(I know that I can manually remove a line from the search results by clicking the 'x' on the right-hand side, but it would be a huge time savings if there was an automated way to do this.

You may want to check my comment back on SO: https://stackoverflow.com/questions/60006913/how-to-exclude-duplicate-lines-in-vs-codes-search-results/60013518?noredirect=1#comment106231547_60013518

One of the contributors wrote:

This is a known limitation of the search viewlet, but in the search editor duplicates will show up on the same lime.

I see in the linked SO post you mention not being able to open links from the search editor, they can be opened with F12, Ctrl/Cmd + Click, or Double Click.

and then closed the issue as "completed" and added the "duplicate" label without linking the exact issue that was duplicated.

Acknowledging a limitation doesn't resolve the user's need for a cleaner, more efficient search experience within the primary search viewlet.

Using search editor preview is a workaround, not a "completed" solution to the requested feature. This is not that much better than using regex Automobile.+ every time instead of Automobile or clicking the 'x'.

Having a setting like "search.uniqueLines" would be a perfect solution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions