Home > OS >  How can I list all occurrences of a search term in one specific file in VS Code?
How can I list all occurrences of a search term in one specific file in VS Code?

Time:02-01

In VS Code I can find all occurrences of a search term in all project files via the main Search ("Find in Files" -- Ctrl Shift F).

This is a nice list of occurrences grouped by filename. However when I have many files in my project, but I am interested only in the occurrences for one file this list is pretty unwieldy.

How can I list all occurrences of a search term in only one specific file?

P.S. I know how to jump inside a file from occurrence to occurrence ("Find" -- Ctrl f and then Enter), but here I would like a list of occurrences.

CodePudding user response:

To get a list of search matches for a specific file, use the search pane's file filter mechanism and in the "files to include" field, enter the relative path to the file that you want to search in. To see the "files to include" field, you need to expand the little menu (see the "..." button) under the search field. Then just enter a search query like you normally would.

  • Related