Reputation: 135
When I 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 I search for "Automobile
", the following line will show up twice in the search results:
var myAutomobile = 'Ford Automobile';
Is there any way to get VS Code to display the same line 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 I'm wondering if there's an automated way to do this.)
Upvotes: 1
Views: 1524
Reputation: 181329
This does happen in the search panel results (and I don't think can be avoided) but if you enable this setting:
search.enableSearchEditorPreview
(or search for "Search: Enable Search Editor Preview" in the settings)
and then click on the "open in editor
" link at the top of the search results (after a new search after enabling the setting), a new editor tab will open with your search results and I don't see duplicates listed there.
More info: https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_42.md#search-editor and Visual Studio Code - Include context in search results
And in v1.42 (coming later this week) you can use this command search.action.openNewEditor
to directly open a search editor without first executing a search in the traditional panel.
Upvotes: 1