guettli
guettli

Reputation: 27826

vscode: Search in a directory which is outside the workspace

I want to search in a directory which is outside my workspace.

Steps:

  1. I open a file which is outside my workspace.
  2. Now I want to search in the directory which contains this file.
  3. I use "Reveal in Explorer" and try to use the breadcrumbs, but I see no way to search in the directory.

I use Go, but AFAIK this should not matter for this question.

Upvotes: 1

Views: 1069

Answers (1)

Mark
Mark

Reputation: 181050

As it happens another extension I wrote makes this pretty easy: Find and Transform.

It adds three context menu entries:

Search in this Folder
Search in this File
Search in the Results Files (if there has been a previous search with results)

You can right-click on any tab or editor body and select Search in this Folder and it will populate the files to include input box of a search with that file's parent folder path.

And if you have any text selected, the query field will be populated with that selection (even if it is just a cursor in a word).


You could also just right-click on that tab and chose Copy Path, paste that into the files to include input of a Search and then delete the last part of the path back to the folder.

Upvotes: 1

Related Questions